From 0263b4a807f24ce67ab4420534fd19c1621456dc Mon Sep 17 00:00:00 2001 From: Tsung Yu Chan Date: Tue, 19 Sep 2023 17:35:38 +0200 Subject: [PATCH] chore / remove the unused variable --- .../PHY/NR_TRANSPORT/nr_transport_proto.h | 13 -- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 10 - .../PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 216 +++++++----------- openair1/PHY/defs_gNB.h | 5 - openair1/SIMULATION/NR_PHY/ulsim.c | 30 +-- 5 files changed, 93 insertions(+), 181 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index 2c7d7a7d3e..2583996b95 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -131,19 +131,6 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB, uint8_t slot, unsigned char harq_pid); -/** \brief This function computes the average channel level over all allocated RBs and antennas (TX/RX) in order to compute output shift for compensated signal - @param ul_ch_estimates_ext Channel estimates in allocated RBs - @param frame_parms Pointer to frame descriptor - @param avg Pointer to average signal strength - @param pilots_flag Flag to indicate pilots in symbol -*/ -void nr_ulsch_channel_level(int **ul_ch_estimates_ext, - NR_DL_FRAME_PARMS *frame_parms, - int32_t *avg, - uint8_t symbol, - uint32_t len, - uint8_t nrOfLayers); - /*! \brief This function implements the idft transform precoding in PUSCH \param z Pointer to input in frequnecy domain, and it is also the output in time domain diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 69015660d8..99218749a4 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -122,7 +122,6 @@ NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL) static void nr_processULSegment(void *arg) { ldpcDecode_t *rdata = (ldpcDecode_t *)arg; - PHY_VARS_gNB *phy_vars_gNB = rdata->gNB; NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq; t_nrLDPC_dec_params *p_decoderParms = &rdata->decoderParms; int length_dec; @@ -156,8 +155,6 @@ static void nr_processULSegment(void *arg) t_nrLDPC_time_stats procTime = {0}; t_nrLDPC_time_stats *p_procTime = &procTime; - // start_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); - //////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// nr_deinterleaving_ldpc /////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// @@ -172,7 +169,6 @@ static void nr_processULSegment(void *arg) // for (int i =0; i<16; i++) // printf("rx output deinterleaving w[%d]= %d r_offset %d\n", i,ulsch_harq->w[r][i], r_offset); - stop_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); ////////////////////////////////////////////////////////////////////////////////////////// @@ -182,7 +178,6 @@ static void nr_processULSegment(void *arg) ///////////////////////// ulsch_harq->e =====> ulsch_harq->d ///////////////////////// - // start_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); if (nr_rate_matching_ldpc_rx(rdata->tbslbrm, p_decoderParms->BG, @@ -196,13 +191,10 @@ static void nr_processULSegment(void *arg) ulsch_harq->F, Kr - ulsch_harq->F - 2 * (p_decoderParms->Z)) == -1) { - stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); LOG_E(PHY, "ulsch_decoding.c: Problem in rate_matching\n"); rdata->decodeIterations = max_ldpc_iterations + 1; return; - } else { - stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); } ulsch_harq->d_to_be_cleared[r] = false; @@ -221,7 +213,6 @@ static void nr_processULSegment(void *arg) length_dec = (ulsch_harq->B + 24 * ulsch_harq->C) / ulsch_harq->C; } - // start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); // set first 2*Z_c bits to zeros memset(&z[0], 0, 2 * ulsch_harq->Z * sizeof(int16_t)); @@ -248,7 +239,6 @@ static void nr_processULSegment(void *arg) if (rdata->decodeIterations <= p_decoderParms->numMaxIter) memcpy(ulsch_harq->c[r],llrProcBuf, Kr>>3); - //stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); } int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 45070b47dd..22f3fd4a51 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -287,7 +287,6 @@ static void nr_ulsch_extract_rbs (c16_t* const rxdataF, nfapi_nr_pusch_pdu_t *pusch_pdu, NR_DL_FRAME_PARMS *frame_parms) { - uint8_t delta = 0; int start_re = (frame_parms->first_carrier_offset + (pusch_pdu->rb_start + pusch_pdu->bwp_start) * NR_NB_SC_PER_RB)%frame_parms->ofdm_symbol_size; @@ -380,14 +379,14 @@ static void nr_ulsch_extract_rbs (c16_t* const rxdataF, } } -void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, - NR_DL_FRAME_PARMS *frame_parms, - uint8_t symbol, - uint8_t is_dmrs_symbol, - uint32_t len, - uint8_t nrOfLayers, - unsigned short nb_rb, - int shift_ch_ext) +static void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, + NR_DL_FRAME_PARMS *frame_parms, + uint8_t symbol, + uint8_t is_dmrs_symbol, + uint32_t len, + uint8_t nrOfLayers, + unsigned short nb_rb, + int shift_ch_ext) { // Determine scaling amplitude based the symbol int b = 3; @@ -415,7 +414,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, } } -int get_nb_re_pusch (NR_DL_FRAME_PARMS *frame_parms, nfapi_nr_pusch_pdu_t *rel15_ul,int symbol) +static int get_nb_re_pusch (NR_DL_FRAME_PARMS *frame_parms, nfapi_nr_pusch_pdu_t *rel15_ul,int symbol) { uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01; if (dmrs_symbol_flag == 1) { @@ -431,13 +430,13 @@ int get_nb_re_pusch (NR_DL_FRAME_PARMS *frame_parms, nfapi_nr_pusch_pdu_t *rel15 } else return(rel15_ul->rb_size * NR_NB_SC_PER_RB); } -//compute average channel_level on each (TX,RX) antenna pair -void nr_ulsch_channel_level(int **ul_ch_estimates_ext, - NR_DL_FRAME_PARMS *frame_parms, - int32_t *avg, - uint8_t symbol, - uint32_t len, - uint8_t nrOfLayers) +// compute average channel_level on each (TX,RX) antenna pair +static void nr_ulsch_channel_level(int **ul_ch_estimates_ext, + NR_DL_FRAME_PARMS *frame_parms, + int32_t *avg, + uint8_t symbol, + uint32_t len, + uint8_t nrOfLayers) { simde__m128i *ul_ch128, avg128U; @@ -466,18 +465,18 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext, simde_m_empty(); } -void nr_ulsch_channel_compensation(c16_t *rxFext, - c16_t *chFext, - c16_t *ul_ch_maga, - c16_t *ul_ch_magb, - c16_t *ul_ch_magc, - int32_t **rxComp, - c16_t *rho, - NR_DL_FRAME_PARMS *frame_parms, - nfapi_nr_pusch_pdu_t* rel15_ul, - uint32_t symbol, - uint32_t buffer_length, - uint32_t output_shift) +static void nr_ulsch_channel_compensation(c16_t *rxFext, + c16_t *chFext, + c16_t *ul_ch_maga, + c16_t *ul_ch_magb, + c16_t *ul_ch_magc, + int32_t **rxComp, + c16_t *rho, + NR_DL_FRAME_PARMS *frame_parms, + nfapi_nr_pusch_pdu_t* rel15_ul, + uint32_t symbol, + uint32_t buffer_length, + uint32_t output_shift) { int mod_order = rel15_ul->qam_mod_order; int nrOfLayers = rel15_ul->nrOfLayers; @@ -578,14 +577,14 @@ void nr_ulsch_channel_compensation(c16_t *rxFext, } // Zero Forcing Rx function: nr_det_HhH() -void nr_ulsch_det_HhH (int32_t *after_mf_00,//a - int32_t *after_mf_01,//b - int32_t *after_mf_10,//c - int32_t *after_mf_11,//d - int32_t *det_fin,//1/ad-bc - unsigned short nb_rb, - unsigned char symbol, - int32_t shift) +static void nr_ulsch_det_HhH (int32_t *after_mf_00,//a + int32_t *after_mf_01,//b + int32_t *after_mf_10,//c + int32_t *after_mf_11,//d + int32_t *det_fin,//1/ad-bc + unsigned short nb_rb, + unsigned char symbol, + int32_t shift) { int16_t nr_conjug2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ; unsigned short rb; @@ -640,53 +639,15 @@ void nr_ulsch_det_HhH (int32_t *after_mf_00,//a simde_m_empty(); } -/* Zero Forcing Rx function: nr_inv_comp_muli - * Complex number multi: z = x*y - * = (x_re*y_re - x_im*y_im) + j(x_im*y_re + x_re*y_im) - * */ -simde__m128i nr_ulsch_inv_comp_muli(simde__m128i input_x, - simde__m128i input_y) -{ - int16_t nr_conjug2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ; - - simde__m128i xy_re_128, xy_im_128; - simde__m128i output_z, tmp_z0, tmp_z1; - - // complex multiplication (x_re + jx_im)*(y_re + jy_im) = (x_re*y_re - x_im*y_im) + j(x_im*y_re + x_re*y_im) - - // the real part - xy_re_128 = simde_mm_sign_epi16(input_x,*(simde__m128i*)&nr_conjug2[0]); - xy_re_128 = simde_mm_madd_epi16(xy_re_128,input_y); //Re: (x_re*y_re - x_im*y_im) - - // the imag part - xy_im_128 = simde_mm_shufflelo_epi16(input_x, SIMDE_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits - xy_im_128 = simde_mm_shufflehi_epi16(xy_im_128, SIMDE_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits - xy_im_128 = simde_mm_madd_epi16(xy_im_128,input_y);//Im: (x_im*y_re + x_re*y_im) - - //convert back to Q15 before packing - xy_re_128 = simde_mm_srai_epi32(xy_re_128,4);//(2^15/64*2*16) - xy_im_128 = simde_mm_srai_epi32(xy_im_128,4); - - tmp_z0 = simde_mm_unpacklo_epi32(xy_re_128,xy_im_128); - //print_ints("unpack lo:",&tmp_z0[0]); - tmp_z1 = simde_mm_unpackhi_epi32(xy_re_128,xy_im_128); - //print_ints("unpack hi:",&tmp_z1[0]); - output_z = simde_mm_packs_epi32(tmp_z0,tmp_z1); - - simde_mm_empty(); - simde_m_empty(); - return(output_z); -} - /* Zero Forcing Rx function: nr_conjch0_mult_ch1() * * * */ -void nr_ulsch_conjch0_mult_ch1(int *ch0, - int *ch1, - int32_t *ch0conj_ch1, - unsigned short nb_rb, - unsigned char output_shift0) +static void nr_ulsch_conjch0_mult_ch1(int *ch0, + int *ch1, + int32_t *ch0conj_ch1, + unsigned short nb_rb, + unsigned char output_shift0) { //This function is used to compute multiplications in H_hermitian * H matrix short nr_conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; @@ -724,11 +685,12 @@ void nr_ulsch_conjch0_mult_ch1(int *ch0, simde_mm_empty(); simde_m_empty(); } -simde__m128i nr_ulsch_comp_muli_sum(simde__m128i input_x, - simde__m128i input_y, - simde__m128i input_w, - simde__m128i input_z, - simde__m128i det) + +static simde__m128i nr_ulsch_comp_muli_sum(simde__m128i input_x, + simde__m128i input_y, + simde__m128i input_w, + simde__m128i input_z, + simde__m128i det) { int16_t nr_conjug2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ; @@ -786,32 +748,33 @@ simde__m128i nr_ulsch_comp_muli_sum(simde__m128i input_x, simde_m_empty(); return(output); } + /* Zero Forcing Rx function: nr_construct_HhH_elements() * * * */ -void nr_ulsch_construct_HhH_elements(int *conjch00_ch00, - int *conjch01_ch01, - int *conjch11_ch11, - int *conjch10_ch10,// - int *conjch20_ch20, - int *conjch21_ch21, - int *conjch30_ch30, - int *conjch31_ch31, - int *conjch00_ch01,//00_01 - int *conjch01_ch00,//01_00 - int *conjch10_ch11,//10_11 - int *conjch11_ch10,//11_10 - int *conjch20_ch21, - int *conjch21_ch20, - int *conjch30_ch31, - int *conjch31_ch30, - int32_t *after_mf_00, - int32_t *after_mf_01, - int32_t *after_mf_10, - int32_t *after_mf_11, - unsigned short nb_rb, - unsigned char symbol) +static void nr_ulsch_construct_HhH_elements(int *conjch00_ch00, + int *conjch01_ch01, + int *conjch11_ch11, + int *conjch10_ch10,// + int *conjch20_ch20, + int *conjch21_ch21, + int *conjch30_ch30, + int *conjch31_ch31, + int *conjch00_ch01,//00_01 + int *conjch01_ch00,//01_00 + int *conjch10_ch11,//10_11 + int *conjch11_ch10,//11_10 + int *conjch20_ch21, + int *conjch21_ch20, + int *conjch30_ch31, + int *conjch31_ch30, + int32_t *after_mf_00, + int32_t *after_mf_01, + int32_t *after_mf_10, + int32_t *after_mf_11, + unsigned short nb_rb, + unsigned char symbol) { //This function is used to construct the (H_hermitian * H matrix) matrix elements unsigned short rb; @@ -903,23 +866,21 @@ void nr_ulsch_construct_HhH_elements(int *conjch00_ch00, simde_m_empty(); } -/* - * MMSE Rx function: nr_ulsch_mmse_2layers() - */ -uint8_t nr_ulsch_mmse_2layers(NR_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **ul_ch_mag, - int **ul_ch_magb, - int **ul_ch_magc, - int **ul_ch_estimates_ext, - unsigned short nb_rb, - unsigned char n_rx, - unsigned char mod_order, - int shift, - unsigned char symbol, - int length, - uint32_t noise_var, - uint32_t buffer_length) +// MMSE Rx function: nr_ulsch_mmse_2layers() +static uint8_t nr_ulsch_mmse_2layers(NR_DL_FRAME_PARMS *frame_parms, + int **rxdataF_comp, + int **ul_ch_mag, + int **ul_ch_magb, + int **ul_ch_magc, + int **ul_ch_estimates_ext, + unsigned short nb_rb, + unsigned char n_rx, + unsigned char mod_order, + int shift, + unsigned char symbol, + int length, + uint32_t noise_var, + uint32_t buffer_length) { int *ch00, *ch01, *ch10, *ch11; int *ch20, *ch30, *ch21, *ch31; @@ -1432,7 +1393,7 @@ static void inner_rx (PHY_VARS_gNB *gNB, rel15_ul->qam_mod_order); } -void nr_pusch_symbol_processing(void *arg) +static void nr_pusch_symbol_processing(void *arg) { puschSymbolProc_t *rdata=(puschSymbolProc_t*)arg; @@ -1617,7 +1578,6 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB, AssertFatal(nb_re_pusch>0 && meas_symbol>=0,"nb_re_pusch %d cannot be 0 or meas_symbol %d cannot be negative here\n",nb_re_pusch,meas_symbol); - start_meas(&gNB->ulsch_rbs_extraction_stats); // extract the first dmrs for the channel level computation // extract the data in the OFDM frame, to the start of the array int soffset = (slot&3)*frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size; @@ -1638,8 +1598,6 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB, rel15_ul, frame_parms); - stop_meas(&gNB->ulsch_rbs_extraction_stats); - int avgs = 0; int avg[frame_parms->nb_antennas_rx*rel15_ul->nrOfLayers]; uint8_t shift_ch_ext = rel15_ul->nrOfLayers > 1 ? log2_approx(max_ch >> 11) : 0; @@ -1723,7 +1681,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB, } } // symbol loop - while (gNB->nbSymb > 0 && !(rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS)) { + while (gNB->nbSymb > 0) { notifiedFIFO_elt_t *req = pullTpool(&gNB->respPuschSymb, &gNB->threadPool); gNB->nbSymb--; delNotifiedFIFO_elt(req); diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index a28e4a30f4..83040cb0e0 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -736,12 +736,7 @@ typedef struct PHY_VARS_gNB_s { time_stats_t ulsch_rate_unmatching_stats; time_stats_t ulsch_ldpc_decoding_stats; time_stats_t ulsch_deinterleaving_stats; - time_stats_t ulsch_unscrambling_stats; time_stats_t ulsch_channel_estimation_stats; - time_stats_t ulsch_ptrs_processing_stats; - time_stats_t ulsch_channel_compensation_stats; - time_stats_t ulsch_rbs_extraction_stats; - time_stats_t ulsch_mrc_stats; time_stats_t ulsch_llr_stats; time_stats_t rx_srs_stats; time_stats_t generate_srs_stats; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 5c3abe09be..762487c759 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -721,7 +721,6 @@ int main(int argc, char *argv[]) NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id]; - // nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_process->ulsch_pdu; NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO)); memset((void*)Sched_INFO,0,sizeof(*Sched_INFO)); nfapi_nr_ul_tti_request_t *UL_tti_req = &Sched_INFO->UL_tti_req; @@ -932,14 +931,7 @@ int main(int argc, char *argv[]) reset_meas(&gNB->rx_pusch_init_stats); reset_meas(&gNB->rx_pusch_symbol_processing_stats); reset_meas(&gNB->ulsch_decoding_stats); - reset_meas(&gNB->ulsch_deinterleaving_stats); - reset_meas(&gNB->ulsch_rate_unmatching_stats); - reset_meas(&gNB->ulsch_ldpc_decoding_stats); - reset_meas(&gNB->ulsch_unscrambling_stats); reset_meas(&gNB->ulsch_channel_estimation_stats); - reset_meas(&gNB->ulsch_llr_stats); - reset_meas(&gNB->ulsch_channel_compensation_stats); - reset_meas(&gNB->ulsch_rbs_extraction_stats); reset_meas(&UE->ulsch_ldpc_encoding_stats); reset_meas(&UE->ulsch_rate_matching_stats); reset_meas(&UE->ulsch_interleaving_stats); @@ -1595,23 +1587,13 @@ int main(int argc, char *argv[]) if (print_perf==1) { printf("gNB RX\n"); - printDistribution(&gNB->phy_proc_rx,table_rx,"Total PHY proc rx"); - printStatIndent(&gNB->rx_pusch_stats,"RX PUSCH time"); - printStatIndent2(&gNB->ulsch_channel_estimation_stats,"ULSCH channel estimation time"); - printStatIndent2(&gNB->rx_pusch_init_stats,"RX PUSCH Initialization time"); - printStatIndent2(&gNB->rx_pusch_symbol_processing_stats,"RX PUSCH Symbol Processing time"); - - // printStatIndent2(&gNB->ulsch_ptrs_processing_stats,"ULSCH PTRS Processing time"); - // printStatIndent2(&gNB->ulsch_rbs_extraction_stats,"ULSCH rbs extraction time"); - // printStatIndent2(&gNB->ulsch_channel_compensation_stats,"ULSCH channel compensation time"); - // printStatIndent2(&gNB->ulsch_mrc_stats,"ULSCH mrc computation"); - // printStatIndent2(&gNB->ulsch_llr_stats,"ULSCH llr computation"); - // printStatIndent(&gNB->ulsch_unscrambling_stats,"ULSCH unscrambling"); - + printDistribution(&gNB->phy_proc_rx,table_rx, "Total PHY proc rx"); + printStatIndent(&gNB->rx_pusch_stats, "RX PUSCH time"); + printStatIndent2(&gNB->ulsch_channel_estimation_stats, "ULSCH channel estimation time"); + printStatIndent2(&gNB->rx_pusch_init_stats, "RX PUSCH Initialization time"); + printStatIndent2(&gNB->rx_pusch_symbol_processing_stats, "RX PUSCH Symbol Processing time"); printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time"); - // printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving"); - // printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx"); - // printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding"); + printf("\nUE TX\n"); printStatIndent(&UE->ulsch_encoding_stats,"ULSCH total encoding time"); printStatIndent2(&UE->ulsch_segmentation_stats,"ULSCH segmentation time");