Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
promise
OpenXG-RAN
Commits
f0e7c3da
Commit
f0e7c3da
authored
7 years ago
by
letr
Committed by
Florian Kaltenberger
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new algorithm
parent
1cdf7af3
oai_ue_mwc18_integration
No related merge requests found
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
229 additions
and
185 deletions
+229
-185
openair1/PHY/CODING/TESTBENCH/Gen_shift_value.h
openair1/PHY/CODING/TESTBENCH/Gen_shift_value.h
+4
-0
openair1/PHY/CODING/TESTBENCH/ldpctest.c
openair1/PHY/CODING/TESTBENCH/ldpctest.c
+104
-78
openair1/PHY/CODING/TESTBENCH/ldpctest.c~
openair1/PHY/CODING/TESTBENCH/ldpctest.c~
+121
-107
No files found.
openair1/PHY/CODING/TESTBENCH/Gen_shift_value.h
View file @
f0e7c3da
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/TESTBENCH/ldpctest.c
View file @
f0e7c3da
...
...
@@ -65,18 +65,7 @@ char quantize(double D,double x,unsigned char B)
}
#define MAX_BLOCK_LENGTH 8448
/*
int test_ldpc(unsigned int coded_bits,
double sigma,
unsigned char qbits,
unsigned int block_length,
unsigned int ntrials,
unsigned int *errors,
unsigned int *trials,
unsigned int *uerrors,
unsigned int *crc_misses,
unsigned int *iterations)
*/
int
test_ldpc
(
short
No_iteration
,
double
rate
,
double
SNR
,
...
...
@@ -87,6 +76,11 @@ int test_ldpc(short No_iteration,
unsigned
int
*
crc_misses
)
{
//clock initiate
time_stats_t
time
;
opp_enabled
=
1
;
cpu_freq_GHz
=
get_cpu_freq_GHz
();
short
test_input
[
block_length
];
short
*
c
;
//padded codeword
short
*
esimated_output
;
...
...
@@ -98,7 +92,7 @@ int test_ldpc(short No_iteration,
short
*
Gen_shift_values
,
*
no_shift_values
,
*
pointer_shift_values
;
short
BG
,
Zc
,
Kb
,
nrows
,
ncols
;
int
i1
,
i2
,
i3
,
i4
,
t
;
int
i1
,
i2
,
i3
,
i4
,
i5
,
i6
,
t
,
temp
,
k
;
//Table of possible lifting sizes
short
lift_size
[
51
]
=
{
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
18
,
20
,
22
,
24
,
26
,
28
,
30
,
32
,
36
,
40
,
44
,
48
,
52
,
56
,
60
,
64
,
72
,
80
,
88
,
96
,
104
,
112
,
120
,
128
,
144
,
160
,
176
,
192
,
208
,
224
,
240
,
256
,
288
,
320
,
352
,
384
};
...
...
@@ -113,7 +107,9 @@ for (i=0; i<block_length; i++) {
//test_input[i] = (unsigned char)(taus()&0xff);
test_input
[
i
]
=
rand
()
%
2
;
//test_input[i]=i%2;
}
start_meas
(
&
time
);
//determine number of bits in codeword
if
(
block_length
>
3840
)
...
...
@@ -156,8 +152,10 @@ for (i=0; i<block_length; i++) {
pointer_shift_values
=
(
short
*
)
pointer_shift_values_BG1
;
if
(
Zc
==
2
||
Zc
==
4
||
Zc
==
8
||
Zc
==
16
||
Zc
==
32
||
Zc
==
64
||
Zc
==
128
||
Zc
==
256
)
Gen_shift_values
=
(
short
*
)
Gen_shift_values_BG1_a_2
;
else
if
(
Zc
==
3
||
Zc
==
6
||
Zc
==
12
||
Zc
==
24
||
Zc
==
48
||
Zc
==
96
||
Zc
==
192
||
Zc
==
384
)
Gen_shift_values
=
(
short
*
)
Gen_shift_values_BG1_a_3
;
// else if (Zc==3||Zc==6||Zc==12||Zc==24||Zc==48||Zc==96||Zc==192||Zc==384)
//Gen_shift_values=(short*) Gen_shift_values_BG1_a_3;
else
if
(
Zc
==
384
)
Gen_shift_values
=
(
short
*
)
Gen_shift_values_BG1_Z_384
;
else
if
(
Zc
==
5
||
Zc
==
10
||
Zc
==
20
||
Zc
==
40
||
Zc
==
80
||
Zc
==
160
||
Zc
==
320
)
Gen_shift_values
=
(
short
*
)
Gen_shift_values_BG1_a_5
;
else
if
(
Zc
==
7
||
Zc
==
14
||
Zc
==
28
||
Zc
==
56
||
Zc
==
112
||
Zc
==
224
)
...
...
@@ -176,8 +174,10 @@ for (i=0; i<block_length; i++) {
{
no_shift_values
=
(
short
*
)
no_shift_values_BG2
;
pointer_shift_values
=
(
short
*
)
pointer_shift_values_BG2
;
if
(
Zc
==
2
||
Zc
==
4
||
Zc
==
8
||
Zc
==
16
||
Zc
==
32
||
Zc
==
64
||
Zc
==
128
||
Zc
==
256
)
Gen_shift_values
=
(
short
*
)
Gen_shift_values_BG2_a_2
;
//if (Zc==2||Zc==4||Zc==8||Zc==16||Zc==32||Zc==64||Zc==128||Zc==256)
// Gen_shift_values=(short*) Gen_shift_values_BG2_a_2;
if
(
Zc
==
128
)
Gen_shift_values
=
(
short
*
)
Gen_shift_values_BG2_Z_128
;
else
if
(
Zc
==
3
||
Zc
==
6
||
Zc
==
12
||
Zc
==
24
||
Zc
==
48
||
Zc
==
96
||
Zc
==
192
||
Zc
==
384
)
Gen_shift_values
=
(
short
*
)
Gen_shift_values_BG2_a_3
;
else
if
(
Zc
==
5
||
Zc
==
10
||
Zc
==
20
||
Zc
==
40
||
Zc
==
80
||
Zc
==
160
||
Zc
==
320
)
...
...
@@ -194,55 +194,82 @@ for (i=0; i<block_length; i++) {
Gen_shift_values
=
(
short
*
)
Gen_shift_values_BG2_a_15
;
}
c
=
(
short
*
)
malloc
(
sizeof
(
short
)
*
Kb
*
Zc
);
channel_input
=
(
short
*
)
malloc
(
(
Kb
+
nrows
)
*
Zc
*
sizeof
(
short
));
modulated_input
=
(
double
*
)
malloc
(
(
Kb
+
nrows
)
*
Zc
*
sizeof
(
double
));
//channel_output = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
channel_output
=
(
double
*
)
malloc
(
(
Kb
+
nrows
)
*
Zc
*
sizeof
(
double
));
channel_output_fixed
=
(
short
*
)
malloc
(
(
Kb
+
nrows
)
*
Zc
*
sizeof
(
short
));
channel_input
=
(
short
*
)
malloc
(
(
Kb
+
nrows
)
*
Zc
*
sizeof
(
short
));
//padded input sequence
memset
(
c
,
0
,
sizeof
(
short
)
*
Kb
*
Zc
);
memcpy
(
c
,
test_input
,
block_length
*
sizeof
(
short
));
//start_meas(&time);
//encode the input sequence
memset
(
channel_input
,
0
,(
Kb
+
nrows
)
*
Zc
*
sizeof
(
short
));
// parity check part
for
(
i1
=
0
,
t
=
Kb
*
Zc
;
i1
<
nrows
;
i1
++
)
{
for
(
i2
=
0
;
i2
<
Zc
;
i2
++
)
{
t
=
Kb
*
Zc
+
i2
;
//rotate matrix here
for
(
i5
=
0
;
i5
<
Kb
;
i5
++
)
{
temp
=
c
[
i5
*
Zc
];
memmove
(
&
c
[
i5
*
Zc
],
&
c
[
i5
*
Zc
+
1
],
(
Zc
-
1
)
*
sizeof
(
short
));
c
[
i5
*
Zc
+
Zc
-
1
]
=
temp
;
//for (i6 = 0; i6 < Zc-1; i6++)
//for (i6 = i5*Zc; i6 < i5*Zc + Zc-1; i6++)
//{
//c[i5*Zc+i6] = c[i5*Zc+i6+1];
//c[i6] = c[i6+1];
//}
//c[i5*Zc+i6] = temp;
//c[i6] = temp;
}
for
(
i1
=
0
;
i1
<
nrows
;
i1
++
)
{
for
(
i3
=
0
;
i3
<
Kb
;
i3
++
)
{
for
(
i4
=
0
;
i4
<
no_shift_values
[
i1
*
ncols
+
i3
];
i4
++
)
{
channel_input
[
t
]
=
channel_input
[
t
]
+
c
[
i3
*
Zc
+
(
Gen_shift_values
[
pointer_shift_values
[
i1
*
ncols
+
i3
]
+
i4
]
+
i2
+
Zc
)
%
Zc
];
//start pointer %element %shift Z
channel_input
[
t
+
i1
*
Zc
]
=
channel_input
[
t
+
i1
*
Zc
]
+
c
[
i3
*
Zc
+
Gen_shift_values
[
pointer_shift_values
[
i1
*
ncols
+
i3
]
+
i4
]
];
}
}
channel_input
[
t
]
=
channel_input
[
t
]
&
1
;
t
++
;
channel_input
[
t
+
i1
*
Zc
]
=
channel_input
[
t
+
i1
*
Zc
]
&
1
;
}
/*
for (i1=0; i1 < nrows; i1++)
{
k=i1*Zc;
for (i3=0; i3 < Kb; i3++)
{
for (i4=0; i4 < no_shift_values[i1 * ncols + i3]; i4++)
{
channel_input[t+k] = channel_input[t+k] + c[ i3*Zc + Gen_shift_values[ i4] ];
}
}
channel_input[t+k]=channel_input[t+k]&1;
}
*/
}
//stop_meas(&time);
// information part
memcpy
(
channel_input
,
c
,
Kb
*
Zc
*
sizeof
(
short
));
stop_meas
(
&
time
);
//for (i=0;i<(Kb+nrows) * Zc;i++)
print_meas_now
(
&
time
,
""
,
stdout
);
//for (i=(Kb+nrows) * Zc-10;i<(Kb+nrows) * Zc;i++)
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
//replace with ldpc encoder, write to channel_input
/*
dlsch_encoding(test_input,
&PHY_vars_eNB->lte_frame_parms,
num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[0][0],
0,
subframe,
&PHY_vars_eNB->dlsch_rate_matching_stats,
&PHY_vars_eNB->dlsch_turbo_encoding_stats,
&PHY_vars_eNB->dlsch_interleaving_stats);
*/
for
(
i
=
0
;
i
<
(
Kb
+
nrows
)
*
Zc
;
i
++
)
{
//channel
modulated_input
=
(
double
*
)
malloc
(
(
Kb
+
nrows
)
*
Zc
*
sizeof
(
double
));
//channel_output = (short *)malloc( (Kb+nrows) * Zc*sizeof(short));
channel_output
=
(
double
*
)
malloc
(
(
Kb
+
nrows
)
*
Zc
*
sizeof
(
double
));
channel_output_fixed
=
(
short
*
)
malloc
(
(
Kb
+
nrows
)
*
Zc
*
sizeof
(
short
));
memset
(
channel_output_fixed
,
0
,(
Kb
+
nrows
)
*
Zc
*
sizeof
(
short
));
for
(
i
=
2
*
Zc
;
i
<
(
Kb
+
nrows
)
*
Zc
;
i
++
)
{
#ifdef DEBUG_CODER
if
((
i
&
0xf
)
==
0
)
printf
(
"
\n
e %d..%d: "
,
i
,
i
+
15
);
...
...
@@ -257,27 +284,20 @@ channel_output_fixed[i] = (short) ((channel_output[i]*128)<0?(channel_output[i]*
//printf("%lf %d\n",channel_output[i], channel_output_fixed[i]);
//printf("v[%d]=%lf\n",i,modulated_input[i]);
}
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
//{
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
//printf("%lf %d\n",channel_output[i], channel_output_fixed[i]);
//printf("v[%d]=%lf\n",i,modulated_input[i]);}
#ifdef DEBUG_CODER
printf
(
"
\n
"
);
exit
(
-
1
);
#endif
/*
esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, rate);
//for (i=
0
;i<(Kb+nrows) * Zc;i++)
//for (i=
(Kb+nrows) * Zc-5
;i<(Kb+nrows) * Zc;i++)
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]);
// replace this with ldpc decoder
/*
ret = dlsch_decoding(PHY_vars_UE,
channel_output,
&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_ue[0][0],
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid],
frame,
subframe,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid,
num_pdcch_symbols,1);
*/
for (i=0;i<(Kb+nrows) * Zc;i++) {
if (esimated_output[i] != channel_input[i]) {
...
...
@@ -286,6 +306,12 @@ esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, r
}
}
*/
free
(
c
);
free
(
channel_input
);
free
(
modulated_input
);
free
(
channel_output
);
free
(
channel_output_fixed
);
}
//printf("%d\n",*errors);
...
...
@@ -294,23 +320,23 @@ esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, r
}
//#define NTRIALS 10000
#define NTRIALS 30
0
#define NTRIALS 30
int
main
(
int
argc
,
char
*
argv
[])
{
unsigned
int
errors
,
crc_misses
;
unsigned
int
block_length
=
1280
;
unsigned
int
block_length
=
22
*
384
;
short
No_iteration
=
25
;
double
rate
=
0
.
2
;
double
SNR
,
SNR_lin
;
unsigned
char
qbits
;
time_stats_t
time
;
//
time_stats_t time;
int
i
=
0
;
opp_enabled
=
1
;
cpu_freq_GHz
=
get_cpu_freq_GHz
();
//
opp_enabled=1;
//
cpu_freq_GHz = get_cpu_freq_GHz();
randominit
(
0
);
//logInit();
...
...
@@ -324,7 +350,7 @@ int main(int argc, char *argv[])
unsigned
int
decoded_errors
[
100
];
// initiate the size of matrix equivalent to
// size of SNR
for
(
SNR
=-
3
.
5
;
SNR
<-
2
.
5
;
SNR
+=
.
1
)
{
for
(
SNR
=-
2
.
1
;
SNR
<-
2
;
SNR
+=
.
1
)
{
SNR_lin
=
pow
(
10
,
SNR
/
10
);
...
...
@@ -341,7 +367,7 @@ int main(int argc, char *argv[])
&iterations);
*/
start_meas
(
&
time
);
//
start_meas(&time);
decoded_errors
[
i
]
=
test_ldpc
(
No_iteration
,
rate
,
SNR_lin
,
// noise standard deviation
...
...
@@ -350,9 +376,9 @@ int main(int argc, char *argv[])
NTRIALS
,
&
errors
,
&
crc_misses
);
stop_meas
(
&
time
);
//
stop_meas(&time);
print_meas_now
(
&
time
,
""
,
stdout
);
//
print_meas_now(&time, "", stdout);
printf
(
"SNR %f, BLER %f (%d/%d)
\n
"
,
SNR
,(
float
)
decoded_errors
[
i
]
/
(
float
)
NTRIALS
,
decoded_errors
[
i
],
NTRIALS
);
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/TESTBENCH/ldpctest.c~
View file @
f0e7c3da
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment