some more cleanup in memory allocation
This commit is contained in:
@@ -116,7 +116,7 @@ int test_ldpc(short No_iteration,
|
||||
sigma = 1.0/sqrt(2*SNR);
|
||||
opp_enabled=1;
|
||||
//short test_input[block_length];
|
||||
unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
|
||||
unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
|
||||
//short *c; //padded codeword
|
||||
unsigned char *estimated_output[MAX_NUM_DLSCH_SEGMENTS];
|
||||
unsigned char *estimated_output_bit[MAX_NUM_DLSCH_SEGMENTS];
|
||||
|
||||
@@ -57,7 +57,7 @@ typedef struct {
|
||||
/// Number of "Filler" bits
|
||||
uint32_t F;
|
||||
/// LDPC-code outputs
|
||||
uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS];
|
||||
} encoder_implemparams_t;
|
||||
#define INIT0_LDPCIMPLEMPARAMS {0,0,0,NULL,NULL,NULL,NULL}
|
||||
typedef void(*nrLDPC_initcallfunc_t)(t_nrLDPC_dec_params *p_decParams, int8_t *p_llr, int8_t *p_out);
|
||||
|
||||
@@ -63,11 +63,6 @@ int32_t nr_segmentation(unsigned char *input_buffer,
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((*C)>MAX_NUM_NR_DLSCH_SEGMENTS) {
|
||||
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Find K+
|
||||
Kprime = Bprime/(*C);
|
||||
|
||||
|
||||
@@ -123,9 +123,10 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch,
|
||||
void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
|
||||
const NR_DL_FRAME_PARMS *const fp) {
|
||||
AssertFatal( pusch, "pusch==0" );
|
||||
|
||||
for (int i=0; i<NR_MAX_NB_LAYERS; i++) {
|
||||
pusch->txdataF_layers[i] = (int32_t *)malloc16_clear(NR_MAX_PUSCH_ENCODED_LENGTH*sizeof(int32_t));
|
||||
int max_pusch_length = fp->N_RB_UL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*fp->nb_antennas_tx;
|
||||
pusch->txdataF_layers = (int32_t **)malloc16_clear(fp->nb_antennas_tx*sizeof(int32_t *));
|
||||
for (int i=0; i<fp->nb_antennas_tx; i++) {
|
||||
pusch->txdataF_layers[i] = (int32_t *)malloc16_clear(max_pusch_length*sizeof(int32_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
|
||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
||||
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
||||
int16_t **mod_symbs = (int16_t**)dlsch->mod_symbs;
|
||||
int16_t **tx_layers = (int16_t**)dlsch->txdataF;
|
||||
int16_t **txdataF_precoding = (int16_t**)dlsch->txdataF_precoding;
|
||||
@@ -159,6 +158,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers;
|
||||
uint8_t Qm = rel15->qamModOrder[0];
|
||||
uint32_t encoded_length = nb_re*Qm;
|
||||
uint32_t scrambled_output[rel15->NrOfCodewords][encoded_length>>5];
|
||||
int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16)));
|
||||
|
||||
/* PTRS */
|
||||
@@ -180,8 +180,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
|
||||
/// CRC, coding, interleaving and rate matching
|
||||
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
|
||||
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32)));
|
||||
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
|
||||
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * rel15->nrOfLayers] __attribute__((aligned(32)));
|
||||
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * rel15->nrOfLayers);
|
||||
start_meas(dlsch_encoding_stats);
|
||||
nr_dlsch_encoding(gNB,
|
||||
harq->pdu, frame, slot, dlsch, frame_parms, output,
|
||||
|
||||
@@ -68,7 +68,7 @@ void nr_fill_dlsch(processingData_L1tx_t *msgTx,
|
||||
void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
int frame,
|
||||
int slot);
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB, NR_DL_FRAME_PARMS* frame_parms);
|
||||
|
||||
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
|
||||
|
||||
|
||||
@@ -50,10 +50,12 @@
|
||||
//#define DEBUG_DLSCH_FREE 1
|
||||
|
||||
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) {
|
||||
int r;
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB, NR_DL_FRAME_PARMS* frame_parms) {
|
||||
|
||||
NR_gNB_DLSCH_t *dlsch = *dlschptr;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
|
||||
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers;
|
||||
|
||||
if (dlsch) {
|
||||
if (N_RB != 273) {
|
||||
@@ -78,7 +80,7 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) {
|
||||
LOG_D(PHY, "Freeing dlsch process %d c (%p)\n", i, harq->c);
|
||||
#endif
|
||||
|
||||
for (r = 0; r < a_segments; r++) {
|
||||
for (int r = 0; r < a_segments; r++) {
|
||||
#ifdef DEBUG_DLSCH_FREE
|
||||
LOG_D(PHY, "Freeing dlsch process %d c[%d] (%p)\n", i, r, harq->c[r]);
|
||||
#endif
|
||||
@@ -99,9 +101,9 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint32_t Nsoft,
|
||||
uint8_t abstraction_flag,
|
||||
uint16_t N_RB) {
|
||||
unsigned char i,r,aa,layer;
|
||||
int re;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
|
||||
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated
|
||||
|
||||
if (N_RB != 273) {
|
||||
a_segments = a_segments*N_RB;
|
||||
@@ -117,31 +119,35 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
dlsch->Mlimit = 4;
|
||||
dlsch->Nsoft = Nsoft;
|
||||
|
||||
for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) {
|
||||
int txdataf_size = frame_parms->N_RB_DL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8; // max pdsch encoded length for each layer
|
||||
|
||||
dlsch->txdataF = (int32_t **)malloc16(max_layers*sizeof(int32_t *));
|
||||
dlsch->txdataF_precoding = (int32_t **)malloc16(max_layers*sizeof(int32_t *));
|
||||
dlsch->ue_spec_bf_weights = (int32_t ***)malloc16(max_layers*sizeof(int32_t **));
|
||||
for (int layer=0; layer<max_layers; layer++) {
|
||||
dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64*sizeof(int32_t *));
|
||||
|
||||
for (aa=0; aa<64; aa++) {
|
||||
for (int aa=0; aa<64; aa++) {
|
||||
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||
|
||||
for (re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||
for (int re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
||||
}
|
||||
}
|
||||
|
||||
dlsch->txdataF[layer] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH/NR_MAX_NB_LAYERS)*sizeof(int32_t)); // NR_MAX_NB_LAYERS is already included in NR_MAX_PDSCH_ENCODED_LENGTH
|
||||
dlsch->txdataF[layer] = (int32_t *)malloc16((txdataf_size)*sizeof(int32_t));
|
||||
dlsch->txdataF_precoding[layer] = (int32_t *)malloc16(2*14*frame_parms->ofdm_symbol_size*sizeof(int32_t));
|
||||
}
|
||||
|
||||
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
|
||||
dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH*sizeof(int32_t));
|
||||
dlsch->mod_symbs[q] = (int32_t *)malloc16(txdataf_size*max_layers*sizeof(int32_t));
|
||||
|
||||
dlsch->calib_dl_ch_estimates = (int32_t **)malloc16(64*sizeof(int32_t *));
|
||||
|
||||
for (aa=0; aa<64; aa++) {
|
||||
for (int aa=0; aa<64; aa++) {
|
||||
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||
}
|
||||
|
||||
for (i=0; i<20; i++) {
|
||||
for (int i=0; i<20; i++) {
|
||||
dlsch->harq_ids[0][i] = 0;
|
||||
dlsch->harq_ids[1][i] = 0;
|
||||
}
|
||||
@@ -156,7 +162,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
nr_emulate_dlsch_payload(harq->pdu, (dlsch_bytes) >> 3);
|
||||
bzero(harq->b, dlsch_bytes);
|
||||
|
||||
for (r = 0; r < a_segments; r++) {
|
||||
harq->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *));
|
||||
for (int r = 0; r < a_segments; r++) {
|
||||
// account for filler in first segment and CRCs for multiple segment case
|
||||
// [hna] 8448 is the maximum CB size in NR
|
||||
// 68*348 = 68*(maximum size of Zc)
|
||||
@@ -319,6 +326,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
stats->current_Qm = rel15->qamModOrder[0];
|
||||
}
|
||||
|
||||
int max_bytes = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers*1056;
|
||||
if (A > 3824) {
|
||||
// Add 24-bit crc (polynomial A) to payload
|
||||
crc = crc24a(a,A)>>8;
|
||||
@@ -329,11 +337,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
|
||||
harq->B = A+24;
|
||||
// harq->b = a;
|
||||
AssertFatal((A / 8) + 4 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
||||
AssertFatal((A / 8) + 4 <= max_bytes,
|
||||
"A %d is too big (A/8+4 = %d > %d)\n",
|
||||
A,
|
||||
(A / 8) + 4,
|
||||
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||
max_bytes);
|
||||
memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes?
|
||||
} else {
|
||||
// Add 16-bit crc (polynomial A) to payload
|
||||
@@ -344,11 +352,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
//printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
|
||||
harq->B = A+16;
|
||||
// harq->b = a;
|
||||
AssertFatal((A / 8) + 3 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
||||
AssertFatal((A / 8) + 3 <= max_bytes,
|
||||
"A %d is too big (A/8+3 = %d > %d)\n",
|
||||
A,
|
||||
(A / 8) + 3,
|
||||
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||
max_bytes);
|
||||
memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc
|
||||
}
|
||||
|
||||
@@ -366,6 +374,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
impp.Kb = nr_segmentation(harq->b, harq->c, harq->B, &impp.n_segments, &impp.K, impp.Zc, &impp.F, impp.BG);
|
||||
stop_meas(dlsch_segmentation_stats);
|
||||
|
||||
if (impp.n_segments>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers) {
|
||||
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",impp.n_segments,harq->B);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
for (int r=0; r<impp.n_segments; r++) {
|
||||
//d_tmp[r] = &harq->d[r][0];
|
||||
//channel_input[r] = &harq->d[r][0];
|
||||
|
||||
@@ -197,7 +197,7 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch)
|
||||
//t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_NR_ULSCH_SEGMENTS];
|
||||
ulsch->harq_processes[i]->Z=0;
|
||||
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
|
||||
//int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448];
|
||||
//int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448];
|
||||
ulsch->harq_processes[i]->E=0;
|
||||
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ void init_dlsch_tpool(uint8_t num_dlsch_threads) {
|
||||
}
|
||||
|
||||
void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL) {
|
||||
int i,r;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS;
|
||||
NR_UE_DLSCH_t *dlsch=*dlschptr;
|
||||
|
||||
if (dlsch) {
|
||||
@@ -90,37 +90,18 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL) {
|
||||
a_segments = a_segments/273 +1;
|
||||
}
|
||||
|
||||
for (i=0; i<dlsch->Mdlharq; i++) {
|
||||
for (int i=0; i<dlsch->Mdlharq; i++) {
|
||||
if (dlsch->harq_processes[i]) {
|
||||
if (dlsch->harq_processes[i]->b) {
|
||||
free16(dlsch->harq_processes[i]->b,a_segments*1056);
|
||||
dlsch->harq_processes[i]->b = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<a_segments; r++) {
|
||||
for (int r=0; r<a_segments; r++) {
|
||||
free16(dlsch->harq_processes[i]->c[r],1056);
|
||||
dlsch->harq_processes[i]->c[r] = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<a_segments; r++)
|
||||
if (dlsch->harq_processes[i]->d[r]) {
|
||||
free16(dlsch->harq_processes[i]->d[r],(5*8448)*sizeof(short));
|
||||
dlsch->harq_processes[i]->d[r] = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<a_segments; r++)
|
||||
if (dlsch->harq_processes[i]->w[r]) {
|
||||
free16(dlsch->harq_processes[i]->w[r],(5*8448)*sizeof(short));
|
||||
dlsch->harq_processes[i]->w[r] = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<a_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));
|
||||
dlsch->harq_processes[i] = NULL;
|
||||
}
|
||||
@@ -132,9 +113,11 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL) {
|
||||
}
|
||||
|
||||
NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL, uint8_t abstraction_flag) {
|
||||
|
||||
NR_UE_DLSCH_t *dlsch;
|
||||
uint8_t exit_flag = 0,i,r;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
uint8_t exit_flag = 0;
|
||||
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated
|
||||
|
||||
if (N_RB_DL != 273) {
|
||||
a_segments = a_segments*N_RB_DL;
|
||||
@@ -153,7 +136,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
|
||||
dlsch->Mlimit = 4;
|
||||
dlsch->max_ldpc_iterations = max_ldpc_iterations;
|
||||
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
for (int i=0; i<Mdlharq; i++) {
|
||||
dlsch->harq_processes[i] = (NR_DL_UE_HARQ_t *)malloc16(sizeof(NR_DL_UE_HARQ_t));
|
||||
|
||||
if (dlsch->harq_processes[i]) {
|
||||
@@ -168,7 +151,9 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
|
||||
exit_flag=3;
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
for (r=0; r<a_segments; r++) {
|
||||
dlsch->harq_processes[i]->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *));
|
||||
dlsch->harq_processes[i]->p_nrLDPC_procBuf = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *));
|
||||
for (int r=0; r<a_segments; r++) {
|
||||
dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
|
||||
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056);
|
||||
|
||||
@@ -176,20 +161,6 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
|
||||
memset(dlsch->harq_processes[i]->c[r],0,1056);
|
||||
else
|
||||
exit_flag=2;
|
||||
|
||||
dlsch->harq_processes[i]->d[r] = (short *)malloc16((5*8448)*sizeof(short));
|
||||
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short));
|
||||
else
|
||||
exit_flag=2;
|
||||
|
||||
dlsch->harq_processes[i]->w[r] = (short *)malloc16((5*8448)*sizeof(short));
|
||||
|
||||
if (dlsch->harq_processes[i]->w[r])
|
||||
memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short));
|
||||
else
|
||||
exit_flag=2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -344,10 +315,12 @@ void nr_processDLSegment(void* arg) {
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_deinterleaving_stats);
|
||||
#endif
|
||||
int16_t w[5*8448];
|
||||
memset(w,0,(5*8448)*sizeof(short));
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN);
|
||||
nr_deinterleaving_ldpc(E,
|
||||
Qm,
|
||||
harq_process->w[r], // [hna] w is e
|
||||
w, // [hna] w is e
|
||||
dlsch_llr+r_offset);
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT);
|
||||
#if UE_TIMING_TRACE
|
||||
@@ -367,12 +340,14 @@ void nr_processDLSegment(void* arg) {
|
||||
harq_process->round); */
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN);
|
||||
|
||||
int16_t d[5*8448];
|
||||
memset(d,0,(5*8448)*sizeof(short));
|
||||
if (nr_rate_matching_ldpc_rx(Ilbrm,
|
||||
Tbslbrm,
|
||||
p_decoderParms->BG,
|
||||
p_decoderParms->Z,
|
||||
harq_process->d[r],
|
||||
harq_process->w[r],
|
||||
d,
|
||||
w,
|
||||
harq_process->C,
|
||||
harq_process->rvidx,
|
||||
(harq_process->first_rx==1)?1:0,
|
||||
@@ -398,7 +373,7 @@ void nr_processDLSegment(void* arg) {
|
||||
LOG_I(PHY,"decoder input(segment %u) :",r);
|
||||
|
||||
for (int i=0; i<E; i++)
|
||||
LOG_D(PHY,"%d : %d\n",i,harq_process->d[r][i]);
|
||||
LOG_D(PHY,"%d : %d\n",i,d[i]);
|
||||
|
||||
LOG_D(PHY,"\n");
|
||||
}
|
||||
@@ -426,9 +401,9 @@ void nr_processDLSegment(void* arg) {
|
||||
//set Filler bits
|
||||
memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t));
|
||||
//Move coded bits before filler bits
|
||||
memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t));
|
||||
memcpy((&z[0]+2*harq_process->Z),d,(K_bits_F-2*harq_process->Z)*sizeof(int16_t));
|
||||
//skip filler bits
|
||||
memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t));
|
||||
memcpy((&z[0]+Kr),d+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t));
|
||||
|
||||
//Saturate coded bits before decoding into 8 bits values
|
||||
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) {
|
||||
@@ -612,6 +587,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
&harq_process->F,
|
||||
p_decParams->BG);
|
||||
|
||||
if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->Nl) {
|
||||
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD) && (!frame%100))
|
||||
LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl);
|
||||
}
|
||||
@@ -627,7 +607,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
p_decParams->numMaxIter = dlsch->max_ldpc_iterations;
|
||||
p_decParams->outMode= 0;
|
||||
r_offset = 0;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->Nl; //number of segments to be allocated
|
||||
|
||||
if (nb_rb != 273) {
|
||||
a_segments = a_segments*nb_rb;
|
||||
|
||||
@@ -179,7 +179,7 @@ typedef struct {
|
||||
/// Pointer to the payload
|
||||
uint8_t *b;
|
||||
/// Pointers to transport block segments
|
||||
uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
uint8_t **c;
|
||||
/// Index of current HARQ round for this DLSCH
|
||||
uint8_t round;
|
||||
/// MCS table for this DLSCH
|
||||
@@ -194,14 +194,8 @@ typedef struct {
|
||||
uint8_t rvidx;
|
||||
/// MIMO mode for this DLSCH
|
||||
MIMO_nrmode_t mimo_mode;
|
||||
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
|
||||
int16_t *w[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
/// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
|
||||
//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)
|
||||
int16_t *d[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
/// LDPC processing buffers
|
||||
t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
t_nrLDPC_procBuf **p_nrLDPC_procBuf;
|
||||
/// Number of code segments
|
||||
uint32_t C;
|
||||
/// Number of bits in code segments
|
||||
|
||||
@@ -102,7 +102,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
|
||||
|
||||
uint32_t available_bits;
|
||||
uint32_t scrambled_output[NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
||||
int16_t **tx_layers;
|
||||
int32_t **txdataF;
|
||||
int8_t Wf[2], Wt[2];
|
||||
@@ -176,7 +175,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
///////////
|
||||
|
||||
available_bits = G;
|
||||
|
||||
uint32_t scrambled_output[(available_bits>>5)+1];
|
||||
memset(scrambled_output, 0, ((available_bits>>5)+1)*sizeof(uint32_t));
|
||||
|
||||
nr_pusch_codeword_scrambling(harq_process_ul_ue->f,
|
||||
|
||||
@@ -89,7 +89,7 @@ typedef struct {
|
||||
/// Pointer to the payload
|
||||
uint8_t *b;
|
||||
/// Pointers to transport block segments
|
||||
uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
uint8_t **c;
|
||||
/// Frame where current HARQ round was sent
|
||||
uint32_t frame;
|
||||
/// Subframe where current HARQ round was sent
|
||||
@@ -157,13 +157,13 @@ typedef struct {
|
||||
/// Pointers to variables related to DLSCH harq process
|
||||
NR_DL_gNB_HARQ_t harq_process;
|
||||
/// TX buffers for UE-spec transmission (antenna layers 1,...,4 after to precoding)
|
||||
int32_t *txdataF[NR_MAX_NB_LAYERS];
|
||||
int32_t **txdataF;
|
||||
/// TX buffers for UE-spec transmission (antenna ports 1000 or 1001,...,1007, before precoding)
|
||||
int32_t *txdataF_precoding[NR_MAX_NB_LAYERS];
|
||||
int32_t **txdataF_precoding;
|
||||
/// Modulated symbols buffer
|
||||
int32_t *mod_symbs[NR_MAX_NB_CODEWORDS];
|
||||
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
|
||||
int32_t **ue_spec_bf_weights[NR_MAX_NB_LAYERS];
|
||||
int32_t ***ue_spec_bf_weights;
|
||||
/// dl channel estimates (estimated from ul channel estimates)
|
||||
int32_t **calib_dl_ch_estimates;
|
||||
/// Allocated RNTI (0 means DLSCH_t is not currently used)
|
||||
@@ -287,7 +287,7 @@ typedef struct {
|
||||
/// LDPC lifting size (38.212 V15.4.0 table 5.3.2-1)
|
||||
uint32_t Z;
|
||||
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
|
||||
int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448];
|
||||
int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448];
|
||||
/// Number of bits in each code block after rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
|
||||
uint32_t E;
|
||||
/// Number of segments processed so far
|
||||
|
||||
@@ -228,7 +228,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
/// TX buffers for multiple layers
|
||||
int32_t *txdataF_layers[NR_MAX_NB_LAYERS];
|
||||
int32_t **txdataF_layers;
|
||||
} NR_UE_PUSCH;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -44,8 +44,6 @@
|
||||
|
||||
#define MAX_NUM_SUBCARRIER_SPACING 5
|
||||
|
||||
#define NR_MAX_NB_RB 275
|
||||
|
||||
#define NR_NB_SC_PER_RB 12
|
||||
#define NR_NB_REG_PER_CCE 6
|
||||
|
||||
@@ -80,16 +78,14 @@
|
||||
#define NR_MAX_CSET_DURATION 3
|
||||
|
||||
#define NR_MAX_NB_RBG 18
|
||||
#define NR_MAX_NB_LAYERS 2 // 8 // SU-MIMO (3GPP TS 38.211 V15.4.0 section 7.3.1.3)
|
||||
#define NR_MAX_NB_LAYERS 4 // 8
|
||||
#define NR_MAX_NB_CODEWORDS 2
|
||||
#define NR_MAX_NB_HARQ_PROCESSES 16
|
||||
#define NR_MAX_PDSCH_ENCODED_LENGTH (NR_MAX_NB_RB*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS) // 8 is the maximum modulation order (it was 950984 before !!)
|
||||
#define NR_MAX_PUSCH_ENCODED_LENGTH NR_MAX_PDSCH_ENCODED_LENGTH
|
||||
|
||||
#define NR_MAX_PDSCH_TBS 3824
|
||||
#define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits.
|
||||
|
||||
#define MAX_NUM_NR_DLSCH_SEGMENTS (NR_MAX_NB_LAYERS*34)
|
||||
#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056)
|
||||
#define MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER 34
|
||||
|
||||
#define MAX_NUM_NR_ULSCH_SEGMENTS 34
|
||||
#define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_ULSCH_SEGMENTS*1056)
|
||||
|
||||
@@ -644,7 +644,7 @@ int main(int argc, char **argv)
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
printf("gNB %d\n", i);
|
||||
free_gNB_dlsch(&(msgDataTx.dlsch[0][i]),N_RB_DL);
|
||||
free_gNB_dlsch(&(msgDataTx.dlsch[0][i]),N_RB_DL,frame_parms);
|
||||
printf("UE %d\n", i);
|
||||
free_nr_ue_dlsch(&(UE->dlsch[0][0][i]),N_RB_DL);
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req];
|
||||
|
||||
// Data to be transmitted
|
||||
bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||
bzero(tx_req->TLVs[0].value.direct,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*1056);
|
||||
memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length);
|
||||
|
||||
tx_req->PDU_length = TBS;
|
||||
|
||||
@@ -56,8 +56,6 @@ extern RAN_CONTEXT_t RC;
|
||||
const uint8_t nr_rv_round_map[4] = {0, 2, 3, 1};
|
||||
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
|
||||
|
||||
//uint8_t mac_pdu[MAX_NR_DLSCH_PAYLOAD_BYTES];
|
||||
|
||||
/*Scheduling of DLSCH with associated DCI in common search space
|
||||
* current version has only a DCI for type 1 PDCCH for C_RNTI*/
|
||||
void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
|
||||
Reference in New Issue
Block a user