From b6bedf1216950d8dcda01503d6530e8a9fe93d87 Mon Sep 17 00:00:00 2001 From: Romain Beurdouche Date: Thu, 6 Mar 2025 13:03:14 +0000 Subject: [PATCH] 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. --- openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c index fcee71c151..742c0311d8 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c @@ -552,8 +552,6 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, uint32_t numIter = 1; int32_t pcRes = 1; // pcRes is 0 if the ldpc decoder is succesful while ((numIter <= numMaxIter) && (pcRes != 0)) { - // Increase iteration counter - numIter++; if (check_abort(ab)) { numIter = numMaxIter + 2; break; @@ -847,7 +845,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, pcRes = nrLDPC_cnProcPc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z); NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->cnProcPc)); } else { - if (numIter > 2) { + if (numIter > 1) { int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0}; int8_t* p_llrOut = outMode == nrLDPC_outMode_LLRINT8 ? p_out : llrOut; nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG); @@ -861,6 +859,8 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, } } } + // Increase iteration counter + numIter++; } if (!p_decParams->check_crc) { int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0};