Merge remote-tracking branch 'origin/nrLDPC_coding_improvements_3' into integration_2025_w08 (!3227)
fix(nrLDPC_coding): timers in DL encoding, fix(ldpctest): Confusion in sizes Main improvements: 1. fix(ldpctest): Confusion in sizes IMPORTANT: This fix makes that ldpctest now works with BG2 and K' != K! (Worth double checking with more cases than I did check with though) The variable block_length had an ambiguous role and was used as both K and Kprime. This was leading to arrays with wrong sizes and functions with wrong arguments. Now there is not anymore block_length but K and Kprime. Kprime can be set with the command line argument -l. There was also some problems with array allocation for segments with length not divisible by 8. A proper sizing with ((size_in_bits + 7) & ~7) / 8 was used. A proper masking of the last byte containing payload bits was also added to keep filler bits to 0 after random initialization. 2. fix(nrLDPC_coding): timers in DL encoding While timers were available for rate matching and interleaving in the new interface, these timers were not merged to rate matching and interleaving timers in nr_dlsch_coding.
This commit is contained in:
@@ -25,7 +25,10 @@
|
|||||||
<htmlTabRef>test-ldpc-gpu</htmlTabRef>
|
<htmlTabRef>test-ldpc-gpu</htmlTabRef>
|
||||||
<htmlTabName>Test-ldpc-GPU</htmlTabName>
|
<htmlTabName>Test-ldpc-GPU</htmlTabName>
|
||||||
<htmlTabIcon>tasks</htmlTabIcon>
|
<htmlTabIcon>tasks</htmlTabIcon>
|
||||||
<TestCaseRequestedList>000002 000003 000004 000005 000006 000007 000008 000009 000010 000011 000012 000013 000014 000015 000016 000017 000018 000019 000020 000021</TestCaseRequestedList>
|
<TestCaseRequestedList>
|
||||||
|
000002 000003 000004 000005 000006 000007 000008 000009 000010 000011 000012 000013 000014 000015 000016 000017 000018 000019 000020 000021
|
||||||
|
000022 000023 000024 000025 000026 000027 000028 000029 000030 000031 000032 000033 000034 000035 000036 000037 000038 000039 000040 000041
|
||||||
|
</TestCaseRequestedList>
|
||||||
<TestCaseExclusionList></TestCaseExclusionList>
|
<TestCaseExclusionList></TestCaseExclusionList>
|
||||||
|
|
||||||
<testCase id="000002">
|
<testCase id="000002">
|
||||||
@@ -188,6 +191,166 @@
|
|||||||
<physim_run_args>-l 8448 -s10 -n100 -G 1</physim_run_args>
|
<physim_run_args>-l 8448 -s10 -n100 -G 1</physim_run_args>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000022">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 1 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000023">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 1 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000024">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 100 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000025">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 100 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000026">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 193 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000027">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 193 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000028">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 500 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000029">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 500 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000030">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 561 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000031">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 561 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000032">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 600 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000033">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 600 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000034">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 641 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000035">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 641 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000036">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 2000 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000037">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 2000 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000038">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 3000 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000039">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 3000 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000040">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with CPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 3840 -s10 -n100</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="000041">
|
||||||
|
<class>Run_Physim</class>
|
||||||
|
<desc>Run LDPC Test with GPU</desc>
|
||||||
|
<always_exec>true</always_exec>
|
||||||
|
<physim_test>ldpctest</physim_test>
|
||||||
|
<physim_run_args>-l 3840 -s10 -n100 -G 1</physim_run_args>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</testCaseList>
|
</testCaseList>
|
||||||
|
|||||||
@@ -66,16 +66,26 @@
|
|||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
<testCase id="ldpctest">
|
<testCase id="ldpctest">
|
||||||
<desc>ldpc Test cases. (Test1: block length = 3872),
|
<desc>ldpc Test cases. (Test1: block length = 3872, BG1),
|
||||||
(Test2: block length = 4224),
|
(Test2: block length = 4224, BG1),
|
||||||
(Test3: block length = 4576),
|
(Test3: block length = 4576, BG1),
|
||||||
(Test4: block length = 4928),
|
(Test4: block length = 4928, BG1),
|
||||||
(Test5: block length = 5280),
|
(Test5: block length = 5280, BG1),
|
||||||
(Test6: block length = 5632),
|
(Test6: block length = 5632, BG1),
|
||||||
(Test7: block length = 6336),
|
(Test7: block length = 6336, BG1),
|
||||||
(Test8: block length = 7040),
|
(Test8: block length = 7040, BG1),
|
||||||
(Test9: block length = 7744),
|
(Test9: block length = 7744, BG1),
|
||||||
(Test10: block length = 8448)</desc>
|
(Test10: block length = 8448, BG1),
|
||||||
|
(Test11: block length = 1, BG2),
|
||||||
|
(Test12: block length = 100, BG2),
|
||||||
|
(Test13: block length = 193, BG2),
|
||||||
|
(Test14: block length = 500, BG2),
|
||||||
|
(Test15: block length = 561, BG2),
|
||||||
|
(Test16: block length = 600, BG2),
|
||||||
|
(Test17: block length = 641, BG2),
|
||||||
|
(Test18: block length = 2000, BG2),
|
||||||
|
(Test19: block length = 3000, BG2),
|
||||||
|
(Test20: block length = 3840, BG2)</desc>
|
||||||
<main_exec>ldpctest</main_exec>
|
<main_exec>ldpctest</main_exec>
|
||||||
<main_exec_args>-l3872 -s10 -n100
|
<main_exec_args>-l3872 -s10 -n100
|
||||||
-l4224 -s10 -n100
|
-l4224 -s10 -n100
|
||||||
@@ -87,9 +97,17 @@
|
|||||||
-l7040 -s10 -n100
|
-l7040 -s10 -n100
|
||||||
-l7744 -s10 -n100
|
-l7744 -s10 -n100
|
||||||
-l8448 -s10 -n100
|
-l8448 -s10 -n100
|
||||||
-l561 -s10 -n1
|
-l1 -s10 -n100
|
||||||
-l500 -s10 -n1</main_exec_args>
|
-l100 -s10 -n100
|
||||||
<tags>test1 test2 test3 test4 test5 test6 test7 test8 test9 test10</tags>
|
-l193 -s10 -n100
|
||||||
|
-l500 -s10 -n100
|
||||||
|
-l561 -s10 -n100
|
||||||
|
-l600 -s10 -n100
|
||||||
|
-l641 -s10 -n100
|
||||||
|
-l2000 -s10 -n100
|
||||||
|
-l3000 -s10 -n100
|
||||||
|
-l3840 -s10 -n100</main_exec_args>
|
||||||
|
<tags>test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 test20</tags>
|
||||||
<search_expr_true>BLER 0.000000</search_expr_true>
|
<search_expr_true>BLER 0.000000</search_expr_true>
|
||||||
<search_expr_false>segmentation fault|assertion|exiting|fatal|differ</search_expr_false>
|
<search_expr_false>segmentation fault|assertion|exiting|fatal|differ</search_expr_false>
|
||||||
<nruns>3</nruns>
|
<nruns>3</nruns>
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
int denom_rate,
|
int denom_rate,
|
||||||
double SNR,
|
double SNR,
|
||||||
unsigned char qbits,
|
unsigned char qbits,
|
||||||
short block_length,
|
short Kprime,
|
||||||
unsigned int ntrials,
|
unsigned int ntrials,
|
||||||
int n_segments)
|
int n_segments)
|
||||||
{
|
{
|
||||||
@@ -119,9 +119,8 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
double sigma;
|
double sigma;
|
||||||
sigma = 1.0 / sqrt(2 * SNR);
|
sigma = 1.0 / sqrt(2 * SNR);
|
||||||
cpu_meas_enabled = 1;
|
cpu_meas_enabled = 1;
|
||||||
//short test_input[block_length];
|
|
||||||
uint8_t *test_input[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER * NR_MAX_NB_LAYERS];
|
uint8_t *test_input[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER * NR_MAX_NB_LAYERS];
|
||||||
uint8_t estimated_output[MAX_NUM_DLSCH_SEGMENTS][block_length];
|
uint8_t estimated_output[MAX_NUM_DLSCH_SEGMENTS][Kprime];
|
||||||
memset(estimated_output, 0, sizeof(estimated_output));
|
memset(estimated_output, 0, sizeof(estimated_output));
|
||||||
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS];
|
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS];
|
||||||
uint8_t *channel_input_optim[MAX_NUM_DLSCH_SEGMENTS];
|
uint8_t *channel_input_optim[MAX_NUM_DLSCH_SEGMENTS];
|
||||||
@@ -141,16 +140,6 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
|
|
||||||
int32_t n_iter = 0;
|
int32_t n_iter = 0;
|
||||||
|
|
||||||
// generate input block
|
|
||||||
for(int j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
|
|
||||||
test_input[j] = malloc16(block_length / 8);
|
|
||||||
memset(test_input[j], 0, block_length / 8);
|
|
||||||
channel_input[j] = malloc16(68 * 384);
|
|
||||||
memset(channel_input[j], 0, 68 * 384);
|
|
||||||
channel_input_optim[j] = malloc16(68 * 384);
|
|
||||||
memset(channel_input_optim[j], 0, 68 * 384);
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_meas(&time);
|
reset_meas(&time);
|
||||||
reset_meas(&tinput);
|
reset_meas(&tinput);
|
||||||
reset_meas(&tprep);
|
reset_meas(&tprep);
|
||||||
@@ -169,13 +158,8 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
reset_meas(&decoder_profiler.llr2bit);
|
reset_meas(&decoder_profiler.llr2bit);
|
||||||
// reset_meas(&decoder_profiler.total);
|
// reset_meas(&decoder_profiler.total);
|
||||||
|
|
||||||
// Fill a input packet with random values
|
|
||||||
for (int j = 0; j < MAX_NUM_DLSCH_SEGMENTS; j++)
|
|
||||||
for (int i = 0; i < block_length / 8; i++)
|
|
||||||
test_input[j][i] = (uint8_t)rand();
|
|
||||||
|
|
||||||
// determine number of bits in codeword
|
// determine number of bits in codeword
|
||||||
if (block_length > 3840) {
|
if (Kprime > 3840) {
|
||||||
BG = 1;
|
BG = 1;
|
||||||
Kb = 22;
|
Kb = 22;
|
||||||
nrows = 46; // parity check bits
|
nrows = 46; // parity check bits
|
||||||
@@ -184,11 +168,11 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
BG = 2;
|
BG = 2;
|
||||||
nrows = 42; // parity check bits
|
nrows = 42; // parity check bits
|
||||||
// ncols=10; // info bits
|
// ncols=10; // info bits
|
||||||
if (block_length > 640)
|
if (Kprime > 640)
|
||||||
Kb = 10;
|
Kb = 10;
|
||||||
else if (block_length > 560)
|
else if (Kprime > 560)
|
||||||
Kb = 9;
|
Kb = 9;
|
||||||
else if (block_length > 192)
|
else if (Kprime > 192)
|
||||||
Kb = 8;
|
Kb = 8;
|
||||||
else
|
else
|
||||||
Kb = 6;
|
Kb = 6;
|
||||||
@@ -240,18 +224,34 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
22, 24, 26, 28, 30, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 88,
|
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};
|
96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240, 256, 288, 320, 352, 384};
|
||||||
for (i1 = 0; i1 < 51; i1++) {
|
for (i1 = 0; i1 < 51; i1++) {
|
||||||
if (lift_size[i1] >= (double)block_length / Kb) {
|
if (lift_size[i1] >= (double)Kprime / Kb) {
|
||||||
Zc = lift_size[i1];
|
Zc = lift_size[i1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("ldpc_test: codeword_length %d, n_segments %d, block_length %d, BG %d, Zc %d, Kb %d\n",n_segments *block_length, n_segments, block_length, BG, Zc, Kb);
|
// K: Segment size = number of columns in the parity check matrix * lifting size (number of columns of the square parity check
|
||||||
const int no_punctured_columns =
|
// sub-matrix)
|
||||||
(int)((nrows - 2) * Zc + block_length - block_length * (1 / ((float)nom_rate / (float)denom_rate))) / Zc;
|
int K = 0;
|
||||||
|
if (BG == 1) {
|
||||||
|
K = 22 * Zc;
|
||||||
|
} else if (BG == 2) {
|
||||||
|
K = 10 * Zc;
|
||||||
|
} else {
|
||||||
|
printf("Not supported: BG: %d\n", BG);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("ldpc_test: codeword_length %d, n_segments %d, Kprime %d, BG %d, Zc %d, Kb %d\n",
|
||||||
|
n_segments * K,
|
||||||
|
n_segments,
|
||||||
|
Kprime,
|
||||||
|
BG,
|
||||||
|
Zc,
|
||||||
|
Kb);
|
||||||
|
const int no_punctured_columns = (int)((nrows - 2) * Zc + K - K * (1 / ((float)nom_rate / (float)denom_rate))) / Zc;
|
||||||
// printf("puncture:%d\n",no_punctured_columns);
|
// printf("puncture:%d\n",no_punctured_columns);
|
||||||
const int removed_bit =
|
const int removed_bit = (nrows - no_punctured_columns - 2) * Zc + K - (int)(K / ((float)nom_rate / (float)denom_rate));
|
||||||
(nrows - no_punctured_columns - 2) * Zc + block_length - (int)(block_length / ((float)nom_rate / (float)denom_rate));
|
|
||||||
|
|
||||||
printf("nrows: %d\n", nrows);
|
printf("nrows: %d\n", nrows);
|
||||||
printf("no_punctured_columns: %d\n", no_punctured_columns);
|
printf("no_punctured_columns: %d\n", no_punctured_columns);
|
||||||
@@ -259,7 +259,29 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
printf("To: %d\n", (Kb + nrows - no_punctured_columns) * Zc - removed_bit);
|
printf("To: %d\n", (Kb + nrows - no_punctured_columns) * Zc - removed_bit);
|
||||||
printf("number of undecoded bits: %d\n", (Kb + nrows - no_punctured_columns - 2) * Zc - removed_bit);
|
printf("number of undecoded bits: %d\n", (Kb + nrows - no_punctured_columns - 2) * Zc - removed_bit);
|
||||||
|
|
||||||
encoder_implemparams_t impp = {.Zc = Zc, .Kb = Kb, .BG = BG, .K = block_length};
|
// generate input block
|
||||||
|
for (int j = 0; j < MAX_NUM_DLSCH_SEGMENTS; j++) {
|
||||||
|
test_input[j] = malloc16(((K + 7) & ~7) / 8);
|
||||||
|
memset(test_input[j], 0, ((K + 7) & ~7) / 8);
|
||||||
|
channel_input[j] = malloc16(68 * 384);
|
||||||
|
memset(channel_input[j], 0, 68 * 384);
|
||||||
|
channel_input_optim[j] = malloc16(68 * 384);
|
||||||
|
memset(channel_input_optim[j], 0, 68 * 384);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill input segments with random values
|
||||||
|
for (int j = 0; j < MAX_NUM_DLSCH_SEGMENTS; j++) {
|
||||||
|
int i = 0;
|
||||||
|
for (i = 0; i < ((Kprime + 7) & ~7) / 8; i++)
|
||||||
|
test_input[j][i] = (uint8_t)rand();
|
||||||
|
// Mask the last byte in order to keep filler bits to 0
|
||||||
|
if (Kprime % 8 != 0) {
|
||||||
|
uint8_t last_byte_mask = (1 << (Kprime % 8)) - 1;
|
||||||
|
test_input[j][i - 1] = test_input[j][i - 1] & last_byte_mask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
encoder_implemparams_t impp = {.Zc = Zc, .Kb = Kb, .BG = BG, .K = K};
|
||||||
impp.gen_code = 2;
|
impp.gen_code = 2;
|
||||||
|
|
||||||
if (ntrials == 0)
|
if (ntrials == 0)
|
||||||
@@ -286,11 +308,12 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
|
|
||||||
if (ntrials == 1)
|
if (ntrials == 1)
|
||||||
for (int j = 0; j < n_segments; j++)
|
for (int j = 0; j < n_segments; j++)
|
||||||
for (int i = 0; i < block_length + (nrows - no_punctured_columns) * Zc - removed_bit; i++)
|
for (int i = 0; i < K + (nrows - no_punctured_columns) * Zc - removed_bit; i++) {
|
||||||
if (channel_input[j][i] != channel_input_optim[j][i]) {
|
if (channel_input[j][i] != channel_input_optim[j][i]) {
|
||||||
printf("differ in seg %d pos %d (%u,%u)\n", j, i, channel_input[j][i], channel_input_optim[j][i]);
|
printf("differ in seg %d pos %d (%u,%u)\n", j, i, channel_input[j][i], channel_input_optim[j][i]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < n_segments; j++) {
|
for (int j = 0; j < n_segments; j++) {
|
||||||
for (int i = 2 * Zc; i < (Kb + nrows - no_punctured_columns) * Zc - removed_bit; i++) {
|
for (int i = 2 * Zc; i < (Kb + nrows - no_punctured_columns) * Zc - removed_bit; i++) {
|
||||||
@@ -323,7 +346,7 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
decParams[j].R = code_rate_vec[R_ind]; // 13;
|
decParams[j].R = code_rate_vec[R_ind]; // 13;
|
||||||
decParams[j].numMaxIter = max_iterations;
|
decParams[j].numMaxIter = max_iterations;
|
||||||
decParams[j].outMode = nrLDPC_outMode_BIT;
|
decParams[j].outMode = nrLDPC_outMode_BIT;
|
||||||
decParams[j].Kprime = block_length;
|
decParams[j].Kprime = Kprime;
|
||||||
ldpc_toCompare.LDPCinit();
|
ldpc_toCompare.LDPCinit();
|
||||||
}
|
}
|
||||||
for (int j = 0; j < n_segments; j++) {
|
for (int j = 0; j < n_segments; j++) {
|
||||||
@@ -339,11 +362,12 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
&decoder_profiler,
|
&decoder_profiler,
|
||||||
&dec_abort);
|
&dec_abort);
|
||||||
stop_meas(&ret.time_decoder);
|
stop_meas(&ret.time_decoder);
|
||||||
|
|
||||||
// count errors
|
// count errors
|
||||||
if (memcmp(estimated_output[j], test_input[j], block_length / 8) != 0) {
|
if (memcmp(estimated_output[j], test_input[j], ((Kprime + 7) & ~7) / 8) != 0) {
|
||||||
segment_bler++;
|
segment_bler++;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < block_length; i++) {
|
for (int i = 0; i < Kprime; i++) {
|
||||||
unsigned char estoutputbit = (estimated_output[j][i / 8] & (1 << (i & 7))) >> (i & 7);
|
unsigned char estoutputbit = (estimated_output[j][i / 8] & (1 << (i & 7))) >> (i & 7);
|
||||||
unsigned char inputbit = (test_input[j][i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
|
unsigned char inputbit = (test_input[j][i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
|
||||||
if (estoutputbit != inputbit)
|
if (estoutputbit != inputbit)
|
||||||
@@ -401,7 +425,7 @@ one_measurement_t test_ldpc(short max_iterations,
|
|||||||
configmodule_interface_t *uniqCfg = NULL;
|
configmodule_interface_t *uniqCfg = NULL;
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
short block_length=8448; // decoder supports length: 1201 -> 1280, 2401 -> 2560
|
short Kprime = 8448;
|
||||||
// default to check output inside ldpc, the NR version checks the outer CRC defined by 3GPP
|
// default to check output inside ldpc, the NR version checks the outer CRC defined by 3GPP
|
||||||
char *ldpc_version = "";
|
char *ldpc_version = "";
|
||||||
/* version of the ldpc decoder library to use (XXX suffix to use when loading libldpc_XXX.so */
|
/* version of the ldpc decoder library to use (XXX suffix to use when loading libldpc_XXX.so */
|
||||||
@@ -431,7 +455,6 @@ int main(int argc, char *argv[])
|
|||||||
logInit();
|
logInit();
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "--:O:q:r:s:S:l:G:n:d:i:t:u:hv:")) != -1) {
|
while ((c = getopt(argc, argv, "--:O:q:r:s:S:l:G:n:d:i:t:u:hv:")) != -1) {
|
||||||
|
|
||||||
/* ignore long options starting with '--', option '-O' and their arguments that are handled by configmodule */
|
/* ignore long options starting with '--', option '-O' and their arguments that are handled by configmodule */
|
||||||
/* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */
|
/* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */
|
||||||
if (c == 1 || c == '-' || c == 'O')
|
if (c == 1 || c == '-' || c == 'O')
|
||||||
@@ -452,7 +475,7 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
block_length = atoi(optarg);
|
Kprime = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'G':
|
case 'G':
|
||||||
@@ -488,13 +511,13 @@ int main(int argc, char *argv[])
|
|||||||
case 'h':
|
case 'h':
|
||||||
default:
|
default:
|
||||||
printf("CURRENTLY SUPPORTED CODE RATES: \n");
|
printf("CURRENTLY SUPPORTED CODE RATES: \n");
|
||||||
printf("BG1 (blocklength > 3840): 1/3, 2/3, 22/25 (8/9) \n");
|
printf("BG1 (K' > 3840): 1/3, 2/3, 22/25 (8/9) \n");
|
||||||
printf("BG2 (blocklength <= 3840): 1/5, 1/3, 2/3 \n\n");
|
printf("BG2 (K' <= 3840): 1/5, 1/3, 2/3 \n\n");
|
||||||
printf("-h This message\n");
|
printf("-h This message\n");
|
||||||
printf("-q Quantization bits, Default: 8\n");
|
printf("-q Quantization bits, Default: 8\n");
|
||||||
printf("-r Nominator rate, (1, 2, 22), Default: 1\n");
|
printf("-r Nominator rate, (1, 2, 22), Default: 1\n");
|
||||||
printf("-d Denominator rate, (3, 5, 25), Default: 1\n");
|
printf("-d Denominator rate, (3, 5, 25), Default: 1\n");
|
||||||
printf("-l Block length (l > 3840 -> BG1, rest BG2 ), Default: 8448\n");
|
printf("-l Length of payload bits in a segment (K' in 38.212-5.2.2), [1, 8448], Default: 8448\n");
|
||||||
printf("-G give 1 to run cuda for LDPC, Default: 0\n");
|
printf("-G give 1 to run cuda for LDPC, Default: 0\n");
|
||||||
printf("-n Number of simulation trials, Default: 1\n");
|
printf("-n Number of simulation trials, Default: 1\n");
|
||||||
// printf("-M MCS2 for TB 2\n");
|
// printf("-M MCS2 for TB 2\n");
|
||||||
@@ -503,30 +526,29 @@ int main(int argc, char *argv[])
|
|||||||
printf("-t SNR simulation step, Default: 0.1\n");
|
printf("-t SNR simulation step, Default: 0.1\n");
|
||||||
printf("-i Max decoder iterations, Default: 5\n");
|
printf("-i Max decoder iterations, Default: 5\n");
|
||||||
printf("-u Set SNR per coded bit, Default: 0\n");
|
printf("-u Set SNR per coded bit, Default: 0\n");
|
||||||
printf("-v XXX Set ldpc shared library version. libldpc_XXX.so will be used \n");
|
printf("-v _XXX Set ldpc shared library version. libldpc_XXX.so will be used \n");
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("the decoder supports BG2, Kb=10, Z=128 & 256\n");
|
printf("block length %d: \n", Kprime);
|
||||||
//printf(" range of blocklength: 1201 -> 1280, 2401 -> 2560\n");
|
|
||||||
printf("block length %d: \n", block_length);
|
|
||||||
printf("n_trials %d: \n", n_trials);
|
printf("n_trials %d: \n", n_trials);
|
||||||
printf("SNR0 %f: \n", SNR0);
|
printf("SNR0 %f: \n", SNR0);
|
||||||
|
|
||||||
load_LDPClib(ldpc_version, &ldpc_toCompare);
|
load_LDPClib(ldpc_version, &ldpc_toCompare);
|
||||||
load_LDPClib("_orig", &ldpc_orig);
|
load_LDPClib("_orig", &ldpc_orig);
|
||||||
//for (block_length=8;block_length<=MAX_BLOCK_LENGTH;block_length+=8)
|
|
||||||
|
|
||||||
// find minimum value in all sets of lifting size
|
// find minimum value in all sets of lifting size
|
||||||
Zc = 0;
|
Zc = 0;
|
||||||
|
|
||||||
char fname[200];
|
char fname[200];
|
||||||
sprintf(fname,"ldpctest_BG_%d_Zc_%d_rate_%d-%d_block_length_%d_maxit_%d.txt",BG,Zc,nom_rate,denom_rate,block_length, max_iterations);
|
sprintf(fname, "ldpctest_BG_%d_Zc_%d_rate_%d-%d_Kprime_%d_maxit_%d.txt", BG, Zc, nom_rate, denom_rate, Kprime, max_iterations);
|
||||||
FILE *fd = fopen(fname, "w");
|
FILE *fd = fopen(fname, "w");
|
||||||
AssertFatal(fd != NULL, "cannot open %s\n", fname);
|
AssertFatal(fd != NULL, "cannot open %s\n", fname);
|
||||||
|
|
||||||
fprintf(fd,"SNR BLER BER UNCODED_BER ENCODER_MEAN ENCODER_STD ENCODER_MAX DECODER_TIME_MEAN DECODER_TIME_STD DECODER_TIME_MAX DECODER_ITER_MEAN DECODER_ITER_STD DECODER_ITER_MAX\n");
|
fprintf(fd,
|
||||||
|
"SNR BLER BER UNCODED_BER ENCODER_MEAN ENCODER_STD ENCODER_MAX DECODER_TIME_MEAN DECODER_TIME_STD DECODER_TIME_MAX "
|
||||||
|
"DECODER_ITER_MEAN DECODER_ITER_STD DECODER_ITER_MAX\n");
|
||||||
|
|
||||||
for (double SNR = SNR0; SNR < SNR0 + 20.0; SNR += SNR_step) {
|
for (double SNR = SNR0; SNR < SNR0 + 20.0; SNR += SNR_step) {
|
||||||
double SNR_lin;
|
double SNR_lin;
|
||||||
@@ -540,13 +562,14 @@ int main(int argc, char *argv[])
|
|||||||
denom_rate,
|
denom_rate,
|
||||||
SNR_lin, // noise standard deviation
|
SNR_lin, // noise standard deviation
|
||||||
qbits,
|
qbits,
|
||||||
block_length, // block length bytes
|
Kprime, // block length bytes
|
||||||
n_trials,
|
n_trials,
|
||||||
n_segments);
|
n_segments);
|
||||||
|
|
||||||
decoded_errors[i] = res.errors;
|
decoded_errors[i] = res.errors;
|
||||||
dec_iter[i] = res.dec_iter;
|
dec_iter[i] = res.dec_iter;
|
||||||
dec_iter[i].snr = SNR;
|
dec_iter[i].snr = SNR;
|
||||||
dec_iter[i].ber = (float)res.errors_bit / (float)n_trials / (float)block_length / (double)n_segments;
|
dec_iter[i].ber = (float)res.errors_bit / (float)n_trials / (float)Kprime / (double)n_segments;
|
||||||
dec_iter[i].bler = (float)decoded_errors[i] / (float)n_trials;
|
dec_iter[i].bler = (float)decoded_errors[i] / (float)n_trials;
|
||||||
printf("SNR %f, BLER %f (%u/%d)\n", SNR, dec_iter[i].bler, decoded_errors[i], n_trials);
|
printf("SNR %f, BLER %f (%u/%d)\n", SNR, dec_iter[i].bler, decoded_errors[i], n_trials);
|
||||||
printf("SNR %f, BER %f (%u/%d)\n", SNR, dec_iter[i].ber, decoded_errors[i], n_trials);
|
printf("SNR %f, BER %f (%u/%d)\n", SNR, dec_iter[i].ber, decoded_errors[i], n_trials);
|
||||||
@@ -559,28 +582,37 @@ int main(int argc, char *argv[])
|
|||||||
printf("SNR %f, Std iterations: %f\n", SNR, dec_iter[i].n_iter_std);
|
printf("SNR %f, Std iterations: %f\n", SNR, dec_iter[i].n_iter_std);
|
||||||
printf("SNR %f, Max iterations: %d\n", SNR, dec_iter[i].n_iter_max);
|
printf("SNR %f, Max iterations: %d\n", SNR, dec_iter[i].n_iter_max);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Encoding time mean: %15.3f us\n",(double)res.time_optim.diff/res.time_optim.trials/1000.0/get_cpu_freq_GHz());
|
|
||||||
printf("Encoding time std: %15.3f us\n",sqrt((double)res.time_optim.diff_square/res.time_optim.trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)res.time_optim.diff/res.time_optim.trials/1000.0/get_cpu_freq_GHz(),2)));
|
double cpu_freq = get_cpu_freq_GHz();
|
||||||
printf("Encoding time max: %15.3f us\n",(double)res.time_optim.max/1000.0/get_cpu_freq_GHz());
|
time_stats_t *t_optim = &res.time_optim;
|
||||||
|
printf("Encoding time mean: %15.3f us\n", (double)t_optim->diff / t_optim->trials / 1000.0 / cpu_freq);
|
||||||
|
printf("Encoding time std: %15.3f us\n",
|
||||||
|
sqrt((double)t_optim->diff_square / t_optim->trials / pow(1000, 2) / pow(cpu_freq, 2)
|
||||||
|
- pow((double)t_optim->diff / t_optim->trials / 1000.0 / cpu_freq, 2)));
|
||||||
|
printf("Encoding time max: %15.3f us\n", (double)t_optim->max / 1000.0 / cpu_freq);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Decoding time mean: %15.3f us\n",(double)res.time_decoder.diff/res.time_decoder.trials/1000.0/get_cpu_freq_GHz());
|
|
||||||
printf("Decoding time std: %15.3f us\n",sqrt((double)res.time_decoder.diff_square/res.time_decoder.trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)res.time_decoder.diff/res.time_decoder.trials/1000.0/get_cpu_freq_GHz(),2)));
|
time_stats_t *t_decoder = &res.time_decoder;
|
||||||
printf("Decoding time max: %15.3f us\n",(double)res.time_decoder.max/1000.0/get_cpu_freq_GHz());
|
printf("Decoding time mean: %15.3f us\n", (double)t_decoder->diff / t_decoder->trials / 1000.0 / cpu_freq);
|
||||||
|
printf("Decoding time std: %15.3f us\n",
|
||||||
|
sqrt((double)t_decoder->diff_square / t_decoder->trials / pow(1000, 2) / pow(cpu_freq, 2)
|
||||||
|
- pow((double)t_decoder->diff / t_decoder->trials / 1000.0 / cpu_freq, 2)));
|
||||||
|
printf("Decoding time max: %15.3f us\n", (double)t_decoder->max / 1000.0 / cpu_freq);
|
||||||
|
|
||||||
fprintf(fd,
|
fprintf(fd,
|
||||||
"%f %f %f %f %f %f %f %f %f %f %f %f %d \n",
|
"%f %f %f %f %f %f %f %f %f %f %f %f %d \n",
|
||||||
SNR,
|
SNR,
|
||||||
(double)decoded_errors[i] / (double)n_trials,
|
(double)decoded_errors[i] / (double)n_trials,
|
||||||
(double)res.errors_bit / (double)n_trials / (double)block_length / (double)n_segments,
|
(double)res.errors_bit / (double)n_trials / (double)Kprime / (double)n_segments,
|
||||||
res.errors_bit_uncoded / (double)n_trials / (double)n_segments,
|
res.errors_bit_uncoded / (double)n_trials / (double)n_segments,
|
||||||
(double)res.time_optim.diff / res.time_optim.trials / 1000.0 / get_cpu_freq_GHz(),
|
(double)t_optim->diff / t_optim->trials / 1000.0 / cpu_freq,
|
||||||
sqrt((double)res.time_optim.diff_square / res.time_optim.trials / pow(1000, 2) / pow(get_cpu_freq_GHz(), 2)
|
sqrt((double)t_optim->diff_square / t_optim->trials / pow(1000, 2) / pow(cpu_freq, 2)
|
||||||
- pow((double)res.time_optim.diff / res.time_optim.trials / 1000.0 / get_cpu_freq_GHz(), 2)),
|
- pow((double)t_optim->diff / t_optim->trials / 1000.0 / cpu_freq, 2)),
|
||||||
(double)res.time_optim.max / 1000.0 / get_cpu_freq_GHz(),
|
(double)t_optim->max / 1000.0 / cpu_freq,
|
||||||
(double)res.time_decoder.diff / res.time_decoder.trials / 1000.0 / get_cpu_freq_GHz(),
|
(double)t_decoder->diff / t_decoder->trials / 1000.0 / cpu_freq,
|
||||||
sqrt((double)res.time_decoder.diff_square / res.time_decoder.trials / pow(1000, 2) / pow(get_cpu_freq_GHz(), 2)
|
sqrt((double)t_decoder->diff_square / t_decoder->trials / pow(1000, 2) / pow(cpu_freq, 2)
|
||||||
- pow((double)res.time_decoder.diff / res.time_decoder.trials / 1000.0 / get_cpu_freq_GHz(), 2)),
|
- pow((double)t_decoder->diff / t_decoder->trials / 1000.0 / cpu_freq, 2)),
|
||||||
(double)res.time_decoder.max / 1000.0 / get_cpu_freq_GHz(),
|
(double)t_decoder->max / 1000.0 / cpu_freq,
|
||||||
dec_iter[i].n_iter_mean,
|
dec_iter[i].n_iter_mean,
|
||||||
dec_iter[i].n_iter_std,
|
dec_iter[i].n_iter_std,
|
||||||
dec_iter[i].n_iter_max);
|
dec_iter[i].n_iter_max);
|
||||||
|
|||||||
+2
-2
@@ -49,7 +49,7 @@ typedef struct ldpc8blocks_args_s {
|
|||||||
encoder_implemparams_t impp;
|
encoder_implemparams_t impp;
|
||||||
} ldpc8blocks_args_t;
|
} ldpc8blocks_args_t;
|
||||||
|
|
||||||
static void ldpc8blocks_coding_segment(void *p)
|
static void ldpc8blocks(void *p)
|
||||||
{
|
{
|
||||||
ldpc8blocks_args_t *args = (ldpc8blocks_args_t *)p;
|
ldpc8blocks_args_t *args = (ldpc8blocks_args_t *)p;
|
||||||
nrLDPC_TB_encoding_parameters_t *nrLDPC_TB_encoding_parameters = args->nrLDPC_TB_encoding_parameters;
|
nrLDPC_TB_encoding_parameters_t *nrLDPC_TB_encoding_parameters = args->nrLDPC_TB_encoding_parameters;
|
||||||
@@ -192,7 +192,7 @@ static int nrLDPC_prepare_TB_encoding(nrLDPC_slot_encoding_parameters_t *nrLDPC_
|
|||||||
perJobImpp->impp = impp;
|
perJobImpp->impp = impp;
|
||||||
perJobImpp->nrLDPC_TB_encoding_parameters = nrLDPC_TB_encoding_parameters;
|
perJobImpp->nrLDPC_TB_encoding_parameters = nrLDPC_TB_encoding_parameters;
|
||||||
|
|
||||||
task_t t = {.func = ldpc8blocks_coding_segment, .args = perJobImpp};
|
task_t t = {.func = ldpc8blocks, .args = perJobImpp};
|
||||||
pushTpool(nrLDPC_slot_encoding_parameters->threadPool, t);
|
pushTpool(nrLDPC_slot_encoding_parameters->threadPool, t);
|
||||||
}
|
}
|
||||||
return n_seg;
|
return n_seg;
|
||||||
|
|||||||
@@ -120,13 +120,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
time_stats_t *dlsch_interleaving_stats,
|
time_stats_t *dlsch_interleaving_stats,
|
||||||
time_stats_t *dlsch_segmentation_stats)
|
time_stats_t *dlsch_segmentation_stats)
|
||||||
{
|
{
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
nrLDPC_TB_encoding_parameters_t TBs[msgTx->num_pdsch_slot];
|
nrLDPC_TB_encoding_parameters_t TBs[msgTx->num_pdsch_slot];
|
||||||
memset(TBs, 0, sizeof(TBs));
|
memset(TBs, 0, sizeof(TBs));
|
||||||
nrLDPC_slot_encoding_parameters_t slot_parameters = {
|
nrLDPC_slot_encoding_parameters_t slot_parameters = {.frame = frame,
|
||||||
.frame = frame,
|
|
||||||
.slot = slot,
|
.slot = slot,
|
||||||
.nb_TBs = msgTx->num_pdsch_slot,
|
.nb_TBs = msgTx->num_pdsch_slot,
|
||||||
.threadPool = &gNB->threadPool,
|
.threadPool = &gNB->threadPool,
|
||||||
@@ -134,13 +132,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
.tprep = tprep,
|
.tprep = tprep,
|
||||||
.tparity = tparity,
|
.tparity = tparity,
|
||||||
.toutput = toutput,
|
.toutput = toutput,
|
||||||
.TBs = TBs
|
.TBs = TBs};
|
||||||
};
|
|
||||||
|
|
||||||
int num_segments = 0;
|
int num_segments = 0;
|
||||||
|
|
||||||
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) {
|
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) {
|
||||||
|
|
||||||
NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[dlsch_id];
|
NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[dlsch_id];
|
||||||
|
|
||||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||||
@@ -187,11 +183,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
// printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
|
// printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
|
||||||
B = A + 24;
|
B = A + 24;
|
||||||
// harq->b = a;
|
// harq->b = a;
|
||||||
AssertFatal((A / 8) + 4 <= max_bytes,
|
AssertFatal((A / 8) + 4 <= max_bytes, "A %d is too big (A/8+4 = %d > %d)\n", A, (A / 8) + 4, max_bytes);
|
||||||
"A %d is too big (A/8+4 = %d > %d)\n",
|
|
||||||
A,
|
|
||||||
(A / 8) + 4,
|
|
||||||
max_bytes);
|
|
||||||
memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes?
|
memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes?
|
||||||
} else {
|
} else {
|
||||||
// Add 16-bit crc (polynomial A) to payload
|
// Add 16-bit crc (polynomial A) to payload
|
||||||
@@ -202,11 +194,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
// printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
|
// printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
|
||||||
B = A + 16;
|
B = A + 16;
|
||||||
// harq->b = a;
|
// harq->b = a;
|
||||||
AssertFatal((A / 8) + 3 <= max_bytes,
|
AssertFatal((A / 8) + 3 <= max_bytes, "A %d is too big (A/8+3 = %d > %d)\n", A, (A / 8) + 3, max_bytes);
|
||||||
"A %d is too big (A/8+3 = %d > %d)\n",
|
|
||||||
A,
|
|
||||||
(A / 8) + 3,
|
|
||||||
max_bytes);
|
|
||||||
memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc
|
memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +221,6 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
num_segments += TB_parameters->C;
|
num_segments += TB_parameters->C;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nrLDPC_segment_encoding_parameters_t segments[num_segments];
|
nrLDPC_segment_encoding_parameters_t segments[num_segments];
|
||||||
@@ -284,18 +271,13 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
for (int r = 0; r < TB_parameters->C; r++) {
|
for (int r = 0; r < TB_parameters->C; r++) {
|
||||||
nrLDPC_segment_encoding_parameters_t *segment_parameters = &TB_parameters->segments[r];
|
nrLDPC_segment_encoding_parameters_t *segment_parameters = &TB_parameters->segments[r];
|
||||||
segment_parameters->c = harq->c[r];
|
segment_parameters->c = harq->c[r];
|
||||||
segment_parameters->E = nr_get_E(TB_parameters->G,
|
segment_parameters->E = nr_get_E(TB_parameters->G, TB_parameters->C, TB_parameters->Qm, rel15->nrOfLayers, r);
|
||||||
TB_parameters->C,
|
|
||||||
TB_parameters->Qm,
|
|
||||||
rel15->nrOfLayers,
|
|
||||||
r);
|
|
||||||
segment_parameters->output = &output[dlsch_offset + r_offset];
|
segment_parameters->output = &output[dlsch_offset + r_offset];
|
||||||
r_offset += segment_parameters->E;
|
r_offset += segment_parameters->E;
|
||||||
|
|
||||||
reset_meas(&segment_parameters->ts_interleave);
|
reset_meas(&segment_parameters->ts_interleave);
|
||||||
reset_meas(&segment_parameters->ts_rate_match);
|
reset_meas(&segment_parameters->ts_rate_match);
|
||||||
reset_meas(&segment_parameters->ts_ldpc_encode);
|
reset_meas(&segment_parameters->ts_ldpc_encode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
segments_offset += TB_parameters->C;
|
segments_offset += TB_parameters->C;
|
||||||
@@ -309,6 +291,16 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
|
|
||||||
gNB->nrLDPC_coding_interface.nrLDPC_coding_encoder(&slot_parameters);
|
gNB->nrLDPC_coding_interface.nrLDPC_coding_encoder(&slot_parameters);
|
||||||
|
|
||||||
|
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) {
|
||||||
|
nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[dlsch_id];
|
||||||
|
for (int r = 0; r < TB_parameters->C; r++) {
|
||||||
|
nrLDPC_segment_encoding_parameters_t *segment_parameters = &TB_parameters->segments[r];
|
||||||
|
merge_meas(dlsch_interleaving_stats, &segment_parameters->ts_interleave);
|
||||||
|
merge_meas(dlsch_rate_matching_stats, &segment_parameters->ts_rate_match);
|
||||||
|
// merge_meas(, &segment_parameters->ts_ldpc_encode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
* \brief Top-level routines for decoding LDPC (ULSCH) transport channels from 38.212, V15.4.0 2018-12
|
* \brief Top-level routines for decoding LDPC (ULSCH) transport channels from 38.212, V15.4.0 2018-12
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// [from gNB coding]
|
// [from gNB coding]
|
||||||
#include "PHY/defs_gNB.h"
|
#include "PHY/defs_gNB.h"
|
||||||
#include "PHY/CODING/coding_extern.h"
|
#include "PHY/CODING/coding_extern.h"
|
||||||
@@ -56,7 +55,6 @@
|
|||||||
|
|
||||||
void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch, uint16_t N_RB_UL)
|
void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch, uint16_t N_RB_UL)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER * NR_MAX_NB_LAYERS; // number of segments to be allocated
|
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER * NR_MAX_NB_LAYERS; // number of segments to be allocated
|
||||||
|
|
||||||
if (N_RB_UL != 273) {
|
if (N_RB_UL != 273) {
|
||||||
@@ -83,7 +81,6 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch, uint16_t N_RB_UL)
|
|||||||
|
|
||||||
NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
|
NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER * NR_MAX_NB_LAYERS; // number of segments to be allocated
|
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER * NR_MAX_NB_LAYERS; // number of segments to be allocated
|
||||||
|
|
||||||
if (N_RB_UL != 273) {
|
if (N_RB_UL != 273) {
|
||||||
@@ -121,18 +118,15 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
uint8_t *ULSCH_ids,
|
uint8_t *ULSCH_ids,
|
||||||
int nb_pusch)
|
int nb_pusch)
|
||||||
{
|
{
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING, 1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING, 1);
|
||||||
|
|
||||||
nrLDPC_TB_decoding_parameters_t TBs[nb_pusch];
|
nrLDPC_TB_decoding_parameters_t TBs[nb_pusch];
|
||||||
memset(TBs, 0, sizeof(TBs));
|
memset(TBs, 0, sizeof(TBs));
|
||||||
nrLDPC_slot_decoding_parameters_t slot_parameters = {
|
nrLDPC_slot_decoding_parameters_t slot_parameters = {.frame = frame,
|
||||||
.frame = frame,
|
|
||||||
.slot = nr_tti_rx,
|
.slot = nr_tti_rx,
|
||||||
.nb_TBs = nb_pusch,
|
.nb_TBs = nb_pusch,
|
||||||
.threadPool = &phy_vars_gNB->threadPool,
|
.threadPool = &phy_vars_gNB->threadPool,
|
||||||
.TBs = TBs
|
.TBs = TBs};
|
||||||
};
|
|
||||||
|
|
||||||
int max_num_segments = 0;
|
int max_num_segments = 0;
|
||||||
|
|
||||||
@@ -230,13 +224,8 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
#ifdef DEBUG_ULSCH_DECODING
|
#ifdef DEBUG_ULSCH_DECODING
|
||||||
printf("ulsch decoding nr segmentation Z %d\n", TB_parameters->Z);
|
printf("ulsch decoding nr segmentation Z %d\n", TB_parameters->Z);
|
||||||
if (!frame % 100)
|
if (!frame % 100)
|
||||||
printf("K %d C %d Z %d \n",
|
printf("K %d C %d Z %d \n", TB_parameters->K, TB_parameters->C, TB_parameters->Z);
|
||||||
TB_parameters->K,
|
printf("Segmentation: C %d, K %d\n", TB_parameters->C, TB_parameters->K);
|
||||||
TB_parameters->C,
|
|
||||||
TB_parameters->Z);
|
|
||||||
printf("Segmentation: C %d, K %d\n",
|
|
||||||
TB_parameters->C,
|
|
||||||
TB_parameters->K);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TB_parameters->max_ldpc_iterations = ulsch->max_ldpc_iterations;
|
TB_parameters->max_ldpc_iterations = ulsch->max_ldpc_iterations;
|
||||||
@@ -244,7 +233,6 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
TB_parameters->tbslbrm = pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes;
|
TB_parameters->tbslbrm = pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes;
|
||||||
TB_parameters->abort_decode = &harq_process->abort_decode;
|
TB_parameters->abort_decode = &harq_process->abort_decode;
|
||||||
set_abort(&harq_process->abort_decode, false);
|
set_abort(&harq_process->abort_decode, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nrLDPC_segment_decoding_parameters_t segments[nb_pusch][max_num_segments];
|
nrLDPC_segment_decoding_parameters_t segments[nb_pusch][max_num_segments];
|
||||||
@@ -267,11 +255,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
uint32_t r_offset = 0;
|
uint32_t r_offset = 0;
|
||||||
for (int r = 0; r < TB_parameters->C; r++) {
|
for (int r = 0; r < TB_parameters->C; r++) {
|
||||||
nrLDPC_segment_decoding_parameters_t *segment_parameters = &TB_parameters->segments[r];
|
nrLDPC_segment_decoding_parameters_t *segment_parameters = &TB_parameters->segments[r];
|
||||||
segment_parameters->E = nr_get_E(TB_parameters->G,
|
segment_parameters->E = nr_get_E(TB_parameters->G, TB_parameters->C, TB_parameters->Qm, TB_parameters->nb_layers, r);
|
||||||
TB_parameters->C,
|
|
||||||
TB_parameters->Qm,
|
|
||||||
TB_parameters->nb_layers,
|
|
||||||
r);
|
|
||||||
segment_parameters->R = nr_get_R_ldpc_decoder(TB_parameters->rv_index,
|
segment_parameters->R = nr_get_R_ldpc_decoder(TB_parameters->rv_index,
|
||||||
segment_parameters->E,
|
segment_parameters->E,
|
||||||
TB_parameters->BG,
|
TB_parameters->BG,
|
||||||
@@ -296,7 +280,6 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
}
|
}
|
||||||
harq_process->harq_to_be_cleared = false;
|
harq_process->harq_to_be_cleared = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret_decoder = phy_vars_gNB->nrLDPC_coding_interface.nrLDPC_coding_decoder(&slot_parameters);
|
int ret_decoder = phy_vars_gNB->nrLDPC_coding_interface.nrLDPC_coding_decoder(&slot_parameters);
|
||||||
@@ -314,7 +297,9 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
nrLDPC_segment_decoding_parameters_t nrLDPC_segment_decoding_parameters = TB_parameters.segments[r];
|
nrLDPC_segment_decoding_parameters_t nrLDPC_segment_decoding_parameters = TB_parameters.segments[r];
|
||||||
// Copy c to b in case of decoding success
|
// Copy c to b in case of decoding success
|
||||||
if (nrLDPC_segment_decoding_parameters.decodeSuccess) {
|
if (nrLDPC_segment_decoding_parameters.decodeSuccess) {
|
||||||
memcpy(harq_process->b + offset, harq_process->c[r], (harq_process->K >> 3) - (harq_process->F >> 3) - ((harq_process->C > 1) ? 3 : 0));
|
memcpy(harq_process->b + offset,
|
||||||
|
harq_process->c[r],
|
||||||
|
(harq_process->K >> 3) - (harq_process->F >> 3) - ((harq_process->C > 1) ? 3 : 0));
|
||||||
} else {
|
} else {
|
||||||
LOG_D(PHY, "uplink segment error %d/%d\n", r, harq_process->C);
|
LOG_D(PHY, "uplink segment error %d/%d\n", r, harq_process->C);
|
||||||
LOG_D(PHY, "ULSCH %d in error\n", ULSCH_id);
|
LOG_D(PHY, "ULSCH %d in error\n", ULSCH_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user