Commit d36549f8 authored by francescomani's avatar francescomani

fix memory issues

parent 07d20ba1
...@@ -1324,7 +1324,7 @@ ...@@ -1324,7 +1324,7 @@
-n100 -s5 -T 2 1 2 -U 2 0 2 -n100 -s5 -T 2 1 2 -U 2 0 2
-n100 -s5 -T 2 2 2 -U 2 1 2 -n100 -s5 -T 2 2 2 -U 2 1 2
-n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3 -n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3
-n100 -s5 -Z -n100 -Z -s5
-n100 -s5 -Z -r75 -n100 -s5 -Z -r75
-n50 -s5 -Z -r216 -R217 -n50 -s5 -Z -r216 -R217
-n50 -s5 -Z -r270 -R273 -n50 -s5 -Z -r270 -R273
......
...@@ -285,7 +285,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -285,7 +285,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
for (i=0; i<Prx; i++) { for (i=0; i<Prx; i++) {
pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot ); pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
pusch_vars[ULSCH_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot ); pusch_vars[ULSCH_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
pusch_vars[ULSCH_id]->rho[i] = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*NR_MAX_NB_LAYERS*sizeof(int32_t*)); pusch_vars[ULSCH_id]->rho[i] = (int32_t **)malloc16_clear(NR_MAX_NB_LAYERS*NR_MAX_NB_LAYERS*sizeof(int32_t*));
for (int j=0; j< max_ul_mimo_layers; j++) { for (int j=0; j< max_ul_mimo_layers; j++) {
for (int k=0; k<max_ul_mimo_layers; k++) { for (int k=0; k<max_ul_mimo_layers; k++) {
...@@ -416,9 +416,15 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -416,9 +416,15 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
NR_gNB_PUSCH** pusch_vars = gNB->pusch_vars; NR_gNB_PUSCH** pusch_vars = gNB->pusch_vars;
for (int ULSCH_id=0; ULSCH_id<gNB->number_of_nr_ulsch_max; ULSCH_id++) { for (int ULSCH_id=0; ULSCH_id<gNB->number_of_nr_ulsch_max; ULSCH_id++) {
for (int i=0; i< max_ul_mimo_layers; i++)
free_and_zero(pusch_vars[ULSCH_id]->llr_layers[i]);
for (int i = 0; i < Prx; i++) { for (int i = 0; i < Prx; i++) {
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]); free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]); free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]);
for (int j=0; j< max_ul_mimo_layers; j++) {
for (int k=0; k<max_ul_mimo_layers; k++)
free_and_zero(pusch_vars[ULSCH_id]->rho[i][j*max_ul_mimo_layers+k]);
}
free_and_zero(pusch_vars[ULSCH_id]->rho[i]); free_and_zero(pusch_vars[ULSCH_id]->rho[i]);
} }
for (int i = 0; i < n_buf; i++) { for (int i = 0; i < n_buf; i++) {
...@@ -434,6 +440,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -434,6 +440,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag[i]); free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag[i]);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb[i]); free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb[i]);
} }
free_and_zero(pusch_vars[ULSCH_id]->llr_layers);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext); free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2); free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates); free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates);
......
...@@ -52,6 +52,7 @@ void nr_codeword_scrambling(uint8_t *in, ...@@ -52,6 +52,7 @@ void nr_codeword_scrambling(uint8_t *in,
((uint16_t*)&in32)[0] = _mm_movemask_epi8(_mm_slli_epi16(in128[0],7)); ((uint16_t*)&in32)[0] = _mm_movemask_epi8(_mm_slli_epi16(in128[0],7));
((uint16_t*)&in32)[1] = _mm_movemask_epi8(_mm_slli_epi16(in128[1],7)); ((uint16_t*)&in32)[1] = _mm_movemask_epi8(_mm_slli_epi16(in128[1],7));
out[i]=(in32^s); out[i]=(in32^s);
LOG_D(PHY,"in[%d] %x => %x\n",i,in32,out[i]);
s=lte_gold_generic(&x1, &x2, 0); s=lte_gold_generic(&x1, &x2, 0);
} }
//#elsif defined(__arm__) || defined(__aarch64) //#elsif defined(__arm__) || defined(__aarch64)
......
...@@ -318,7 +318,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ...@@ -318,7 +318,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
printf("start ldpc encoder segment %d/%d\n",r,harq_process->C); printf("start ldpc encoder segment %d/%d\n",r,harq_process->C);
printf("input %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("input %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]);
for (int cnt =0 ; cnt < 22*(*pz)/8; cnt ++){ for (int cnt =0 ; cnt < 22*(*pz)/8; cnt ++){
printf("%d ", harq_process->c[r][cnt]); printf("%d ", harq_process->c[r][cnt]);
} }
printf("\n"); printf("\n");
......
...@@ -114,7 +114,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -114,7 +114,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); LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
uint32_t available_bits;
int8_t Wf[2], Wt[2]; int8_t Wf[2], Wt[2];
int l_prime[2], delta; int l_prime[2], delta;
uint8_t nb_dmrs_re_per_rb; uint8_t nb_dmrs_re_per_rb;
...@@ -183,7 +182,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -183,7 +182,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH scrambling///////////////////////// /////////////////////////ULSCH scrambling/////////////////////////
/////////// ///////////
available_bits = G; uint32_t available_bits = G;
uint32_t scrambled_output[(available_bits>>5)+1]; uint32_t scrambled_output[(available_bits>>5)+1];
memset(scrambled_output, 0, ((available_bits>>5)+1)*sizeof(uint32_t)); memset(scrambled_output, 0, ((available_bits>>5)+1)*sizeof(uint32_t));
...@@ -200,7 +199,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -200,7 +199,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH modulation///////////////////////// /////////////////////////ULSCH modulation/////////////////////////
/////////// ///////////
int max_num_re = number_of_symbols*nb_rb*NR_NB_SC_PER_RB; int max_num_re = Nl*number_of_symbols*nb_rb*NR_NB_SC_PER_RB;
int32_t d_mod[max_num_re] __attribute__ ((aligned(16))); int32_t d_mod[max_num_re] __attribute__ ((aligned(16)));
nr_modulation(scrambled_output, // assume one codeword for the moment nr_modulation(scrambled_output, // assume one codeword for the moment
...@@ -340,7 +339,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -340,7 +339,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH RE mapping///////////////////////// /////////////////////////ULSCH RE mapping/////////////////////////
/////////// ///////////
int encoded_length = frame_parms->N_RB_UL*number_of_symbols*NR_NB_SC_PER_RB*mod_order*Nl; int encoded_length = frame_parms->N_RB_UL*14*NR_NB_SC_PER_RB*mod_order*Nl;
int16_t **tx_precoding = (int16_t **)malloc16_clear(Nl*sizeof(int16_t *)); int16_t **tx_precoding = (int16_t **)malloc16_clear(Nl*sizeof(int16_t *));
for (int nl=0; nl<Nl; nl++) for (int nl=0; nl<Nl; nl++)
tx_precoding[nl] = (int16_t *)malloc16_clear((encoded_length<<1)*sizeof(int16_t)); tx_precoding[nl] = (int16_t *)malloc16_clear((encoded_length<<1)*sizeof(int16_t));
......
...@@ -621,7 +621,7 @@ int main(int argc, char **argv) ...@@ -621,7 +621,7 @@ int main(int argc, char **argv)
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:3}, e.g. -U 2 0 2 \n"); printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:3}, e.g. -U 2 0 2 \n");
printf("-Q If -F used, read parameters from file\n"); printf("-Q If -F used, read parameters from file\n");
printf("-Z If -Z is used, SC-FDMA or transform precoding is enabled in Uplink \n"); printf("-Z If -Z is used, SC-FDMA or transform precoding is enabled in Uplink \n");
printf("-W Num of layer for PUSCH\n"); printf("-W Num of layer for PUSCH\n");
exit(-1); exit(-1);
break; break;
...@@ -1320,7 +1320,7 @@ int main(int argc, char **argv) ...@@ -1320,7 +1320,7 @@ int main(int argc, char **argv)
pusch_pdu->ul_dmrs_symb_pos); pusch_pdu->ul_dmrs_symb_pos);
ptrsSymbPerSlot = get_ptrs_symbols_in_slot(ptrsSymPos, pusch_pdu->start_symbol_index, pusch_pdu->nr_of_symbols); ptrsSymbPerSlot = get_ptrs_symbols_in_slot(ptrsSymPos, pusch_pdu->start_symbol_index, pusch_pdu->nr_of_symbols);
ptrsRePerSymb = ((pusch_pdu->rb_size + ptrs_freq_density - 1)/ptrs_freq_density); ptrsRePerSymb = ((pusch_pdu->rb_size + ptrs_freq_density - 1)/ptrs_freq_density);
printf("[ULSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb ); LOG_D(PHY,"[ULSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb );
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
......
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