Skip to content

Commit d808fcf

Browse files
author
nikos
committed
Both supporting Sum-Product (SPA) and Min-Sum (MSA) Algorithms for LLR caclulations. Corresponding field added on config to select algorithm deployed.
1 parent e290efa commit d808fcf

6 files changed

Lines changed: 34 additions & 7 deletions

File tree

config.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
timestamp = [num2str(start_time(1),'%04d') '_' num2str(start_time(2),'%02d') '_' num2str(start_time(3),'%02d') '_' num2str(start_time(4),'%02d') '_' num2str(start_time(5),'%02d') '_' num2str(start_time(6),'%2.0f')];
22
result_path = './results/';
3-
addpath('support');
43
%% Configure parameters
54
%Polar-Code values
65
capacity = 0.5; %I(W), Channel's W Capacity
@@ -17,6 +16,7 @@
1716
%seed
1817
fix_seed = 1; %1:fix data, 0:random data
1918
%Simulation values
19+
decoding_algorithm = 'MSA'; % Set as 'SPA' for Sum-Product algorithm , or 'MSA' for Min-Sum Algorithm.
2020
fast_run = 1; %1:run of optimal-matlab code + mex-files, 0:run of hardware-code (suboptimal f/g)
2121
min_fer_errors = 100; %minimum frame errors to count
2222
min_codewords = 100; %minimum codewords to count
@@ -27,8 +27,11 @@
2727
FLAG_Enable_parpool=0; % 0: Disable, 1: Enable
2828
parcore_nums = 4;
2929
%% Initializations
30-
%add mex-files
31-
if(fast_run == 1)
30+
%add required matlab paths
31+
restoredefaultpath;
32+
addpath('support');
33+
addpath(['./support/f_function/' decoding_algorithm]); % for l_f function.
34+
if(fast_run == 1) % for mex-files
3235
addpath('./support/mex_files');
3336
end
3437
%initialize seed

support/f.m

Lines changed: 0 additions & 4 deletions
This file was deleted.

support/f_function/MSA/f.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function y = f(x1,x2)
2+
%f(?a,?b) proccess
3+
%Min-Sum Algorithm (MSA) deployed
4+
y = sign(x1)*sign(x2)*min(abs(x1),abs(x2));
5+
end

support/f_function/MSA/l_f.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function output = l_f(l,j,llr,frozen_bits,estimated)
2+
%Takes l (stage from 1 to log2(N)+1), j-channel (from 1 to N), llr array, frozen
3+
%bits array and current estimated outputs array
4+
%outputs the l
5+
%Min-Sum Algorithm (MSA) deployed
6+
stages = log2(length(frozen_bits));
7+
if (l == stages+1)
8+
output = llr(j);
9+
elseif( mod(floor((j-1)/power(2,l-1)),2) == 0)
10+
a = l_f(l+1,j,llr,frozen_bits,estimated);
11+
b = l_f(l+1,j+power(2,l-1),llr,frozen_bits,estimated);
12+
output = sign(a)*sign(b)*min(abs(a),abs(b));
13+
else
14+
output = (1-2*s_f(l,j-power(2,l-1),frozen_bits,estimated)) * (l_f(l+1,j-power(2,l-1),llr,frozen_bits,estimated)) + l_f(l+1,j,llr,frozen_bits,estimated) ;
15+
end
16+
17+
%correct

support/f_function/SPA/f.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function y = f(x1,x2)
2+
%f(?a,?b) proccess
3+
%Sum-Product Algorithm (SPA) deployed
4+
y = 2*atanh(tanh(x1/2)*tanh(x2/2));
5+
end

support/l_f.m renamed to support/f_function/SPA/l_f.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
%Takes l (stage from 1 to log2(N)+1), j-channel (from 1 to N), llr array, frozen
33
%bits array and current estimated outputs array
44
%outputs the l
5+
%Sum-Product Algorithm (SPA) deployed
56
stages = log2(length(frozen_bits));
67
if (l == stages+1)
78
output = llr(j);

0 commit comments

Comments
 (0)