Commit b6bedf12 authored by Romain Beurdouche's avatar Romain Beurdouche

fix(nrLDPC_decoder): fix numIter increment

The logs of `./nr_ulsim -n100 -m19 -s12 -S12 -z2 -L4` were showing that sometimes the decoding of one segment was failing while the CRC check succeeded.
This was happening because the iteration counter `numIter` was not properly managed so that when the last iteration was successful to decode the segment
still `numIter` at the exit was equal to `numMaxIter` plus 1 so that decoding was considered to have failed.
In other words the last iteration if it occured was always wasted.

This commit offers to solve this problem by simply moving the iteration counter increment at the end of the iteration loop
while remaining careful at fixing the tests relying on this counter.
parent 0515cf98
...@@ -552,8 +552,6 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, ...@@ -552,8 +552,6 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
uint32_t numIter = 1; uint32_t numIter = 1;
int32_t pcRes = 1; // pcRes is 0 if the ldpc decoder is succesful int32_t pcRes = 1; // pcRes is 0 if the ldpc decoder is succesful
while ((numIter <= numMaxIter) && (pcRes != 0)) { while ((numIter <= numMaxIter) && (pcRes != 0)) {
// Increase iteration counter
numIter++;
if (check_abort(ab)) { if (check_abort(ab)) {
numIter = numMaxIter + 2; numIter = numMaxIter + 2;
break; break;
...@@ -847,7 +845,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, ...@@ -847,7 +845,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
pcRes = nrLDPC_cnProcPc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z); pcRes = nrLDPC_cnProcPc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z);
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->cnProcPc)); NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->cnProcPc));
} else { } else {
if (numIter > 2) { if (numIter > 1) {
int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0}; int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0};
int8_t* p_llrOut = outMode == nrLDPC_outMode_LLRINT8 ? p_out : llrOut; int8_t* p_llrOut = outMode == nrLDPC_outMode_LLRINT8 ? p_out : llrOut;
nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG); nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG);
...@@ -861,6 +859,8 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, ...@@ -861,6 +859,8 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
} }
} }
} }
// Increase iteration counter
numIter++;
} }
if (!p_decParams->check_crc) { if (!p_decParams->check_crc) {
int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0}; int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment