fix(nrLDPC_coding): Apply clang-format to openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
This commit is contained in:
@@ -20,9 +20,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file PHY/NR_TRANSPORT/nr_ulsch_decoding_slot.c
|
/*! \file PHY/NR_TRANSPORT/nr_ulsch_decoding_slot.c
|
||||||
* \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"
|
||||||
@@ -41,27 +40,26 @@
|
|||||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
//#define DEBUG_ULSCH_DECODING
|
// #define DEBUG_ULSCH_DECODING
|
||||||
//#define gNB_DEBUG_TRACE
|
// #define gNB_DEBUG_TRACE
|
||||||
|
|
||||||
#define OAI_UL_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX = 68*384
|
#define OAI_UL_LDPC_MAX_NUM_LLR 27000 // 26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX = 68*384
|
||||||
//#define DEBUG_CRC
|
// #define DEBUG_CRC
|
||||||
#ifdef DEBUG_CRC
|
#ifdef DEBUG_CRC
|
||||||
#define PRINT_CRC_CHECK(a) a
|
#define PRINT_CRC_CHECK(a) a
|
||||||
#else
|
#else
|
||||||
#define PRINT_CRC_CHECK(a)
|
#define PRINT_CRC_CHECK(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//extern double cpuf;
|
// extern double cpuf;
|
||||||
|
|
||||||
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) {
|
||||||
a_segments = a_segments*N_RB_UL;
|
a_segments = a_segments * N_RB_UL;
|
||||||
a_segments = a_segments/273 +1;
|
a_segments = a_segments / 273 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ulsch->harq_process) {
|
if (ulsch->harq_process) {
|
||||||
@@ -83,12 +81,11 @@ 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) {
|
||||||
a_segments = a_segments*N_RB_UL;
|
a_segments = a_segments * N_RB_UL;
|
||||||
a_segments = a_segments/273 +1;
|
a_segments = a_segments / 273 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ulsch_bytes = a_segments * 1056; // allocated bytes per segment
|
uint32_t ulsch_bytes = a_segments * 1056; // allocated bytes per segment
|
||||||
@@ -110,7 +107,7 @@ NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
|
|||||||
}
|
}
|
||||||
harq->d_to_be_cleared = calloc(a_segments, sizeof(bool));
|
harq->d_to_be_cleared = calloc(a_segments, sizeof(bool));
|
||||||
AssertFatal(harq->d_to_be_cleared != NULL, "out of memory\n");
|
AssertFatal(harq->d_to_be_cleared != NULL, "out of memory\n");
|
||||||
return(ulsch);
|
return (ulsch);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||||
@@ -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;
|
||||||
|
|
||||||
@@ -215,14 +209,14 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER * TB_parameters->nb_layers; // number of segments to be allocated
|
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER * TB_parameters->nb_layers; // number of segments to be allocated
|
||||||
if (TB_parameters->C > a_segments) {
|
if (TB_parameters->C > a_segments) {
|
||||||
LOG_E(PHY, "nr_segmentation.c: too many segments %d, A %d\n", harq_process->C, TB_parameters->A);
|
LOG_E(PHY, "nr_segmentation.c: too many segments %d, A %d\n", harq_process->C, TB_parameters->A);
|
||||||
return(-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (TB_parameters->nb_rb != 273) {
|
if (TB_parameters->nb_rb != 273) {
|
||||||
a_segments = a_segments*TB_parameters->nb_rb;
|
a_segments = a_segments * TB_parameters->nb_rb;
|
||||||
a_segments = a_segments/273 +1;
|
a_segments = a_segments / 273 + 1;
|
||||||
}
|
}
|
||||||
if (TB_parameters->C > a_segments) {
|
if (TB_parameters->C > a_segments) {
|
||||||
LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,a_segments);
|
LOG_E(PHY, "Illegal harq_process->C %d > %d\n", harq_process->C, a_segments);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
max_num_segments = max(max_num_segments, TB_parameters->C);
|
max_num_segments = max(max_num_segments, TB_parameters->C);
|
||||||
@@ -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