ldpc check based on crc
This commit is contained in:
@@ -2728,41 +2728,25 @@ static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, int8_t* bnProcBuf, int8_t*
|
||||
*/
|
||||
static inline void nrLDPC_llr2bit(int8_t* out, int8_t* llrOut, uint16_t numLLR)
|
||||
{
|
||||
__m256i* p_llrOut = (__m256i*) llrOut;
|
||||
__m256i* p_out = (__m256i*) out;
|
||||
int8_t* p_llrOut8;
|
||||
int8_t* p_out8;
|
||||
uint32_t i;
|
||||
uint32_t M = numLLR>>5;
|
||||
uint32_t Mr = numLLR&31;
|
||||
__m256i* p_llrOut = (__m256i*)llrOut;
|
||||
__m256i* p_out = (__m256i*)out;
|
||||
const int M = numLLR >> 5;
|
||||
const int Mr = numLLR & 31;
|
||||
|
||||
const __m256i* p_zeros = (__m256i*) zeros256_epi8;
|
||||
const __m256i* p_ones = (__m256i*) ones256_epi8;
|
||||
const __m256i* p_zeros = (__m256i*)zeros256_epi8;
|
||||
const __m256i* p_ones = (__m256i*)ones256_epi8;
|
||||
|
||||
for (i=0; i<M; i++)
|
||||
{
|
||||
*p_out++ = simde_mm256_and_si256(*p_ones, simde_mm256_cmpgt_epi8(*p_zeros, *p_llrOut));
|
||||
p_llrOut++;
|
||||
}
|
||||
for (int i = 0; i < M; i++) {
|
||||
*p_out++ = simde_mm256_and_si256(*p_ones, simde_mm256_cmpgt_epi8(*p_zeros, *p_llrOut));
|
||||
p_llrOut++;
|
||||
}
|
||||
|
||||
if (Mr > 0)
|
||||
{
|
||||
// Remaining LLRs that do not fit in multiples of 32 bytes
|
||||
p_llrOut8 = (int8_t*) p_llrOut;
|
||||
p_out8 = (int8_t*) p_out;
|
||||
// Remaining LLRs that do not fit in multiples of 32 bytes
|
||||
int8_t* p_llrOut8 = (int8_t*)p_llrOut;
|
||||
int8_t* p_out8 = (int8_t*)p_out;
|
||||
|
||||
for (i=0; i<Mr; i++)
|
||||
{
|
||||
if (p_llrOut8[i] < 0)
|
||||
{
|
||||
p_out8[i] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_out8[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < Mr; i++)
|
||||
p_out8[i] = p_llrOut8[i] < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2778,44 +2762,29 @@ static inline void nrLDPC_llr2bitPacked(int8_t* out, int8_t* llrOut, uint16_t nu
|
||||
{
|
||||
/** Vector of indices for shuffling input */
|
||||
const uint8_t constShuffle_256_epi8[32] __attribute__ ((aligned(32))) = {7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
|
||||
const __m256i* p_shuffle = (__m256i*)constShuffle_256_epi8;
|
||||
|
||||
__m256i* p_llrOut = (__m256i*) llrOut;
|
||||
uint32_t* p_bits = (uint32_t*) out;
|
||||
__m256i inPerm;
|
||||
int8_t* p_llrOut8;
|
||||
uint32_t bitsTmp = 0;
|
||||
uint32_t i;
|
||||
uint32_t M = numLLR>>5;
|
||||
uint32_t Mr = numLLR&31;
|
||||
const __m256i* p_shuffle = (__m256i*) constShuffle_256_epi8;
|
||||
const uint32_t M = numLLR >> 5;
|
||||
const uint32_t Mr = numLLR & 31;
|
||||
|
||||
for (i=0; i<M; i++)
|
||||
{
|
||||
// Move LSB to MSB on 8 bits
|
||||
inPerm = simde_mm256_shuffle_epi8(*p_llrOut,*p_shuffle);
|
||||
// Hard decision
|
||||
*p_bits++ = simde_mm256_movemask_epi8(inPerm);
|
||||
p_llrOut++;
|
||||
for (uint32_t i = 0; i < M; i++) {
|
||||
// Move LSB to MSB on 8 bits
|
||||
const __m256i inPerm = simde_mm256_shuffle_epi8(*p_llrOut, *p_shuffle);
|
||||
// Hard decision
|
||||
*p_bits++ = simde_mm256_movemask_epi8(inPerm);
|
||||
p_llrOut++;
|
||||
}
|
||||
|
||||
if (Mr > 0)
|
||||
{
|
||||
// Remaining LLRs that do not fit in multiples of 32 bytes
|
||||
p_llrOut8 = (int8_t*) p_llrOut;
|
||||
|
||||
for (i=0; i<Mr; i++)
|
||||
{
|
||||
if (p_llrOut8[i] < 0)
|
||||
{
|
||||
bitsTmp |= (1<<((7-i) + (16*(i/8))));
|
||||
}
|
||||
else
|
||||
{
|
||||
bitsTmp |= (0<<((7-i) + (16*(i/8))));
|
||||
}
|
||||
}
|
||||
// Remaining LLRs that do not fit in multiples of 32 bytes
|
||||
if (Mr) {
|
||||
const int8_t* p_llrOut8 = (int8_t*)p_llrOut;
|
||||
uint32_t bitsTmp = 0;
|
||||
for (uint32_t i = 0; i < Mr; i++)
|
||||
bitsTmp |= (p_llrOut8[i] < 0) << ((7 - i) + (16 * (i / 8)));
|
||||
*p_bits = bitsTmp;
|
||||
}
|
||||
*p_bits = bitsTmp;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -107,13 +107,9 @@
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define NR_LDPC_ENABLE_PARITY_CHECK
|
||||
//#define NR_LDPC_PROFILER_DETAIL
|
||||
//#define NR_LDPC_ENABLE_PARITY_CHECK
|
||||
//#define NR_LDPC_PROFILER_DETAIL(a) a
|
||||
#define NR_LDPC_PROFILER_DETAIL(a)
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
#include "nrLDPC_tools/nrLDPC_debug.h"
|
||||
@@ -134,18 +130,19 @@ int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams,
|
||||
t_nrLDPC_time_stats* p_profiler,
|
||||
decode_abort_t* ab)
|
||||
{
|
||||
uint32_t numLLR;
|
||||
uint32_t numIter = 0;
|
||||
t_nrLDPC_lut lut;
|
||||
t_nrLDPC_lut* p_lut = &lut;
|
||||
uint32_t numLLR;
|
||||
t_nrLDPC_lut lut;
|
||||
t_nrLDPC_lut* p_lut = &lut;
|
||||
|
||||
// Initialize decoder core(s) with correct LUTs
|
||||
numLLR = nrLDPC_init(p_decParams, p_lut);
|
||||
// Initialize decoder core(s) with correct LUTs
|
||||
numLLR = nrLDPC_init(p_decParams, p_lut);
|
||||
|
||||
// Launch LDPC decoder core for one segment
|
||||
numIter = nrLDPC_decoder_core(p_llr, p_out, numLLR, p_lut, p_decParams, p_profiler, ab);
|
||||
if (numIter > p_decParams->numMaxIter)
|
||||
set_abort(ab, true);
|
||||
// Launch LDPC decoder core for one segment
|
||||
int numIter = nrLDPC_decoder_core(p_llr, p_out, numLLR, p_lut, p_decParams, p_profiler, ab);
|
||||
if (numIter > p_decParams->numMaxIter) {
|
||||
LOG_D(PHY, "set abort: %d, %d\n", numIter, p_decParams->numMaxIter);
|
||||
set_abort(ab, true);
|
||||
}
|
||||
return numIter;
|
||||
}
|
||||
|
||||
@@ -179,48 +176,26 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
int8_t bnProcBuf[NR_LDPC_SIZE_BN_PROC_BUF] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t bnProcBufRes[NR_LDPC_SIZE_BN_PROC_BUF] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t llrRes[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0};
|
||||
// Minimum number of iterations is 1
|
||||
// 0 iterations means hard-decision on input LLRs
|
||||
uint32_t i = 1;
|
||||
// Initialize with parity check fail != 0
|
||||
int32_t pcRes = 1;
|
||||
int8_t* p_llrOut;
|
||||
|
||||
if (outMode == nrLDPC_outMode_LLRINT8)
|
||||
{
|
||||
p_llrOut = p_out;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use LLR processing buffer as temporary output buffer
|
||||
p_llrOut = llrOut;
|
||||
}
|
||||
|
||||
|
||||
// Initialization
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->llr2llrProcBuf);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->llr2llrProcBuf));
|
||||
nrLDPC_llr2llrProcBuf(p_lut, p_llr, llrProcBuf, Z, BG);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->llr2llrProcBuf);
|
||||
#endif
|
||||
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->llr2llrProcBuf));
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_PROC);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_PROC, llrProcBuf);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->llr2CnProcBuf);
|
||||
#endif
|
||||
if (BG == 1) nrLDPC_llr2CnProcBuf_BG1(p_lut, p_llr, cnProcBuf, Z);
|
||||
else nrLDPC_llr2CnProcBuf_BG2(p_lut, p_llr, cnProcBuf, Z);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->llr2CnProcBuf);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->llr2CnProcBuf));
|
||||
if (BG == 1)
|
||||
nrLDPC_llr2CnProcBuf_BG1(p_lut, p_llr, cnProcBuf, Z);
|
||||
else
|
||||
nrLDPC_llr2CnProcBuf_BG2(p_lut, p_llr, cnProcBuf, Z);
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->llr2CnProcBuf));
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC);
|
||||
@@ -230,12 +205,10 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
// First iteration
|
||||
|
||||
// CN processing
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProc);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->cnProc));
|
||||
if (BG==1) {
|
||||
#ifndef UNROLL_CN_PROC
|
||||
nrLDPC_cnProc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
#ifndef UNROLL_CN_PROC
|
||||
nrLDPC_cnProc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
#else
|
||||
switch (R)
|
||||
{
|
||||
@@ -307,23 +280,19 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProc);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->cnProc));
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC_RES);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, cnProcBufRes);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cn2bnProcBuf);
|
||||
#endif
|
||||
if (BG == 1) nrLDPC_cn2bnProcBuf_BG1(p_lut, cnProcBufRes, bnProcBuf, Z);
|
||||
else nrLDPC_cn2bnProcBuf_BG2(p_lut, cnProcBufRes, bnProcBuf, Z);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cn2bnProcBuf);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->cn2bnProcBuf));
|
||||
if (BG == 1)
|
||||
nrLDPC_cn2bnProcBuf_BG1(p_lut, cnProcBufRes, bnProcBuf, Z);
|
||||
else
|
||||
nrLDPC_cn2bnProcBuf_BG2(p_lut, cnProcBufRes, bnProcBuf, Z);
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->cn2bnProcBuf));
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC);
|
||||
@@ -331,10 +300,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
#endif
|
||||
|
||||
// BN processing
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->bnProcPc);
|
||||
#endif
|
||||
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->bnProcPc));
|
||||
|
||||
#ifndef UNROLL_BN_PROC_PC
|
||||
nrLDPC_bnProcPc(p_lut, bnProcBuf, bnProcBufRes, llrProcBuf, llrRes, Z);
|
||||
@@ -379,18 +345,14 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->bnProcPc);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->bnProcPc));
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_RES);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, llrRes);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->bnProc);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->bnProc));
|
||||
|
||||
if (BG==1) {
|
||||
#ifndef UNROLL_BN_PROC
|
||||
@@ -491,13 +453,16 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
// estimated after only one iteration
|
||||
|
||||
// First iteration finished
|
||||
|
||||
while ( (i < numMaxIter) && (pcRes != 0) ) {
|
||||
// Increase iteration counter
|
||||
i++;
|
||||
if (check_abort(ab))
|
||||
return numMaxIter + 2;
|
||||
// CN processing
|
||||
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;
|
||||
}
|
||||
// CN processing
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProc);
|
||||
#endif
|
||||
@@ -593,9 +558,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
#endif
|
||||
|
||||
// BN Processing
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->bnProcPc);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->bnProcPc));
|
||||
|
||||
#ifndef UNROLL_BN_PROC_PC
|
||||
nrLDPC_bnProcPc(p_lut, bnProcBuf, bnProcBufRes, llrProcBuf, llrRes, Z);
|
||||
@@ -639,17 +602,13 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->bnProcPc);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->bnProcPc));
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, llrRes);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->bnProc);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->bnProc));
|
||||
#ifndef UNROLL_BN_PROC
|
||||
nrLDPC_bnProc(p_lut, bnProcBuf, bnProcBufRes, llrRes, Z);
|
||||
#else
|
||||
@@ -717,25 +676,19 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->bnProc);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->bnProc));
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, bnProcBufRes);
|
||||
#endif
|
||||
|
||||
// BN results to CN processing buffer
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->bn2cnProcBuf);
|
||||
#endif
|
||||
if (BG == 1) nrLDPC_bn2cnProcBuf_BG1(p_lut, bnProcBufRes, cnProcBuf, Z);
|
||||
else nrLDPC_bn2cnProcBuf_BG2(p_lut, bnProcBufRes, cnProcBuf, Z);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->bn2cnProcBuf);
|
||||
#endif
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->bn2cnProcBuf));
|
||||
if (BG == 1)
|
||||
nrLDPC_bn2cnProcBuf_BG1(p_lut, bnProcBufRes, cnProcBuf, Z);
|
||||
else
|
||||
nrLDPC_bn2cnProcBuf_BG2(p_lut, bnProcBufRes, cnProcBuf, Z);
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->bn2cnProcBuf));
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, cnProcBuf);
|
||||
@@ -743,40 +696,46 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
|
||||
|
||||
// Parity Check
|
||||
#ifdef NR_LDPC_ENABLE_PARITY_CHECK
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcPc);
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->cnProcPc));
|
||||
if (BG == 1)
|
||||
pcRes = nrLDPC_cnProcPc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
else
|
||||
pcRes = nrLDPC_cnProcPc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->cnProcPc));
|
||||
#else
|
||||
if (numIter > 2) {
|
||||
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);
|
||||
if (outMode == nrLDPC_outMode_BIT)
|
||||
nrLDPC_llr2bitPacked(p_out, p_llrOut, numLLR);
|
||||
else // if (outMode == nrLDPC_outMode_BITINT8)
|
||||
nrLDPC_llr2bit(p_out, p_llrOut, numLLR);
|
||||
if (check_crc((uint8_t*)p_out, p_decParams->block_length, p_decParams->crc_type)) {
|
||||
LOG_D(PHY, "Segment CRC OK, exiting LDPC decoder\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (BG == 1) pcRes = nrLDPC_cnProcPc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
else pcRes = nrLDPC_cnProcPc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcPc);
|
||||
}
|
||||
#ifdef NR_LDPC_ENABLE_PARITY_CHECK
|
||||
{
|
||||
int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0};
|
||||
int8_t* p_llrOut = outMode == nrLDPC_outMode_LLRINT8 ? p_out : llrOut;
|
||||
// Assign results from processing buffer to output
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->llrRes2llrOut));
|
||||
nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG);
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->llrRes2llrOut));
|
||||
// Hard-decision
|
||||
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->llr2bit));
|
||||
if (outMode == nrLDPC_outMode_BIT)
|
||||
nrLDPC_llr2bitPacked(p_out, p_llrOut, numLLR);
|
||||
else // if (outMode == nrLDPC_outMode_BITINT8)
|
||||
nrLDPC_llr2bit(p_out, p_llrOut, numLLR);
|
||||
NR_LDPC_PROFILER_DETAIL(stop_meas(&p_profiler->llr2bit));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
} // end while
|
||||
|
||||
// Last iteration
|
||||
if (pcRes != 0) i++;
|
||||
// Assign results from processing buffer to output
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->llrRes2llrOut);
|
||||
#endif
|
||||
nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->llrRes2llrOut);
|
||||
#endif
|
||||
|
||||
// Hard-decision
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->llr2bit);
|
||||
#endif
|
||||
if (outMode == nrLDPC_outMode_BIT) nrLDPC_llr2bitPacked(p_out, p_llrOut, numLLR);
|
||||
else //if (outMode == nrLDPC_outMode_BITINT8)
|
||||
nrLDPC_llr2bit(p_out, p_llrOut, numLLR);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->llr2bit);
|
||||
#endif
|
||||
|
||||
return i;
|
||||
return numIter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*!\file nrLDPC_init_mem.h
|
||||
* \brief Defines the function to initialize the LDPC decoder and sets correct LUTs.
|
||||
* \author Sebastian Wagner (TCL Communications) Email: <mailto:sebastian.wagner@tcl.com>
|
||||
* \date 07-12-2018
|
||||
* \version 1.0
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef __NR_LDPC_INIT_MEM__H__
|
||||
#define __NR_LDPC_INIT_MEM__H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "nrLDPC_types.h"
|
||||
|
||||
/**
|
||||
\brief Allocates 32 byte aligned memory and initializes to zero
|
||||
\param size Input size in bytes
|
||||
\return Pointer to memory
|
||||
*/
|
||||
static inline void* malloc32_clear(size_t size)
|
||||
{
|
||||
void* ptr = (void*) memalign(64, size+64);
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Allocates and initializes the internal decoder processing buffers
|
||||
\param p_decParams Pointer to decoder parameters
|
||||
\param p_lut Pointer to decoder LUTs
|
||||
\return Number of LLR values
|
||||
*/
|
||||
static inline t_nrLDPC_procBuf* nrLDPC_init_mem(void)
|
||||
{
|
||||
t_nrLDPC_procBuf* p_procBuf = (t_nrLDPC_procBuf*) malloc32_clear(sizeof(t_nrLDPC_procBuf));
|
||||
|
||||
if (p_procBuf)
|
||||
{
|
||||
p_procBuf->cnProcBuf = (int8_t*) malloc32_clear(NR_LDPC_SIZE_CN_PROC_BUF*sizeof(int8_t));
|
||||
p_procBuf->cnProcBufRes = (int8_t*) malloc32_clear(NR_LDPC_SIZE_CN_PROC_BUF*sizeof(int8_t));
|
||||
p_procBuf->bnProcBuf = (int8_t*) malloc32_clear(NR_LDPC_SIZE_BN_PROC_BUF*sizeof(int8_t));
|
||||
p_procBuf->bnProcBufRes = (int8_t*) malloc32_clear(NR_LDPC_SIZE_BN_PROC_BUF*sizeof(int8_t));
|
||||
p_procBuf->llrRes = (int8_t*) malloc32_clear(NR_LDPC_MAX_NUM_LLR *sizeof(int8_t));
|
||||
p_procBuf->llrProcBuf = (int8_t*) malloc32_clear(NR_LDPC_MAX_NUM_LLR *sizeof(int8_t));
|
||||
}
|
||||
|
||||
return(p_procBuf);
|
||||
}
|
||||
|
||||
static inline void nrLDPC_free_mem(t_nrLDPC_procBuf* p_procBuf)
|
||||
{
|
||||
free(p_procBuf->cnProcBuf);
|
||||
free(p_procBuf->cnProcBufRes);
|
||||
free(p_procBuf->bnProcBuf);
|
||||
free(p_procBuf->bnProcBufRes);
|
||||
free(p_procBuf->llrRes);
|
||||
free(p_procBuf->llrProcBuf);
|
||||
|
||||
free(p_procBuf);
|
||||
}
|
||||
#endif
|
||||
@@ -88,6 +88,7 @@ typedef struct nrLDPC_dec_params {
|
||||
uint8_t numMaxIter; /**< Maximum number of iterations */
|
||||
int block_length;
|
||||
e_nrLDPC_outMode outMode; /**< Output format */
|
||||
int crc_type;
|
||||
} t_nrLDPC_dec_params;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user