Commit a85e8a8f authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch '376-make-ldpc-decoder-threadsave' into 'develop-nr'

Resolve "Make LDPC decoder threadsave"

See merge request oai/openairinterface5g!465
parents fb35247c 454c552d
...@@ -157,6 +157,8 @@ int test_ldpc(short No_iteration, ...@@ -157,6 +157,8 @@ int test_ldpc(short No_iteration,
//double code_rate_actual_vec[8] = {0.2, 0.33333, 0.4, 0.5, 0.66667, 0.73333, 0.81481, 0.88}; //double code_rate_actual_vec[8] = {0.2, 0.33333, 0.4, 0.5, 0.66667, 0.73333, 0.81481, 0.88};
t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params decParams;
t_nrLDPC_procBuf nrLDPC_procBuf;
t_nrLDPC_procBuf* p_nrLDPC_procBuf = &nrLDPC_procBuf;
t_nrLDPC_time_stats decoder_profiler; t_nrLDPC_time_stats decoder_profiler;
t_nrLDPC_time_stats* p_decoder_profiler =&decoder_profiler ; t_nrLDPC_time_stats* p_decoder_profiler =&decoder_profiler ;
...@@ -210,6 +212,9 @@ int test_ldpc(short No_iteration, ...@@ -210,6 +212,9 @@ int test_ldpc(short No_iteration,
reset_meas(&decoder_profiler.llr2bit); reset_meas(&decoder_profiler.llr2bit);
//reset_meas(&decoder_profiler.total); //reset_meas(&decoder_profiler.total);
// Allocate LDPC decoder buffers
p_nrLDPC_procBuf = nrLDPC_init_mem();
for (j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) { for (j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
for (i=0; i<block_length/8; i++) { for (i=0; i<block_length/8; i++) {
test_input[j][i]=(unsigned char) rand(); test_input[j][i]=(unsigned char) rand();
...@@ -411,7 +416,7 @@ int test_ldpc(short No_iteration, ...@@ -411,7 +416,7 @@ int test_ldpc(short No_iteration,
// decoder supports BG2, Z=128 & 256 // decoder supports BG2, Z=128 & 256
//esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate)); //esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate));
///nrLDPC_decoder(&decParams, channel_output_fixed, estimated_output, NULL); ///nrLDPC_decoder(&decParams, channel_output_fixed, estimated_output, NULL);
n_iter = nrLDPC_decoder(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], p_decoder_profiler); n_iter = nrLDPC_decoder(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], p_nrLDPC_procBuf, p_decoder_profiler);
stop_meas(time_decoder); stop_meas(time_decoder);
} }
...@@ -489,6 +494,8 @@ int test_ldpc(short No_iteration, ...@@ -489,6 +494,8 @@ int test_ldpc(short No_iteration,
//free(channel_output_fixed); //free(channel_output_fixed);
//free(estimated_output); //free(estimated_output);
nrLDPC_free_mem(p_nrLDPC_procBuf);
print_meas(&time,"ldpc_encoder",NULL,NULL); print_meas(&time,"ldpc_encoder",NULL,NULL);
print_meas(time_optim,"ldpc_encoder_optim",NULL,NULL); print_meas(time_optim,"ldpc_encoder_optim",NULL,NULL);
print_meas(&tinput,"ldpc_encoder_optim(input)",NULL,NULL); print_meas(&tinput,"ldpc_encoder_optim(input)",NULL,NULL);
......
...@@ -37,12 +37,17 @@ ...@@ -37,12 +37,17 @@
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, uint16_t Z) static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
const uint8_t* lut_numBnInBnGroups = p_lut->numBnInBnGroups; const uint8_t* lut_numBnInBnGroups = p_lut->numBnInBnGroups;
const uint32_t* lut_startAddrBnGroups = p_lut->startAddrBnGroups; const uint32_t* lut_startAddrBnGroups = p_lut->startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr = p_lut->startAddrBnGroupsLlr; const uint16_t* lut_startAddrBnGroupsLlr = p_lut->startAddrBnGroupsLlr;
int8_t* bnProcBuf = p_procBuf->bnProcBuf;
int8_t* bnProcBufRes = p_procBuf->bnProcBufRes;
int8_t* llrRes = p_procBuf->llrRes;
int8_t* llrProcBuf = p_procBuf->llrProcBuf;
__m128i* p_bnProcBuf; __m128i* p_bnProcBuf;
__m256i* p_bnProcBufRes; __m256i* p_bnProcBufRes;
__m128i* p_llrProcBuf; __m128i* p_llrProcBuf;
...@@ -1676,7 +1681,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, uint16_t Z) ...@@ -1676,7 +1681,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, uint16_t Z)
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, uint16_t Z) static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
// BN Processing calculating the values to send back to the CNs for next iteration // BN Processing calculating the values to send back to the CNs for next iteration
// bnProcBufRes contains the sum of all edges to each BN at the start of each group // bnProcBufRes contains the sum of all edges to each BN at the start of each group
...@@ -1685,6 +1690,10 @@ static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, uint16_t Z) ...@@ -1685,6 +1690,10 @@ static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, uint16_t Z)
const uint32_t* lut_startAddrBnGroups = p_lut->startAddrBnGroups; const uint32_t* lut_startAddrBnGroups = p_lut->startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr = p_lut->startAddrBnGroupsLlr; const uint16_t* lut_startAddrBnGroupsLlr = p_lut->startAddrBnGroupsLlr;
int8_t* bnProcBuf = p_procBuf->bnProcBuf;
int8_t* bnProcBufRes = p_procBuf->bnProcBufRes;
int8_t* llrRes = p_procBuf->llrRes;
__m256i* p_bnProcBuf; __m256i* p_bnProcBuf;
__m256i* p_bnProcBufRes; __m256i* p_bnProcBufRes;
__m256i* p_llrRes; __m256i* p_llrRes;
......
...@@ -36,11 +36,14 @@ ...@@ -36,11 +36,14 @@
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, uint16_t Z) static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
__m256i* p_cnProcBuf; __m256i* p_cnProcBuf;
__m256i* p_cnProcBufRes; __m256i* p_cnProcBufRes;
...@@ -362,11 +365,14 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, uint16_t Z) ...@@ -362,11 +365,14 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, uint16_t Z)
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, uint16_t Z) static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
__m256i* p_cnProcBuf; __m256i* p_cnProcBuf;
__m256i* p_cnProcBufRes; __m256i* p_cnProcBufRes;
...@@ -858,11 +864,14 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, uint16_t Z) ...@@ -858,11 +864,14 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, uint16_t Z)
\param Z Lifting size \param Z Lifting size
\return 32-bit parity check indicator \return 32-bit parity check indicator
*/ */
static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, uint16_t Z) static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
__m256i* p_cnProcBuf; __m256i* p_cnProcBuf;
__m256i* p_cnProcBufRes; __m256i* p_cnProcBufRes;
...@@ -1490,11 +1499,14 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, uint16_t Z) ...@@ -1490,11 +1499,14 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, uint16_t Z)
\param Z Lifting size \param Z Lifting size
\return 32-bit parity check indicator \return 32-bit parity check indicator
*/ */
static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, uint16_t Z) static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
__m256i* p_cnProcBuf; __m256i* p_cnProcBuf;
__m256i* p_cnProcBufRes; __m256i* p_cnProcBufRes;
......
...@@ -45,20 +45,22 @@ ...@@ -45,20 +45,22 @@
#include "nrLDPC_tools/nrLDPC_debug.h" #include "nrLDPC_tools/nrLDPC_debug.h"
#endif #endif
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler); static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler);
int32_t nrLDPC_decoder(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, t_nrLDPC_time_stats* p_profiler) int32_t nrLDPC_decoder(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, t_nrLDPC_time_stats* p_profiler)
{ {
uint32_t numLLR; uint32_t numLLR;
uint32_t numIter = 0; uint32_t numIter = 0;
t_nrLDPC_lut lut; t_nrLDPC_lut lut;
t_nrLDPC_lut* p_lut = &lut; t_nrLDPC_lut* p_lut = &lut;
printf("p_procBuf->cnProcBuf = %p\n", p_procBuf->cnProcBuf);
// Initialize decoder core(s) with correct LUTs // Initialize decoder core(s) with correct LUTs
numLLR = nrLDPC_init(p_decParams, p_lut); numLLR = nrLDPC_init(p_decParams, p_lut);
// Launch LDPC decoder core for one segment // Launch LDPC decoder core for one segment
numIter = nrLDPC_decoder_core(p_llr, p_out, numLLR, p_lut, p_decParams, p_profiler); numIter = nrLDPC_decoder_core(p_llr, p_out, p_procBuf, numLLR, p_lut, p_decParams, p_profiler);
return numIter; return numIter;
} }
...@@ -72,7 +74,7 @@ int32_t nrLDPC_decoder(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* ...@@ -72,7 +74,7 @@ int32_t nrLDPC_decoder(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t*
\param p_decParams LDPC decoder parameters \param p_decParams LDPC decoder parameters
\param p_profiler LDPC profiler statistics \param p_profiler LDPC profiler statistics
*/ */
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler) static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler)
{ {
uint16_t Z = p_decParams->Z; uint16_t Z = p_decParams->Z;
uint8_t BG = p_decParams->BG; uint8_t BG = p_decParams->BG;
...@@ -93,7 +95,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -93,7 +95,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
else else
{ {
// Use LLR processing buffer as temporary output buffer // Use LLR processing buffer as temporary output buffer
p_llrOut = (int8_t*) llrProcBuf; p_llrOut = p_procBuf->llrProcBuf;
} }
...@@ -101,27 +103,27 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -101,27 +103,27 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->llr2llrProcBuf); start_meas(&p_profiler->llr2llrProcBuf);
#endif #endif
nrLDPC_llr2llrProcBuf(p_lut, p_llr, Z, BG); nrLDPC_llr2llrProcBuf(p_lut, p_llr, p_procBuf, Z, BG);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->llr2llrProcBuf); stop_meas(&p_profiler->llr2llrProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_PROC); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_PROC);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_PROC); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_PROC, p_procBuf);
#endif #endif
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->llr2CnProcBuf); start_meas(&p_profiler->llr2CnProcBuf);
#endif #endif
nrLDPC_llr2CnProcBuf(p_lut, p_llr, numLLR, Z, BG); nrLDPC_llr2CnProcBuf(p_lut, p_llr, p_procBuf, numLLR, Z, BG);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->llr2CnProcBuf); stop_meas(&p_profiler->llr2CnProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, p_procBuf);
#endif #endif
// First iteration // First iteration
...@@ -132,11 +134,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -132,11 +134,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cnProc_BG1(p_lut, Z); nrLDPC_cnProc_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
nrLDPC_cnProc_BG2(p_lut, Z); nrLDPC_cnProc_BG2(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProc); stop_meas(&p_profiler->cnProc);
...@@ -144,7 +146,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -144,7 +146,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC_RES); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC_RES);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, p_procBuf);
#endif #endif
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
...@@ -152,11 +154,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -152,11 +154,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cn2bnProcBuf_BG1(p_lut, Z); nrLDPC_cn2bnProcBuf_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
nrLDPC_cn2bnProcBuf(p_lut, Z); nrLDPC_cn2bnProcBuf(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cn2bnProcBuf); stop_meas(&p_profiler->cn2bnProcBuf);
...@@ -164,34 +166,34 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -164,34 +166,34 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, p_procBuf);
#endif #endif
// BN processing // BN processing
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProcPc); start_meas(&p_profiler->bnProcPc);
#endif #endif
nrLDPC_bnProcPc(p_lut, Z); nrLDPC_bnProcPc(p_lut, p_procBuf, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProcPc); stop_meas(&p_profiler->bnProcPc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_RES); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_RES);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, p_procBuf);
#endif #endif
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProc); start_meas(&p_profiler->bnProc);
#endif #endif
nrLDPC_bnProc(p_lut, Z); nrLDPC_bnProc(p_lut, p_procBuf, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProc); stop_meas(&p_profiler->bnProc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC_RES); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC_RES);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, p_procBuf);
#endif #endif
// BN results to CN processing buffer // BN results to CN processing buffer
...@@ -200,18 +202,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -200,18 +202,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_bn2cnProcBuf_BG1(p_lut, Z); nrLDPC_bn2cnProcBuf_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
nrLDPC_bn2cnProcBuf(p_lut, Z); nrLDPC_bn2cnProcBuf(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bn2cnProcBuf); stop_meas(&p_profiler->bn2cnProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, p_procBuf);
#endif #endif
// Parity Check not necessary here since it will fail // Parity Check not necessary here since it will fail
...@@ -231,18 +233,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -231,18 +233,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cnProc_BG1(p_lut, Z); nrLDPC_cnProc_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
nrLDPC_cnProc_BG2(p_lut, Z); nrLDPC_cnProc_BG2(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProc); stop_meas(&p_profiler->cnProc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, p_procBuf);
#endif #endif
// Send CN results back to BNs // Send CN results back to BNs
...@@ -251,43 +253,43 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -251,43 +253,43 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cn2bnProcBuf_BG1(p_lut, Z); nrLDPC_cn2bnProcBuf_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
nrLDPC_cn2bnProcBuf(p_lut, Z); nrLDPC_cn2bnProcBuf(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cn2bnProcBuf); stop_meas(&p_profiler->cn2bnProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, p_procBuf);
#endif #endif
// BN Processing // BN Processing
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProcPc); start_meas(&p_profiler->bnProcPc);
#endif #endif
nrLDPC_bnProcPc(p_lut, Z); nrLDPC_bnProcPc(p_lut, p_procBuf, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProcPc); stop_meas(&p_profiler->bnProcPc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, p_procBuf);
#endif #endif
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProc); start_meas(&p_profiler->bnProc);
#endif #endif
nrLDPC_bnProc(p_lut, Z); nrLDPC_bnProc(p_lut, p_procBuf, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProc); stop_meas(&p_profiler->bnProc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, p_procBuf);
#endif #endif
// BN results to CN processing buffer // BN results to CN processing buffer
...@@ -296,18 +298,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -296,18 +298,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_bn2cnProcBuf_BG1(p_lut, Z); nrLDPC_bn2cnProcBuf_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
nrLDPC_bn2cnProcBuf(p_lut, Z); nrLDPC_bn2cnProcBuf(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bn2cnProcBuf); stop_meas(&p_profiler->bn2cnProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, p_procBuf);
#endif #endif
// Parity Check // Parity Check
...@@ -317,11 +319,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -317,11 +319,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
pcRes = nrLDPC_cnProcPc_BG1(p_lut, Z); pcRes = nrLDPC_cnProcPc_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
pcRes = nrLDPC_cnProcPc_BG2(p_lut, Z); pcRes = nrLDPC_cnProcPc_BG2(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProcPc); stop_meas(&p_profiler->cnProcPc);
...@@ -342,18 +344,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -342,18 +344,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cnProc_BG1(p_lut, Z); nrLDPC_cnProc_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
nrLDPC_cnProc_BG2(p_lut, Z); nrLDPC_cnProc_BG2(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProc); stop_meas(&p_profiler->cnProc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, p_procBuf);
#endif #endif
// Send CN results back to BNs // Send CN results back to BNs
...@@ -362,31 +364,31 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -362,31 +364,31 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cn2bnProcBuf_BG1(p_lut, Z); nrLDPC_cn2bnProcBuf_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
nrLDPC_cn2bnProcBuf(p_lut, Z); nrLDPC_cn2bnProcBuf(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cn2bnProcBuf); stop_meas(&p_profiler->cn2bnProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, p_procBuf);
#endif #endif
// BN Processing // BN Processing
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProcPc); start_meas(&p_profiler->bnProcPc);
#endif #endif
nrLDPC_bnProcPc(p_lut, Z); nrLDPC_bnProcPc(p_lut, p_procBuf, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProcPc); stop_meas(&p_profiler->bnProcPc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, p_procBuf);
#endif #endif
// If parity check not enabled, no need to send the BN proc results // If parity check not enabled, no need to send the BN proc results
...@@ -395,13 +397,13 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -395,13 +397,13 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProc); start_meas(&p_profiler->bnProc);
#endif #endif
nrLDPC_bnProc(p_lut, Z); nrLDPC_bnProc(p_lut, p_procBuf, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProc); stop_meas(&p_profiler->bnProc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, p_procBuf);
#endif #endif
// BN results to CN processing buffer // BN results to CN processing buffer
...@@ -410,18 +412,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -410,18 +412,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_bn2cnProcBuf_BG1(p_lut, Z); nrLDPC_bn2cnProcBuf_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
nrLDPC_bn2cnProcBuf(p_lut, Z); nrLDPC_bn2cnProcBuf(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bn2cnProcBuf); stop_meas(&p_profiler->bn2cnProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, p_procBuf);
#endif #endif
// Parity Check // Parity Check
...@@ -430,11 +432,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -430,11 +432,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#endif #endif
if (BG == 1) if (BG == 1)
{ {
pcRes = nrLDPC_cnProcPc_BG1(p_lut, Z); pcRes = nrLDPC_cnProcPc_BG1(p_lut, p_procBuf, Z);
} }
else else
{ {
pcRes = nrLDPC_cnProcPc_BG2(p_lut, Z); pcRes = nrLDPC_cnProcPc_BG2(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProcPc); stop_meas(&p_profiler->cnProcPc);
...@@ -454,7 +456,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_ ...@@ -454,7 +456,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->llrRes2llrOut); start_meas(&p_profiler->llrRes2llrOut);
#endif #endif
nrLDPC_llrRes2llrOut(p_lut, p_llrOut, numLLR); nrLDPC_llrRes2llrOut(p_lut, p_llrOut, p_procBuf, numLLR);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->llrRes2llrOut); stop_meas(&p_profiler->llrRes2llrOut);
#endif #endif
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define __NR_LDPC_DECODER__H__ #define __NR_LDPC_DECODER__H__
#include "nrLDPC_types.h" #include "nrLDPC_types.h"
#include "nrLDPC_init_mem.h"
/** /**
\brief LDPC decoder \brief LDPC decoder
...@@ -40,6 +41,6 @@ ...@@ -40,6 +41,6 @@
\param p_llrOut Output vector \param p_llrOut Output vector
\param p_profiler LDPC profiler statistics \param p_profiler LDPC profiler statistics
*/ */
int32_t nrLDPC_decoder(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_llrOut, t_nrLDPC_time_stats* p_profiler); int32_t nrLDPC_decoder(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_llrOut, t_nrLDPC_procBuf* p_procBuf, t_nrLDPC_time_stats* p_profiler);
#endif #endif
...@@ -100,23 +100,7 @@ ...@@ -100,23 +100,7 @@
#define NR_LDPC_MAX_NUM_LLR 26112 #define NR_LDPC_MAX_NUM_LLR 26112
// ============================================================================== // ==============================================================================
// GLOBAL VARIABLES // GLOBAL CONSTANT VARIABLES
// Aligned on 32 bytes = 256 bits for AVX2
/** CN processing buffer */
static int8_t cnProcBuf [NR_LDPC_SIZE_CN_PROC_BUF] __attribute__ ((aligned(32)));
/** Buffer for CN processing results */
static int8_t cnProcBufRes[NR_LDPC_SIZE_CN_PROC_BUF] __attribute__ ((aligned(32)));
/** BN processing buffer */
static int8_t bnProcBuf [NR_LDPC_SIZE_BN_PROC_BUF] __attribute__ ((aligned(32)));
/** Buffer for BN processing results */
static int8_t bnProcBufRes[NR_LDPC_SIZE_BN_PROC_BUF] __attribute__ ((aligned(32)));
/** Buffer for LLR results */
static int8_t llrRes [NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
/** LLR processing buffer */
static int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
/** Start addresses for the cnProcBuf for each CN group in BG1*/ /** Start addresses for the cnProcBuf for each CN group in BG1*/
static const uint32_t lut_startAddrCnGroups_BG1[NR_LDPC_NUM_CN_GROUPS_BG1] = {0, 1152, 8832, 43392, 61824, 75264, 81408, 88320, 92160}; static const uint32_t lut_startAddrCnGroups_BG1[NR_LDPC_NUM_CN_GROUPS_BG1] = {0, 1152, 8832, 43392, 61824, 75264, 81408, 88320, 92160};
......
/*
* 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_defs.h"
#include "nrLDPC_types.h"
#ifndef malloc32_clear
/**
\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(32, size+32);
memset(ptr, 0, size);
return ptr;
}
#endif
/**
\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
...@@ -41,13 +41,15 @@ ...@@ -41,13 +41,15 @@
\param Z Lifting size \param Z Lifting size
\param BG Base graph \param BG Base graph
*/ */
static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, uint16_t Z, uint8_t BG) static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, t_nrLDPC_procBuf* p_procBuf, uint16_t Z, uint8_t BG)
{ {
const uint16_t* lut_llr2llrProcBuf = p_lut->llr2llrProcBuf; const uint16_t* lut_llr2llrProcBuf = p_lut->llr2llrProcBuf;
uint32_t i; uint32_t i;
const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0]; const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0];
uint32_t colG1 = NR_LDPC_START_COL_PARITY_BG1*Z; uint32_t colG1 = NR_LDPC_START_COL_PARITY_BG1*Z;
int8_t* llrProcBuf = p_procBuf->llrProcBuf;
if (BG == 2) if (BG == 2)
{ {
colG1 = NR_LDPC_START_COL_PARITY_BG2*Z; colG1 = NR_LDPC_START_COL_PARITY_BG2*Z;
...@@ -74,11 +76,13 @@ static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, uint1 ...@@ -74,11 +76,13 @@ static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, uint1
\param Z Lifting size \param Z Lifting size
\param BG Base graph \param BG Base graph
*/ */
static inline void nrLDPC_llr2CnProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, uint16_t numLLR, uint16_t Z, uint8_t BG) static inline void nrLDPC_llr2CnProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, t_nrLDPC_procBuf* p_procBuf, uint16_t numLLR, uint16_t Z, uint8_t BG)
{ {
const uint32_t* lut_llr2CnProcBuf = p_lut->llr2CnProcBuf; const uint32_t* lut_llr2CnProcBuf = p_lut->llr2CnProcBuf;
const uint8_t* lut_numEdgesPerBn = p_lut->numEdgesPerBn; const uint8_t* lut_numEdgesPerBn = p_lut->numEdgesPerBn;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t curLLR; int8_t curLLR;
uint8_t numEdges; uint8_t numEdges;
uint32_t i; uint32_t i;
...@@ -123,12 +127,15 @@ static inline void nrLDPC_llr2CnProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, uint16 ...@@ -123,12 +127,15 @@ static inline void nrLDPC_llr2CnProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, uint16
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_cn2bnProcBuf(t_nrLDPC_lut* p_lut, uint16_t Z) static inline void nrLDPC_cn2bnProcBuf(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
const uint32_t* lut_cn2bnProcBuf = p_lut->cn2bnProcBuf; const uint32_t* lut_cn2bnProcBuf = p_lut->cn2bnProcBuf;
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
int8_t* bnProcBuf = p_procBuf->bnProcBuf;
const uint32_t* p_lut_cn2bn; const uint32_t* p_lut_cn2bn;
int8_t* p_cnProcBufRes; int8_t* p_cnProcBufRes;
uint32_t bitOffsetInGroup; uint32_t bitOffsetInGroup;
...@@ -245,12 +252,15 @@ static inline void nrLDPC_cn2bnProcBuf(t_nrLDPC_lut* p_lut, uint16_t Z) ...@@ -245,12 +252,15 @@ static inline void nrLDPC_cn2bnProcBuf(t_nrLDPC_lut* p_lut, uint16_t Z)
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, uint16_t Z) static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
const uint32_t* lut_cn2bnProcBuf = p_lut->cn2bnProcBuf; const uint32_t* lut_cn2bnProcBuf = p_lut->cn2bnProcBuf;
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
int8_t* bnProcBuf = p_procBuf->bnProcBuf;
const uint32_t* p_lut_cn2bn; const uint32_t* p_lut_cn2bn;
int8_t* p_cnProcBufRes; int8_t* p_cnProcBufRes;
uint32_t bitOffsetInGroup; uint32_t bitOffsetInGroup;
...@@ -418,12 +428,15 @@ static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, uint16_t Z) ...@@ -418,12 +428,15 @@ static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, uint16_t Z)
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_bn2cnProcBuf(t_nrLDPC_lut* p_lut, uint16_t Z) static inline void nrLDPC_bn2cnProcBuf(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
const uint32_t* lut_cn2bnProcBuf = p_lut->cn2bnProcBuf; const uint32_t* lut_cn2bnProcBuf = p_lut->cn2bnProcBuf;
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* bnProcBufRes = p_procBuf->bnProcBufRes;
int8_t* p_cnProcBuf; int8_t* p_cnProcBuf;
const uint32_t* p_lut_cn2bn; const uint32_t* p_lut_cn2bn;
uint32_t bitOffsetInGroup; uint32_t bitOffsetInGroup;
...@@ -543,12 +556,15 @@ static inline void nrLDPC_bn2cnProcBuf(t_nrLDPC_lut* p_lut, uint16_t Z) ...@@ -543,12 +556,15 @@ static inline void nrLDPC_bn2cnProcBuf(t_nrLDPC_lut* p_lut, uint16_t Z)
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, uint16_t Z) static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z)
{ {
const uint32_t* lut_cn2bnProcBuf = p_lut->cn2bnProcBuf; const uint32_t* lut_cn2bnProcBuf = p_lut->cn2bnProcBuf;
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* bnProcBufRes = p_procBuf->bnProcBufRes;
int8_t* p_cnProcBuf; int8_t* p_cnProcBuf;
const uint32_t* p_lut_cn2bn; const uint32_t* p_lut_cn2bn;
uint32_t bitOffsetInGroup; uint32_t bitOffsetInGroup;
...@@ -720,11 +736,13 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, uint16_t Z) ...@@ -720,11 +736,13 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, uint16_t Z)
\param llrOut Pointer to output LLRs \param llrOut Pointer to output LLRs
\param numLLR Number of LLR values \param numLLR Number of LLR values
*/ */
static inline void nrLDPC_llrRes2llrOut(t_nrLDPC_lut* p_lut, int8_t* llrOut, uint16_t numLLR) static inline void nrLDPC_llrRes2llrOut(t_nrLDPC_lut* p_lut, int8_t* llrOut, t_nrLDPC_procBuf* p_procBuf, uint16_t numLLR)
{ {
const uint16_t* lut_llr2llrProcBuf = p_lut->llr2llrProcBuf; const uint16_t* lut_llr2llrProcBuf = p_lut->llr2llrProcBuf;
uint32_t i; uint32_t i;
int8_t* llrRes = p_procBuf->llrRes;
for (i=0; i<numLLR; i++) for (i=0; i<numLLR; i++)
{ {
llrOut[i] = llrRes[lut_llr2llrProcBuf[i]]; llrOut[i] = llrRes[lut_llr2llrProcBuf[i]];
......
...@@ -87,38 +87,38 @@ static inline void nrLDPC_initFile(const char* fileName) ...@@ -87,38 +87,38 @@ static inline void nrLDPC_initFile(const char* fileName)
\brief Writes data of predefined buffers to file \brief Writes data of predefined buffers to file
\param buffer Enum of buffer name to write \param buffer Enum of buffer name to write
*/ */
static inline void nrLDPC_debug_writeBuffer2File(e_nrLDPC_buffers buffer) static inline void nrLDPC_debug_writeBuffer2File(e_nrLDPC_buffers buffer, t_nrLDPC_procBuf* p_procBuf)
{ {
switch (buffer) switch (buffer)
{ {
case nrLDPC_buffers_LLR_PROC: case nrLDPC_buffers_LLR_PROC:
{ {
nrLDPC_writeFile("llrProcBuf.txt", llrProcBuf, NR_LDPC_MAX_NUM_LLR); nrLDPC_writeFile("llrProcBuf.txt", p_procBuf->llrProcBuf, NR_LDPC_MAX_NUM_LLR);
break; break;
} }
case nrLDPC_buffers_CN_PROC: case nrLDPC_buffers_CN_PROC:
{ {
nrLDPC_writeFile("cnProcBuf.txt", cnProcBuf, NR_LDPC_SIZE_CN_PROC_BUF); nrLDPC_writeFile("cnProcBuf.txt", p_procBuf->cnProcBuf, NR_LDPC_SIZE_CN_PROC_BUF);
break; break;
} }
case nrLDPC_buffers_CN_PROC_RES: case nrLDPC_buffers_CN_PROC_RES:
{ {
nrLDPC_writeFile("cnProcBufRes.txt", cnProcBufRes, NR_LDPC_SIZE_CN_PROC_BUF); nrLDPC_writeFile("cnProcBufRes.txt", p_procBuf->cnProcBufRes, NR_LDPC_SIZE_CN_PROC_BUF);
break; break;
} }
case nrLDPC_buffers_BN_PROC: case nrLDPC_buffers_BN_PROC:
{ {
nrLDPC_writeFile("bnProcBuf.txt", bnProcBuf, NR_LDPC_SIZE_BN_PROC_BUF); nrLDPC_writeFile("bnProcBuf.txt", p_procBuf->bnProcBuf, NR_LDPC_SIZE_BN_PROC_BUF);
break; break;
} }
case nrLDPC_buffers_BN_PROC_RES: case nrLDPC_buffers_BN_PROC_RES:
{ {
nrLDPC_writeFile("bnProcBufRes.txt", bnProcBufRes, NR_LDPC_SIZE_BN_PROC_BUF); nrLDPC_writeFile("bnProcBufRes.txt", p_procBuf->bnProcBufRes, NR_LDPC_SIZE_BN_PROC_BUF);
break; break;
} }
case nrLDPC_buffers_LLR_RES: case nrLDPC_buffers_LLR_RES:
{ {
nrLDPC_writeFile("llrRes.txt", llrRes, NR_LDPC_MAX_NUM_LLR); nrLDPC_writeFile("llrRes.txt", p_procBuf->llrRes, NR_LDPC_MAX_NUM_LLR);
break; break;
} }
} }
......
...@@ -88,4 +88,16 @@ typedef struct nrLDPC_time_stats { ...@@ -88,4 +88,16 @@ typedef struct nrLDPC_time_stats {
time_stats_t total; /**< Statistics for total processing time */ time_stats_t total; /**< Statistics for total processing time */
} t_nrLDPC_time_stats; } t_nrLDPC_time_stats;
/**
Structure containing the processing buffers
*/
typedef struct nrLDPC_procBuf {
int8_t* cnProcBuf; /**< CN processing buffer */
int8_t* cnProcBufRes; /**< Buffer for CN processing results */
int8_t* bnProcBuf; /**< BN processing buffer */
int8_t* bnProcBufRes; /**< Buffer for BN processing results */
int8_t* llrRes; /**< Buffer for LLR results */
int8_t* llrProcBuf; /**< LLR processing buffer */
} t_nrLDPC_procBuf;
#endif #endif
...@@ -942,8 +942,6 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag) { ...@@ -942,8 +942,6 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag) {
void phy_init_nr_top(PHY_VARS_NR_UE *ue) void phy_init_nr_top(PHY_VARS_NR_UE *ue)
{ {
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
NR_UE_DLSCH_t *dlsch0 = ue->dlsch[0][0][0];
dlsch0 =(NR_UE_DLSCH_t *)malloc16(sizeof(NR_UE_DLSCH_t));
crcTableInit(); crcTableInit();
......
/* /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
...@@ -33,7 +34,7 @@ ...@@ -33,7 +34,7 @@
#ifndef __NR_TRANSPORT_COMMON_PROTO__H__ #ifndef __NR_TRANSPORT_COMMON_PROTO__H__
#define __NR_TRANSPORT_COMMON_PROTO__H__ #define __NR_TRANSPORT_COMMON_PROTO__H__
#define MAX_NUM_NR_DLSCH_SEGMENTS 32 #define MAX_NUM_NR_DLSCH_SEGMENTS 16
#define MAX_NUM_NR_ULSCH_SEGMENTS MAX_NUM_NR_DLSCH_SEGMENTS #define MAX_NUM_NR_ULSCH_SEGMENTS MAX_NUM_NR_DLSCH_SEGMENTS
#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056) #define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056)
......
...@@ -45,8 +45,6 @@ ...@@ -45,8 +45,6 @@
#define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX #define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX
static int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
static uint64_t nb_total_decod =0; static uint64_t nb_total_decod =0;
static uint64_t nb_error_decod =0; static uint64_t nb_error_decod =0;
...@@ -76,6 +74,13 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t *dlsch) ...@@ -76,6 +74,13 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t *dlsch)
dlsch->harq_processes[i]->d[r] = NULL; dlsch->harq_processes[i]->d[r] = NULL;
} }
for (r=0; r<(MAX_NUM_NR_DLSCH_SEGMENTS); r++) {
if (dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]){
nrLDPC_free_mem(dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]);
dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = NULL;
}
}
free16(dlsch->harq_processes[i],sizeof(NR_DL_UE_HARQ_t)); free16(dlsch->harq_processes[i],sizeof(NR_DL_UE_HARQ_t));
dlsch->harq_processes[i] = NULL; dlsch->harq_processes[i] = NULL;
} }
...@@ -136,7 +141,8 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint ...@@ -136,7 +141,8 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
exit_flag=3; exit_flag=3;
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) { for (r=0; r<MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling; r++) {
dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(1056); dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(1056);
if (dlsch->harq_processes[i]->c[r]) if (dlsch->harq_processes[i]->c[r])
...@@ -215,10 +221,13 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -215,10 +221,13 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
//short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(8448+64)]; //short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(8448+64)];
uint32_t r,r_offset=0,Kr=8424,Kr_bytes,K_bytes_F,err_flag=0; uint32_t r,r_offset=0,Kr=8424,Kr_bytes,K_bytes_F,err_flag=0;
uint8_t crc_type; uint8_t crc_type;
int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params decParams;
t_nrLDPC_dec_params* p_decParams = &decParams; t_nrLDPC_dec_params* p_decParams = &decParams;
t_nrLDPC_time_stats procTime; t_nrLDPC_time_stats procTime;
t_nrLDPC_time_stats* p_procTime =&procTime ; t_nrLDPC_time_stats* p_procTime =&procTime ;
t_nrLDPC_procBuf** p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf;
int16_t z [68*384]; int16_t z [68*384];
int8_t l [68*384]; int8_t l [68*384];
//__m128i l; //__m128i l;
...@@ -506,6 +515,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -506,6 +515,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
no_iteration_ldpc = nrLDPC_decoder(p_decParams, no_iteration_ldpc = nrLDPC_decoder(p_decParams,
(int8_t*)&pl[0], (int8_t*)&pl[0],
llrProcBuf, llrProcBuf,
p_nrLDPC_procBuf[r],
p_procTime); p_procTime);
if (check_crc(llrProcBuf,harq_process->B,harq_process->F,crc_type)) { if (check_crc(llrProcBuf,harq_process->B,harq_process->F,crc_type)) {
...@@ -691,6 +701,9 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -691,6 +701,9 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
t_nrLDPC_dec_params* p_decParams = &decParams; t_nrLDPC_dec_params* p_decParams = &decParams;
t_nrLDPC_time_stats procTime; t_nrLDPC_time_stats procTime;
t_nrLDPC_time_stats* p_procTime =&procTime ; t_nrLDPC_time_stats* p_procTime =&procTime ;
int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
t_nrLDPC_procBuf* p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf[0];
int16_t z [68*384]; int16_t z [68*384];
int8_t l [68*384]; int8_t l [68*384];
//__m128i l; //__m128i l;
...@@ -786,7 +799,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -786,7 +799,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
kb = harq_process->K/harq_process->Z; kb = harq_process->K/harq_process->Z;
if ( kb==22){ if ( kb==22){
p_decParams->BG = 1; p_decParams->BG = 1;
p_decParams->R = 89; p_decParams->R = 13;
kc = 68; kc = 68;
} }
else{ else{
...@@ -825,7 +838,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -825,7 +838,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
return((1+dlsch->max_ldpc_iterations)); return((1+dlsch->max_ldpc_iterations));
} }
#ifdef DEBUG_DLSCH_DECODING #ifdef DEBUG_DLSCH_DECODING
printf("Segmentation: C %d, Cminus %d, Kminus %d, Kplus %d\n",harq_process->C,harq_process->Cminus,harq_process->Kminus,harq_process->Kplus); printf("Segmentation: C %d, K %d\n",harq_process->C,harq_process->K);
#endif #endif
opp_enabled=1; opp_enabled=1;
...@@ -955,7 +968,9 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment ...@@ -955,7 +968,9 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment
Cby2 = 1; Cby2 = 1;
} }
for (r=0; r<Cby2; r++) { //for (r=0; r<Cby2; r++) {
r = 0;
if (r==0) r_offset =0;
Kr = harq_process->K; Kr = harq_process->K;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
...@@ -1007,9 +1022,14 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment ...@@ -1007,9 +1022,14 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment
stop_meas(dlsch_rate_unmatching_stats); stop_meas(dlsch_rate_unmatching_stats);
#endif #endif
} }
r_offset += E; //r_offset += E;
//printf("main thread r_offset %d\n",r_offset); //printf("main thread r_offset %d\n",r_offset);
#ifdef DEBUG_DLSCH_DECODING
for (int i =0; i<16; i++)
printf("rx output ratematching w[%d]= %d r_offset %d\n", i,harq_process->w[r][i], r_offset);
#endif
/* /*
printf("Subblock deinterleaving, d %p w %p\n", printf("Subblock deinterleaving, d %p w %p\n",
harq_process->d[r], harq_process->d[r],
...@@ -1022,6 +1042,11 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment ...@@ -1022,6 +1042,11 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment
harq_process->Qm, harq_process->Qm,
harq_process->d[r], harq_process->d[r],
harq_process->w[r]); harq_process->w[r]);
#ifdef DEBUG_DLSCH_DECODING
for (int i =0; i<16; i++)
printf("rx output interleaving d[%d]= %d r_offset %d\n", i,harq_process->d[r][i], r_offset);
#endif
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(dlsch_deinterleaving_stats); stop_meas(dlsch_deinterleaving_stats);
#endif #endif
...@@ -1065,6 +1090,10 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment ...@@ -1065,6 +1090,10 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment
#endif #endif
LOG_D(PHY,"mthread AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,nr_tti_rx,r,harq_process->C-1); LOG_D(PHY,"mthread AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,nr_tti_rx,r,harq_process->C-1);
for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){
inv_d[cnt] = (1)*harq_process->d[r][cnt];
}
memset(pv,0,2*p_decParams->Z*sizeof(int16_t)); memset(pv,0,2*p_decParams->Z*sizeof(int16_t));
//memset(pl,0,2*p_decParams->Z*sizeof(int8_t)); //memset(pl,0,2*p_decParams->Z*sizeof(int8_t));
memset((pv+K_bytes_F),127,harq_process->F*sizeof(int16_t)); memset((pv+K_bytes_F),127,harq_process->F*sizeof(int16_t));
...@@ -1090,6 +1119,7 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment ...@@ -1090,6 +1119,7 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment
no_iteration_ldpc = nrLDPC_decoder(p_decParams, no_iteration_ldpc = nrLDPC_decoder(p_decParams,
(int8_t*)&pl[0], (int8_t*)&pl[0],
llrProcBuf, llrProcBuf,
p_nrLDPC_procBuf,
p_procTime); p_procTime);
nb_total_decod++; nb_total_decod++;
...@@ -1100,6 +1130,16 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment ...@@ -1100,6 +1130,16 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment
else { else {
ret=2; ret=2;
} }
if (check_crc(llrProcBuf,harq_process->B,harq_process->F,crc_type)) {
printf("CRC OK\n");
ret = 2;
}
else {
printf("CRC NOK\n");
ret = 1+dlsch->max_ldpc_iterations;
}
//if (!nb_total_decod%10000){ //if (!nb_total_decod%10000){
printf("Error number of iteration LPDC %d %ld/%ld \n", no_iteration_ldpc, nb_error_decod,nb_total_decod);fflush(stdout); printf("Error number of iteration LPDC %d %ld/%ld \n", no_iteration_ldpc, nb_error_decod,nb_total_decod);fflush(stdout);
//} //}
...@@ -1130,7 +1170,10 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment ...@@ -1130,7 +1170,10 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment
//printf("output channel decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]); //printf("output channel decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]);
//printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]); //printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]);
#ifdef DEBUG_DLSCH_DECODING
for (int k=0;k<32;k++)
printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
#endif
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(dlsch_turbo_decoding_stats); stop_meas(dlsch_turbo_decoding_stats);
...@@ -1142,7 +1185,7 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment ...@@ -1142,7 +1185,7 @@ if (harq_process->C>1) { // wakeup worker if more than 1 segment
LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_tti_rx,r,harq_process->C-1); LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_tti_rx,r,harq_process->C-1);
err_flag = 1; err_flag = 1;
} }
} //} //loop r
int32_t frame_rx_prev = frame; int32_t frame_rx_prev = frame;
int32_t tti_rx_prev = nr_tti_rx - 1; int32_t tti_rx_prev = nr_tti_rx - 1;
...@@ -1273,6 +1316,8 @@ void *nr_dlsch_decoding_2thread0(void *arg) ...@@ -1273,6 +1316,8 @@ void *nr_dlsch_decoding_2thread0(void *arg)
t_nrLDPC_dec_params* p_decParams = &decParams; t_nrLDPC_dec_params* p_decParams = &decParams;
t_nrLDPC_time_stats procTime; t_nrLDPC_time_stats procTime;
t_nrLDPC_time_stats* p_procTime =&procTime ; t_nrLDPC_time_stats* p_procTime =&procTime ;
int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
t_nrLDPC_procBuf* p_nrLDPC_procBuf;
int16_t z [68*384]; int16_t z [68*384];
int8_t l [68*384]; int8_t l [68*384];
//__m128i l; //__m128i l;
...@@ -1365,6 +1410,7 @@ void *nr_dlsch_decoding_2thread0(void *arg) ...@@ -1365,6 +1410,7 @@ void *nr_dlsch_decoding_2thread0(void *arg)
NR_DL_UE_HARQ_t *harq_process = dlsch->harq_processes[harq_pid]; NR_DL_UE_HARQ_t *harq_process = dlsch->harq_processes[harq_pid];
short *dlsch_llr = phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0]; short *dlsch_llr = phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0];
//printf("2thread0 llr flag %d tdp flag %d\n",llr8_flag1, tdp->llr8_flag); //printf("2thread0 llr flag %d tdp flag %d\n",llr8_flag1, tdp->llr8_flag);
p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf[1];
/* /*
if (nb_rb > frame_parms->N_RB_DL) { if (nb_rb > frame_parms->N_RB_DL) {
...@@ -1410,7 +1456,7 @@ void *nr_dlsch_decoding_2thread0(void *arg) ...@@ -1410,7 +1456,7 @@ void *nr_dlsch_decoding_2thread0(void *arg)
kb = harq_process->K/harq_process->Z; kb = harq_process->K/harq_process->Z;
if ( kb==22){ if ( kb==22){
p_decParams->BG = 1; p_decParams->BG = 1;
p_decParams->R = 89; p_decParams->R = 13;
kc = 68; kc = 68;
} }
else{ else{
...@@ -1523,7 +1569,7 @@ void *nr_dlsch_decoding_2thread0(void *arg) ...@@ -1523,7 +1569,7 @@ void *nr_dlsch_decoding_2thread0(void *arg)
stop_meas(dlsch_rate_unmatching_stats); stop_meas(dlsch_rate_unmatching_stats);
#endif #endif
} }
r_offset += E; //r_offset += E;
//for (int i =0; i<16; i++) //for (int i =0; i<16; i++)
// printf("rx output ratematching w[%d]= %d r_offset %d\n", i,harq_process->w[r][i], r_offset); // printf("rx output ratematching w[%d]= %d r_offset %d\n", i,harq_process->w[r][i], r_offset);
...@@ -1606,6 +1652,7 @@ void *nr_dlsch_decoding_2thread0(void *arg) ...@@ -1606,6 +1652,7 @@ void *nr_dlsch_decoding_2thread0(void *arg)
no_iteration_ldpc = nrLDPC_decoder(p_decParams, no_iteration_ldpc = nrLDPC_decoder(p_decParams,
(int8_t*)&pl[0], (int8_t*)&pl[0],
llrProcBuf, llrProcBuf,
p_nrLDPC_procBuf,
p_procTime); p_procTime);
if (no_iteration_ldpc > 10) if (no_iteration_ldpc > 10)
...@@ -1633,6 +1680,10 @@ void *nr_dlsch_decoding_2thread0(void *arg) ...@@ -1633,6 +1680,10 @@ void *nr_dlsch_decoding_2thread0(void *arg)
} }
printf(" \n");*/ printf(" \n");*/
#ifdef DEBUG_DLSCH_DECODING
for (int k=0;k<2;k++)
printf("segment 1 output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
#endif
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(dlsch_turbo_decoding_stats); stop_meas(dlsch_turbo_decoding_stats);
...@@ -1778,6 +1829,8 @@ void *nr_dlsch_decoding_2thread1(void *arg) ...@@ -1778,6 +1829,8 @@ void *nr_dlsch_decoding_2thread1(void *arg)
t_nrLDPC_dec_params* p_decParams = &decParams; t_nrLDPC_dec_params* p_decParams = &decParams;
t_nrLDPC_time_stats procTime; t_nrLDPC_time_stats procTime;
t_nrLDPC_time_stats* p_procTime =&procTime ; t_nrLDPC_time_stats* p_procTime =&procTime ;
t_nrLDPC_procBuf* p_nrLDPC_procBuf;
int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
int16_t z [68*384]; int16_t z [68*384];
int8_t l [68*384]; int8_t l [68*384];
//__m128i l; //__m128i l;
...@@ -1871,6 +1924,7 @@ void *nr_dlsch_decoding_2thread1(void *arg) ...@@ -1871,6 +1924,7 @@ void *nr_dlsch_decoding_2thread1(void *arg)
short *dlsch_llr = phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0]; short *dlsch_llr = phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0];
//printf("2thread0 llr flag %d tdp flag %d\n",llr8_flag1, tdp->llr8_flag); //printf("2thread0 llr flag %d tdp flag %d\n",llr8_flag1, tdp->llr8_flag);
//printf("2thread1 nr_tti_tx %d subframe %d SF thread id %d r_offset %d\n", proc->nr_tti_rx, subframe, phy_vars_ue->current_thread_id[subframe], r_offset); //printf("2thread1 nr_tti_tx %d subframe %d SF thread id %d r_offset %d\n", proc->nr_tti_rx, subframe, phy_vars_ue->current_thread_id[subframe], r_offset);
p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf[2];
/* /*
if (nb_rb > frame_parms->N_RB_DL) { if (nb_rb > frame_parms->N_RB_DL) {
...@@ -2032,7 +2086,7 @@ void *nr_dlsch_decoding_2thread1(void *arg) ...@@ -2032,7 +2086,7 @@ void *nr_dlsch_decoding_2thread1(void *arg)
stop_meas(dlsch_rate_unmatching_stats); stop_meas(dlsch_rate_unmatching_stats);
#endif #endif
} }
r_offset += E; //r_offset += E;
/* /*
printf("Subblock deinterleaving, d %p w %p\n", printf("Subblock deinterleaving, d %p w %p\n",
...@@ -2110,6 +2164,7 @@ void *nr_dlsch_decoding_2thread1(void *arg) ...@@ -2110,6 +2164,7 @@ void *nr_dlsch_decoding_2thread1(void *arg)
no_iteration_ldpc = nrLDPC_decoder(p_decParams, no_iteration_ldpc = nrLDPC_decoder(p_decParams,
(int8_t*)&pl[0], (int8_t*)&pl[0],
llrProcBuf, llrProcBuf,
p_nrLDPC_procBuf,
p_procTime); p_procTime);
if (no_iteration_ldpc > 10) if (no_iteration_ldpc > 10)
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <limits.h> #include <limits.h>
#include "PHY/impl_defs_top.h" #include "PHY/impl_defs_top.h"
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
//#include "PHY/defs_nr_UE.h" //#include "PHY/defs_nr_UE.h"
#include "../NR_TRANSPORT/nr_transport_common_proto.h" #include "../NR_TRANSPORT/nr_transport_common_proto.h"
...@@ -267,6 +267,8 @@ typedef struct { ...@@ -267,6 +267,8 @@ typedef struct {
double w_abs[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; double w_abs[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448];
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t *d[MAX_NUM_NR_DLSCH_SEGMENTS]; int16_t *d[MAX_NUM_NR_DLSCH_SEGMENTS];
/// LDPC processing buffers
t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_DLSCH_SEGMENTS];
/// Number of code segments /// Number of code segments
uint32_t C; uint32_t C;
/// Number of bits in code segments /// Number of bits in code segments
...@@ -354,8 +356,6 @@ typedef struct { ...@@ -354,8 +356,6 @@ typedef struct {
uint8_t max_ldpc_iterations; uint8_t max_ldpc_iterations;
/// number of iterations used in last turbo decoding /// number of iterations used in last turbo decoding
uint8_t last_iteration_cnt; uint8_t last_iteration_cnt;
} NR_UE_DLSCH_t; } NR_UE_DLSCH_t;
typedef enum {format0_0, typedef enum {format0_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