diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index 3dc55ef1f6..86af5fb81c 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -549,10 +549,7 @@ void construct_HhH_elements(int *ch0conj_ch0, //00_00 } } - -void squared_matrix_element(int32_t *Hh_h_00, - int32_t *Hh_h_00_sq, - unsigned short nb_rb) +static void squared_matrix_element(int32_t *Hh_h_00, int32_t *Hh_h_00_sq, unsigned short nb_rb) { simde__m128i *Hh_h_00_128,*Hh_h_00_sq_128; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 9aa520c585..aff8a60e06 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -41,8 +41,6 @@ #include #include #include -#include -#include #include "linear_preprocessing_rec.h" //#define DEBUG_MMSE @@ -53,36 +51,283 @@ * default value: 0 */ int16_t dlsch_demod_shift = 0; -int16_t interf_unaw_shift = 13; +static const int16_t interf_unaw_shift = 13; unsigned char offset_mumimo_llr_drange_fix=0; -//inferference-free case -unsigned char interf_unaw_shift_tm4_mcs[29]= {5, 3, 4, 3, 3, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 0, - 1, 1, 1, 1, 0, 2, 1, 0, 1, 0, 1, 0, 0 - } ; -unsigned char interf_unaw_shift_tm1_mcs[29]= {5, 5, 4, 3, 3, 3, 2, 2, 4, 4, 2, 3, 3, 3, 1, 1, - 0, 1, 1, 2, 5, 4, 4, 6, 5, 1, 0, 5, 6 - } ; // mcs 21, 26, 28 seem to be errorneous +// inferference-free case -/* -//original values from sebastion + same hand tuning -unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{6,6,6},{6,6,6},{6,6,6},{5,5,5},{4,4,4},{1,2,4}, // QPSK -{5,5,4},{5,5,5},{5,5,5},{3,3,3},{2,2,2},{2,2,2},{2,2,2}, // 16-QAM -{2,2,1},{3,3,3},{3,3,3},{3,3,1},{2,2,2},{2,2,2},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; //64-QAM +static const unsigned char offset_mumimo_llr_drange[29][3] = { + {0, 6, 5}, {0, 4, 5}, {0, 4, 5}, {0, 5, 4}, {0, 5, 6}, {0, 5, 3}, {0, 4, 4}, {0, 4, 4}, {0, 3, 3}, {0, 1, 2}, + {1, 1, 0}, {1, 3, 2}, {3, 4, 1}, {2, 0, 0}, {2, 2, 2}, {1, 1, 1}, {2, 1, 0}, {2, 1, 1}, {1, 0, 1}, {1, 0, 1}, + {0, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 1, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; + +static void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars, + LTE_DL_FRAME_PARMS *frame_parms, + PHY_MEASUREMENTS *measurements, + unsigned char first_symbol_flag, + MIMO_mode_t mimo_mode, + unsigned short mmse_flag, + int noise_power, + unsigned char symbol, + unsigned short nb_rb); + +static void precode_channel_est(int32_t **dl_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + unsigned char symbol, + unsigned short nb_rb, + MIMO_mode_t mimo_mode); + +static void rxdataF_to_float(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_rx, int length, int start_point); +static void chan_est_to_float(int32_t **dl_ch_estimates_ext, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point); + +static void float_to_chan_est(int32_t **dl_ch_estimates_ext, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point); + +static void float_to_rxdataF(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_tx, int n_rx, int length, int start_point); + +static void mult_mmse_rxdataF(float complex **Wmmse, + float complex **rxdataF_ext_f, + int n_tx, + int n_rx, + int length, + int start_point); + +static void mult_mmse_chan_est(float complex **Wmmse, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point); + +static void mmse_processing_core(int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + int sigma2, + int n_tx, + int n_rx, + int length, + int start_point); + +static void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *lte_ue_pdsch_vars, + PHY_MEASUREMENTS *phy_measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order0, + unsigned char mod_order1, + int harq_pid, + int round, + MIMO_mode_t mimo_mode, + unsigned short nb_rb, + unsigned short mmse_flag, + unsigned char output_shift0, + unsigned char output_shift1); + +static void dlsch_channel_compensation_TM56(int **rxdataF_ext, + int **dl_ch_estimates_ext, + int **dl_ch_mag, + int **dl_ch_magb, + int **rxdataF_comp, + unsigned char *pmi_ext, + LTE_DL_FRAME_PARMS *frame_parms, + PHY_MEASUREMENTS *measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order, + unsigned short nb_rb, + unsigned char output_shift, + unsigned char dl_power_off); + +static void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, + unsigned char symbol, + unsigned short nb_rb, + int **dl_ch_estimates_ext, + int **dl_ch_estimates_ext_i, + int **dl_ch_rho_ext, + unsigned char output_shift); + +/** \fn dlsch_extract_rbs_single(int32_t **rxdataF, + int32_t **dl_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + uint16_t pmi, + uint8_t *pmi_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + LTE_DL_FRAME_PARMS *frame_parms) + \brief This function extracts the received resource blocks, both channel estimates and data symbols, + for the current allocation and for single antenna eNB transmission. + @param rxdataF Raw FFT output of received signal + @param dl_ch_estimates Channel estimates of current slot + @param rxdataF_ext FFT output for RBs in this allocation + @param dl_ch_estimates_ext Channel estimates for RBs in this allocation + @param pmi subband Precoding matrix indicator + @param pmi_ext Extracted PMI for chosen RBs + @param rb_alloc RB allocation vector + @param symbol Symbol to extract + @param subframe Subframe number + @param vrb_type Flag to indicate distributed VRB type + @param high_speed_flag + @param frame_parms Pointer to frame descriptor */ -/* -//first optimization try -unsigned char offset_mumimo_llr_drange[29][3]={{7, 8, 7},{6, 6, 7},{6, 6, 7},{6, 6, 6},{5, 6, 6},{5, 5, 6},{5, 5, 6},{4, 5, 4},{4, 3, 4},{3, 2, 2},{6, 5, 5},{5, 4, 4},{5, 5, 4},{3, 3, 2},{2, 2, 1},{2, 1, 1},{2, 2, 2},{3, 3, 3},{3, 3, 2},{3, 3, 2},{3, 2, 1},{2, 2, 2},{2, 2, 2},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; +static uint16_t dlsch_extract_rbs_single(int32_t **rxdataF, + int32_t **dl_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + uint16_t pmi, + uint8_t *pmi_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms); + +/** \fn dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **dl_ch_mag, + int32_t **dl_ch_magb, + uint8_t symbol, + uint16_t nb_rb) + \brief This function does Alamouti combining on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary + synchronization signals. + @param frame_parms Frame descriptor structure + @param rxdataF_comp Compensated channel output + @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be + performed on this as well. Result is stored in first antenna position + @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed + on this as well. Result is stored in first antenna position + @param symbol Symbol in sub-frame + @param nb_rb Number of RBs in this allocation */ -//second optimization try -/* - unsigned char offset_mumimo_llr_drange[29][3]={{5, 8, 7},{4, 6, 8},{3, 6, 7},{7, 7, 6},{4, 7, 8},{4, 7, 4},{6, 6, 6},{3, 6, 6},{3, 6, 6},{1, 3, 4},{1, 1, 0},{3, 3, 2},{3, 4, 1},{4, 0, 1},{4, 2, 2},{3, 1, 2},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; w +static void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **dl_ch_mag, + int32_t **dl_ch_magb, + uint8_t symbol, + uint16_t nb_rb); + +/** \fn dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **rho, + int32_t **rho_i, + int32_t **dl_ch_mag, + int32_t **dl_ch_magb, + uint8_t symbol, + uint16_t nb_rb, + uint8_t dual_stream_UE) + + \brief This function does maximal-ratio combining for dual-antenna receivers. + @param frame_parms Frame descriptor structure + @param rxdataF_comp Compensated channel output + @param rxdataF_comp_i Compensated channel output for interference + @param rho Cross correlation between spatial channels + @param rho_i Cross correlation between signal and inteference channels + @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be + performed on this as well. Result is stored in first antenna position + @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed + on this as well. Result is stored in first antenna position + @param symbol Symbol in sub-frame + @param nb_rb Number of RBs in this allocation + @param dual_stream_UE Flag to indicate dual-stream detection */ -unsigned char offset_mumimo_llr_drange[29][3]= {{0, 6, 5},{0, 4, 5},{0, 4, 5},{0, 5, 4},{0, 5, 6},{0, 5, 3},{0, 4, 4},{0, 4, 4},{0, 3, 3},{0, 1, 2},{1, 1, 0},{1, 3, 2},{3, 4, 1},{2, 0, 0},{2, 2, 2},{1, 1, 1},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; +static void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **rho, + int32_t **rho_i, + int32_t **dl_ch_mag, + int32_t **dl_ch_magb, + int32_t **dl_ch_mag_i, + int32_t **dl_ch_magb_i, + uint8_t symbol, + uint16_t nb_rb, + uint8_t dual_stream_UE); +static void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *lte_ue_pdsch_vars, + int harq_pid, + int round, + unsigned char symbol, + unsigned short nb_rb, + unsigned char dual_stream_UE); -extern void print_shorts(char *s,int16_t *x); +/** \fn dlsch_extract_rbs_dual(int32_t **rxdataF, + int32_t **dl_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + uint16_t pmi, + uint8_t *pmi_ext, + uint32_t *rb_alloc, + uint8_t symbol, + LTE_DL_FRAME_PARMS *frame_parms) + \brief This function extracts the received resource blocks, both channel estimates and data symbols, + for the current allocation and for dual antenna eNB transmission. + @param rxdataF Raw FFT output of received signal + @param dl_ch_estimates Channel estimates of current slot + @param rxdataF_ext FFT output for RBs in this allocation + @param dl_ch_estimates_ext Channel estimates for RBs in this allocation + @param pmi subband Precoding matrix indicator + @param pmi_ext Extracted PMI for chosen RBs + @param rb_alloc RB allocation vector + @param symbol Symbol to extract + @param subframe Subframe index + @param high_speed_flag + @param frame_parms Pointer to frame descriptor +*/ +static uint16_t dlsch_extract_rbs_dual(int32_t **rxdataF, + int32_t **dl_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + uint16_t pmi, + uint8_t *pmi_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms, + MIMO_mode_t mimo_mode); +/** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, + int32_t **dl_bf_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_bf_ch_estimates_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms) + \brief This function extracts the received resource blocks, both channel estimates and data symbols, + for the current allocation and for single antenna eNB transmission. + @param rxdataF Raw FFT output of received signal + @param dl_bf_ch_estimates Beamforming channel estimates of current slot + @param rxdataF_ext FFT output for RBs in this allocation + @param dl_bf_ch_estimates_ext Beamforming channel estimates for RBs in this allocation + @param rb_alloc RB allocation vector + @param symbol Symbol to extract + @param subframe Subframe number + @param high_speed_flag + @param frame_parms Pointer to frame descriptor +*/ +static uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, + int32_t **dl_bf_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_bf_ch_estimates_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms); int rx_pdsch(PHY_VARS_UE *ue, PDSCH_t type, @@ -790,17 +1035,9 @@ int rx_pdsch(PHY_VARS_UE *ue, } // printf("Combining"); - if ((dlsch0_harq->mimo_mode == SISO) || - ((dlsch0_harq->mimo_mode >= UNIFORM_PRECODING11) && - (dlsch0_harq->mimo_mode <= PUSCH_PRECODING0)) || - (dlsch0_harq->mimo_mode == TM7)) { - /* - dlsch_siso(frame_parms, - pdsch_vars[eNB_id]->rxdataF_comp, - pdsch_vars[eNB_id_i]->rxdataF_comp, - symbol, - nb_rb); - */ + if ((dlsch0_harq->mimo_mode == SISO) + || ((dlsch0_harq->mimo_mode >= UNIFORM_PRECODING11) && (dlsch0_harq->mimo_mode <= PUSCH_PRECODING0)) + || (dlsch0_harq->mimo_mode == TM7)) { } else if (dlsch0_harq->mimo_mode == ALAMOUTI) { dlsch_alamouti(frame_parms, pdsch_vars[eNB_id]->rxdataF_comp0, @@ -1381,116 +1618,8 @@ void dlsch_channel_compensation(int **rxdataF_ext, } -void dlsch_channel_compensation_core(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - int **rho, - unsigned char n_tx, - unsigned char n_rx, - unsigned char mod_order, - unsigned char output_shift, - int length, - int start_point) - +static void prec2A_TM56_128(unsigned char pmi, simde__m128i *ch0, simde__m128i *ch1) { - unsigned short ii; - int length_mod8 = 0; - simde__m128i *dl_ch128,*dl_ch_mag128,*dl_ch_mag128b, *dl_ch128_2, *rxdataF128,*rxdataF_comp128,*rho128; - simde__m128i QAM_amp128={0}; - int aatx = 0, aarx = 0; - - for (aatx=0; aatx 1 ? n_rx : 2; - dl_ch128 = (simde__m128i *)&dl_ch_estimates_ext[aatx*x + aarx][start_point]; - dl_ch_mag128 = (simde__m128i *)&dl_ch_mag[aatx*x + aarx][start_point]; - dl_ch_mag128b = (simde__m128i *)&dl_ch_magb[aatx*x + aarx][start_point]; - rxdataF128 = (simde__m128i *)&rxdataF_ext[aarx][start_point]; - rxdataF_comp128 = (simde__m128i *)&rxdataF_comp[aatx*x + aarx][start_point]; - length_mod8 = length&7; - - if (length_mod8 == 0) { - for (ii=0; ii>3; ++ii) { - if (mod_order>2) { - simde__m128i mmtmpD0, mmtmpD1; - // get channel amplitude if not QPSK - mmtmpD0 = oai_mm_smadd(dl_ch128[0], dl_ch128[0], output_shift); - mmtmpD1 = oai_mm_smadd(dl_ch128[1], dl_ch128[1], output_shift); - mmtmpD0 = simde_mm_packs_epi32(mmtmpD0, mmtmpD1); - // store channel magnitude here in a new field of dlsch - dl_ch_mag128[0] = simde_mm_unpacklo_epi16(mmtmpD0, mmtmpD0); - dl_ch_mag128b[0] = dl_ch_mag128[0]; - dl_ch_mag128[0] = simde_mm_mulhi_epi16(dl_ch_mag128[0], QAM_amp128); - dl_ch_mag128[0] = simde_mm_slli_epi16(dl_ch_mag128[0], 1); - dl_ch_mag128[1] = simde_mm_unpackhi_epi16(mmtmpD0, mmtmpD0); - dl_ch_mag128b[1] = dl_ch_mag128[1]; - dl_ch_mag128[1] = simde_mm_mulhi_epi16(dl_ch_mag128[1], QAM_amp128); - dl_ch_mag128[1] = simde_mm_slli_epi16(dl_ch_mag128[1], 1); - dl_ch_mag128b[0] = simde_mm_mulhi_epi16(dl_ch_mag128b[0], QAM_amp128b); - dl_ch_mag128b[0] = simde_mm_slli_epi16(dl_ch_mag128b[0], 1); - dl_ch_mag128b[1] = simde_mm_mulhi_epi16(dl_ch_mag128b[1], QAM_amp128b); - dl_ch_mag128b[1] = simde_mm_slli_epi16(dl_ch_mag128b[1], 1); - } - - // multiply by conjugated channel - rxdataF_comp128[0] = oai_mm_cpx_mult_conj(dl_ch128[0], rxdataF128[0], output_shift); - rxdataF_comp128[1] = oai_mm_cpx_mult_conj(dl_ch128[1], rxdataF128[1], output_shift); - dl_ch128+=2; - dl_ch_mag128+=2; - dl_ch_mag128b+=2; - rxdataF128+=2; - rxdataF_comp128+=2; - } - } else { - printf ("Channel Compensation: Received number of subcarriers is not multiple of 8, \n" - "need to adapt the code!\n"); - } - } - } - - /*This part of code makes sense only for processing in 2x2 blocks*/ - if (rho) { - for (aarx=0; aarx>3; ++ii) { - // multiply by conjugated channel - rho128[0] = oai_mm_cpx_mult_conj(dl_ch128[0], dl_ch128_2[0], output_shift); - rho128[1] = oai_mm_cpx_mult_conj(dl_ch128[1], dl_ch128_2[1], output_shift); - dl_ch128+=2; - dl_ch128_2+=2; - rho128+=2; - } - } else { - printf ("Channel Compensation: Received number of subcarriers is not multiple of 8, \n" - "need to adapt the code!\n"); - } - } - } - -} - - -void prec2A_TM56_128(unsigned char pmi,simde__m128i *ch0,simde__m128i *ch1) { simde__m128i amp; amp = simde_mm_set1_epi16(ONE_OVER_SQRT2_Q15); @@ -1526,7 +1655,7 @@ void prec2A_TM56_128(unsigned char pmi,simde__m128i *ch0,simde__m128i *ch1) { // stream 1 .5(1,-1) .5(1,1) .5(1,-1) .5(1,1) // store "precoded" channel for stream 0 in ch0, stream 1 in ch1 -short TM3_prec[8]__attribute__((aligned(16))) = {1,1,-1,-1,1,1,-1,-1} ; +static const short TM3_prec[8] __attribute__((aligned(16))) = {1, 1, -1, -1, 1, 1, -1, -1}; void prec2A_TM3_128(simde__m128i *ch0,simde__m128i *ch1) { simde__m128i amp = simde_mm_set1_epi16(ONE_OVER_SQRT2_Q15); @@ -1558,7 +1687,8 @@ void prec2A_TM3_128(simde__m128i *ch0,simde__m128i *ch1) { // pmi = 0 => stream 0 (1,1), stream 1 (1,-1) // pmi = 1 => stream 0 (1,j), stream 2 (1,-j) -void prec2A_TM4_128(int pmi,simde__m128i *ch0,simde__m128i *ch1) { +static void prec2A_TM4_128(int pmi, simde__m128i *ch0, simde__m128i *ch1) +{ // sqrt(2) is already taken into account in computation sqrt_rho_a, sqrt_rho_b, //so divide by 2 is replaced by divide by sqrt(2). // printf ("demod pmi=%d\n", pmi); @@ -1595,20 +1725,21 @@ void prec2A_TM4_128(int pmi,simde__m128i *ch0,simde__m128i *ch1) { //print_shorts("prec2A_TM4 ch1 (end):",ch1); } -void dlsch_channel_compensation_TM56(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - unsigned char *pmi_ext, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order, - unsigned short nb_rb, - unsigned char output_shift, - unsigned char dl_power_off) { +static void dlsch_channel_compensation_TM56(int **rxdataF_ext, + int **dl_ch_estimates_ext, + int **dl_ch_mag, + int **dl_ch_magb, + int **rxdataF_comp, + unsigned char *pmi_ext, + LTE_DL_FRAME_PARMS *frame_parms, + PHY_MEASUREMENTS *measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order, + unsigned short nb_rb, + unsigned char output_shift, + unsigned char dl_power_off) +{ unsigned short rb,Nre; simde__m128i *dl_ch0_128,*dl_ch1_128,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128; unsigned char aarx=0,symbol_mod,pilots=0; @@ -1719,17 +1850,17 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext, } // rx_antennas measurements->precoded_cqi_dB[eNB_id][0] = dB_fixed2(precoded_signal_strength,measurements->n0_power_tot); - //printf("eNB_id %d, symbol %d: precoded CQI %d dB\n",eNB_id,symbol, - // measurements->precoded_cqi_dB[eNB_id][0]); - + // printf("eNB_id %d, symbol %d: precoded CQI %d dB\n",eNB_id,symbol, + // measurements->precoded_cqi_dB[eNB_id][0]); } -void precode_channel_est(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - unsigned char symbol, - unsigned short nb_rb, - MIMO_mode_t mimo_mode) { +static void precode_channel_est(int32_t **dl_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + unsigned char symbol, + unsigned short nb_rb, + MIMO_mode_t mimo_mode) +{ unsigned short rb; simde__m128i *dl_ch0_128,*dl_ch1_128; unsigned char aarx=0,symbol_mod,pilots=0; @@ -1788,20 +1919,21 @@ void precode_channel_est(int32_t **dl_ch_estimates_ext, } } -void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - PHY_MEASUREMENTS *measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order0, - unsigned char mod_order1, - int harq_pid, - int round, - MIMO_mode_t mimo_mode, - unsigned short nb_rb, - unsigned short mmse_flag, - unsigned char output_shift0, - unsigned char output_shift1) { +static void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + PHY_MEASUREMENTS *measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order0, + unsigned char mod_order1, + int harq_pid, + int round, + MIMO_mode_t mimo_mode, + unsigned short nb_rb, + unsigned short mmse_flag, + unsigned char output_shift0, + unsigned char output_shift1) +{ unsigned short rb,Nre; simde__m128i *dl_ch0_128,*dl_ch1_128,*dl_ch_mag0_128,*dl_ch_mag1_128,*dl_ch_mag0_128b,*dl_ch_mag1_128b,*rxdataF128,*rxdataF_comp0_128,*rxdataF_comp1_128; unsigned char aarx=0,symbol_mod,pilots=0; @@ -2017,7 +2149,6 @@ void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, // measurements->precoded_cqi_dB[eNB_id][0]); } - void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, unsigned char symbol, unsigned short nb_rb, @@ -2068,19 +2199,19 @@ void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, } - -void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **rho, - int **rho_i, - int **dl_ch_mag, - int **dl_ch_magb, - int **dl_ch_mag_i, - int **dl_ch_magb_i, - unsigned char symbol, - unsigned short nb_rb, - unsigned char dual_stream_UE) { +static void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, + int **rxdataF_comp, + int **rxdataF_comp_i, + int **rho, + int **rho_i, + int **dl_ch_mag, + int **dl_ch_magb, + int **dl_ch_mag_i, + int **dl_ch_magb_i, + unsigned char symbol, + unsigned short nb_rb, + unsigned char dual_stream_UE) +{ unsigned char aatx; int i; simde__m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*rxdataF_comp128_i0,*rxdataF_comp128_i1,*dl_ch_mag128_0,*dl_ch_mag128_1,*dl_ch_mag128_0b,*dl_ch_mag128_1b,*rho128_0,*rho128_1,*rho128_i0,*rho128_i1, @@ -2136,16 +2267,16 @@ void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, } } } - } -void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - int harq_pid, - int round, - unsigned char symbol, - unsigned short nb_rb, - unsigned char dual_stream_UE) { +static void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + int harq_pid, + int round, + unsigned char symbol, + unsigned short nb_rb, + unsigned char dual_stream_UE) +{ int i; simde__m128i *rxdataF_comp128_0,*rxdataF_comp128_1; simde__m128i *dl_ch_mag128_0,*dl_ch_mag128_1; @@ -2259,7 +2390,6 @@ void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, } } } - } void dlsch_scale_channel(int **dl_ch_estimates_ext, @@ -2462,15 +2592,16 @@ void dlsch_channel_level_median(int **dl_ch_estimates_ext, } -void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *measurements, - unsigned char first_symbol_flag, - MIMO_mode_t mimo_mode, - unsigned short mmse_flag, - int noise_power, - unsigned char symbol, - unsigned short nb_rb) { +static void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars, + LTE_DL_FRAME_PARMS *frame_parms, + PHY_MEASUREMENTS *measurements, + unsigned char first_symbol_flag, + MIMO_mode_t mimo_mode, + unsigned short mmse_flag, + int noise_power, + unsigned char symbol, + unsigned short nb_rb) +{ int **rxdataF_ext = pdsch_vars->rxdataF_ext; int **dl_ch_estimates_ext = pdsch_vars->dl_ch_estimates_ext; unsigned char *pmi_ext = pdsch_vars->pmi_ext; @@ -2617,107 +2748,6 @@ void mmse_processing_core(int32_t **rxdataF_ext, free(rxdataF_ext_flcpx); } - -/*THIS FUNCTION TAKES FLOAT_POINT INPUT. SHOULD NOT BE USED WITH OAI*/ -void mmse_processing_core_flp(float complex **rxdataF_ext_flcpx, - float complex **H, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - float noise_power, - int n_tx, - int n_rx, - int length, - int start_point) { - int aatx, aarx, re; - float max = 0; - float one_over_max = 0; - float complex **W_MMSE= malloc(n_tx*n_rx*sizeof(float complex *)); - - for (int j=0; j max) - max = fabs(creal(W_MMSE_re[aatx*n_rx + aarx])); - - if (fabs(cimag(W_MMSE_re[aatx*n_rx + aarx])) > max) - max = fabs(cimag(W_MMSE_re[aatx*n_rx + aarx])); - } - } - } - - one_over_max = 1.0/max; - - for (re=0; re> 16); - real = (int16_t) (rxdataF_ext[aarx][start_point + re] & 0xffff); +static void rxdataF_to_float(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_rx, int length, int start_point) +{ + for (int aarx = 0; aarx < n_rx; aarx++) { + for (int re = 0; re < length; re++) { + int16_t imag = (int16_t)(rxdataF_ext[aarx][start_point + re] >> 16); + int16_t real = (int16_t)(rxdataF_ext[aarx][start_point + re] & 0xffff); rxdataF_f[aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); #ifdef DEBUG_MMSE @@ -2820,24 +2842,18 @@ void rxdataF_to_float(int32_t **rxdataF_ext, } } - - -void chan_est_to_float(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point) { - short re; - int aatx,aarx; - int16_t imag; - int16_t real; - - for (aatx=0; aatx> 16); - real = (int16_t) (dl_ch_estimates_ext[aatx*n_rx + aarx][start_point+ re] & 0xffff); +static void chan_est_to_float(int32_t **dl_ch_estimates_ext, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point) +{ + for (int aatx = 0; aatx < n_tx; aatx++) { + for (int aarx = 0; aarx < n_rx; aarx++) { + for (int re = 0; re < length; re++) { + int16_t imag = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] >> 16); + int16_t real = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] & 0xffff); dl_ch_estimates_ext_f[aatx*n_rx + aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); #ifdef DEBUG_MMSE @@ -2857,15 +2873,12 @@ void float_to_chan_est(int32_t **dl_ch_estimates_ext, int n_tx, int n_rx, int length, - int start_point) { - short re; - int aarx, aatx; - int16_t imag; - int16_t real; - - for (aatx=0; aatx=1) @@ -2895,20 +2908,11 @@ void float_to_chan_est(int32_t **dl_ch_estimates_ext, } } - -void float_to_rxdataF(int32_t **rxdataF_ext, - float complex **rxdataF_f, - int n_tx, - int n_rx, - int length, - int start_point) { - short re; - int aarx; - int16_t imag; - int16_t real; - - for (aarx=0; aarx=1) @@ -2937,7 +2941,6 @@ void float_to_rxdataF(int32_t **rxdataF_ext, } } - void mult_mmse_rxdataF(float complex **Wmmse, float complex **rxdataF_ext_f, int n_tx, @@ -2946,9 +2949,9 @@ void mult_mmse_rxdataF(float complex **Wmmse, int start_point) { short re; int aarx, aatx; - float complex *rxdata_re = malloc(n_rx*sizeof(float complex)); - float complex *rxdata_mmse_re = malloc(n_rx*sizeof(float complex)); - float complex *Wmmse_re = malloc(n_tx*n_rx*sizeof(float complex)); + float complex rxdata_re[n_rx]; + float complex rxdata_mmse_re[n_rx]; + float complex Wmmse_re[n_tx][n_rx]; for (re=0; renb_antennas_rx); } -unsigned short dlsch_extract_rbs_dual(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned short pmi, - unsigned char *pmi_ext, - unsigned int *rb_alloc, - unsigned char symbol, - unsigned char subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode) { +static unsigned short dlsch_extract_rbs_dual(int **rxdataF, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned short pmi, + unsigned char *pmi_ext, + unsigned int *rb_alloc, + unsigned char symbol, + unsigned char subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms, + MIMO_mode_t mimo_mode) +{ int prb,nb_rb=0; int prb_off,prb_off2; int rb_alloc_ind,skip_half=0,sss_symb,pss_symb=0,nsymb,l; @@ -4369,15 +4370,16 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, return(nb_rb/frame_parms->nb_antennas_rx); } -unsigned short dlsch_extract_rbs_TM7(int **rxdataF, - int **dl_bf_ch_estimates, - int **rxdataF_ext, - int **dl_bf_ch_estimates_ext, - unsigned int *rb_alloc, - unsigned char symbol, - unsigned char subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms) { +static unsigned short dlsch_extract_rbs_TM7(int **rxdataF, + int **dl_bf_ch_estimates, + int **rxdataF_ext, + int **dl_bf_ch_estimates_ext, + unsigned int *rb_alloc, + unsigned char symbol, + unsigned char subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms) +{ unsigned short rb,nb_rb=0; unsigned char rb_alloc_ind; unsigned char i,aarx,l,nsymb,skip_half=0,sss_symb,pss_symb=0; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c index 86a4b93ddd..c1c1672088 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c @@ -20,253 +20,80 @@ data storage. */ //#define DEBUG_PREPROC #include "common/utils/utils.h" -void transpose (int N, float complex *A, float complex *Result) -{ - // COnputes C := alpha*op(A)*op(B) + beta*C, - CBLAS_TRANSPOSE transa = CblasTrans; - CBLAS_TRANSPOSE transb = CblasNoTrans; - int rows_opA = N; // number of rows in op(A) and in C - int col_opB = N; //number of columns of op(B) and in C - int col_opA = N; //number of columns in op(A) and rows in op(B) - int col_B; //number of columns in B - float complex alpha = 1.0+I*0; - int lda = rows_opA; - float complex beta = 0.0+I*0; - int ldc = rows_opA; - int i; - float complex* B; - - int ldb = col_opB; - - if (transb == CblasNoTrans) { - B = calloc_or_fail(ldb * col_opB, sizeof(float complex)); - col_B= col_opB; - } - else { - B = calloc_or_fail(ldb * col_opA, sizeof(float complex)); - col_B = col_opA; - } - float complex* C = malloc_or_fail(ldc * col_opB * sizeof(float complex)); - - for (i=0; i>2)*sizeof(float complex)); - float complex *H1_re = malloc_or_fail(n_rx*(n_tx>>2)*sizeof(float complex)); - float complex *R_corr_col_n_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *R_corr_col_n_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *U_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *U_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *U_0_herm_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *U_1_herm_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *D_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *D_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *W_Wh_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *W_Wh_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - - for (aatx=0; aatx>2), H1_re, sigma2, R_corr_col_n_0_re); - HH_herm_plus_sigma2I(n_rx, (n_tx>>2), H0_re, sigma2, R_corr_col_n_1_re); - - eigen_vectors_values(n_rx, R_corr_col_n_0_re, U_0_re, D_0_re); - eigen_vectors_values(n_rx, R_corr_col_n_1_re, U_1_re, D_1_re); - - transpose (n_rx, U_0_re, U_0_herm_re); - transpose (n_rx, U_1_re, U_1_herm_re); - - sigma = (float)(sqrt((double)(sigma2))); - - /*The inverse of a diagonal matrix is obtained by replacing each element in the diagonal with its reciprocal. - A square root of a diagonal matrix is given by the diagonal matrix, whose diagonal entries are just the square - roots of the original matrix.*/ - - - D_0_re_inv_sqrt[0] = sqrt_float(1/D_0_re_inv[0]); - D_0_re_inv_sqrt[5] = sqrt_float(1/D_0_re_inv[5]); - D_0_re_inv_sqrt[10] = sqrt_float(1/D_0_re_inv[10]); - D_0_re_inv_sqrt[15] = sqrt_float(1/D_0_re_inv[15]); - - D_1_re_inv[0] = sqrt_float(1/D_1_re_inv[0]); - D_1_re_inv[5] = sqrt_float(1/D_1_re_inv[5]); - D_1_re_inv[10] = sqrt_float(1/D_1_re_inv[10]); - D_1_re_inv[15] = sqrt_float(1/D_1_re_inv[15]); - - now only to multiply - - free(H0); - free(H1); - free(R_corr_col_n_0); - free(R_corr_col_n_1); -} -#endif - -float sqrt_float(float x, float sqrt_x) -{ - sqrt_x = (float)(sqrt((double)(x))); - return sqrt_x; } diff --git a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.h b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.h index f38bc47556..a8b955acfd 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.h @@ -5,117 +5,8 @@ #include #include "PHY/defs_UE.h" - /* FUNCTIONS FOR LINEAR PREPROCESSING: MMSE, WHITENNING, etc*/ -void transpose(int N, float complex *A, float complex *Result); - -void conjugate_transpose(int N, float complex *A, float complex *Result); - -void H_hermH_plus_sigma2I(int N, int M, float complex *A, float sigma2, float complex *Result); - -void HH_herm_plus_sigma2I(int M, int N, float complex *A, float sigma2, float complex *Result); - -void eigen_vectors_values(int N, float complex *A, float complex *Vectors, float *Values_Matrix); - -void lin_eq_solver(int N, float complex *A, float complex* B); -//float complex* lin_eq_solver (int N, float complex* A, float complex* B); - -/* mutl_matrix_matrix_row_based performs multiplications when matrix is row-oriented H[0], H[1]; H[2], H[3]*/ -void mutl_matrix_matrix_row_based(float complex* M0, float complex* M1, int rows_M0, int col_M0, int rows_M1, int col_M1, float complex* Result ); - /* mutl_matrix_matrix_col_based performs multiplications matrix is column-oriented H[0], H[2]; H[1], H[3]*/ void mutl_matrix_matrix_col_based(float complex* M0, float complex* M1, int rows_M0, int col_M0, int rows_M1, int col_M1, float complex* Result ); void compute_MMSE(float complex* H, int order_H, float sigma2, float complex* W_MMSE); - -void compute_white_filter(float complex* H, int order_H, float sigma2, float complex* U_1, float complex* D_1); - -void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *measurements, - unsigned char first_symbol_flag, - MIMO_mode_t mimo_mode, - unsigned short mmse_flag, - int noise_power, - unsigned char symbol, - unsigned short nb_rb); - - -void precode_channel_est(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - unsigned char symbol, - unsigned short nb_rb, - MIMO_mode_t mimo_mode); - - -void rxdataF_to_float(int32_t **rxdataF_ext, - float complex **rxdataF_f, - int n_rx, - int length, - int start_point); - -void chan_est_to_float(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void float_to_chan_est(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void float_to_rxdataF(int32_t **rxdataF_ext, - float complex **rxdataF_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void mult_mmse_rxdataF(float complex** Wmmse, - float complex** rxdataF_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void mult_mmse_chan_est(float complex** Wmmse, - float complex** dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void mmse_processing_core(int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - int sigma2, - int n_tx, - int n_rx, - int length, - int start_point); - -void mmse_processing_core_flp(float complex** rxdataF_ext_flcpx, - float complex **H, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - float sigma2, - int n_tx, - int n_rx, - int length, - int start_point); - -void whitening_processing_core_flp(float complex** rxdataF_ext_flcpx, - float complex **H, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - float sigma2, - int n_tx, - int n_rx, - int length, - int start_point); - -float sqrt_float(float x, float sqrt_x); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c index 81ddb264ff..14616c4259 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c @@ -50,49 +50,6 @@ #define MBSFN_FDD_SF7 0x08 #define MBSFN_FDD_SF8 0x04 - - -void dump_mch(PHY_VARS_UE *ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe) { - char fname[32],vname[32]; -#define NSYMB_PMCH 12 - sprintf(fname,"mch_rxF_ext0.m"); - sprintf(vname,"pmch_rxF_ext0"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0],12*(ue->frame_parms.N_RB_DL)*12,1,1); - sprintf(fname,"mch_ch_ext00.m"); - sprintf(vname,"pmch_ch_ext00"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1); - /* - LOG_M("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*NSYMB_PMCH,1,1); - LOG_M("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*NSYMB_PMCH,1,1); - LOG_M("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*NSYMB_PMCH,1,1); - LOG_M("dlsch%d_rho.m","dl_rho",pdsch_vars[eNB_id]->rho[0],12*N_RB_DL*NSYMB_PMCH,1,1); - */ - sprintf(fname,"mch_rxF_comp0.m"); - sprintf(vname,"pmch_rxF_comp0"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1); - sprintf(fname,"mch_rxF_llr.m"); - sprintf(vname,"pmch_llr"); - LOG_M(fname,vname, ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->llr[0],coded_bits_per_codeword,1,0); - sprintf(fname,"mch_mag1.m"); - sprintf(vname,"pmch_mag1"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1); - sprintf(fname,"mch_mag2.m"); - sprintf(vname,"pmch_mag2"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1); - LOG_M("mch00_ch0.m","pmch00_ch0", - &(ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0]), - ue->frame_parms.ofdm_symbol_size*12,1,1); - LOG_M("rxsig_mch.m","rxs_mch", - &ue->common_vars.rxdata[0][subframe*ue->frame_parms.samples_per_tti], - ue->frame_parms.samples_per_tti,1,1); - /* - if (PHY_vars_eNB_g) - LOG_M("txsig_mch.m","txs_mch", - &PHY_vars_eNB_g[0][0]->common_vars.txdata[0][0][subframe*ue->frame_parms.samples_per_tti], - ue->frame_parms.samples_per_tti,1,1);*/ -} - - void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id) { LTE_UE_DLSCH_t *dlsch = ue->dlsch_MCH[eNB_id]; LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index 06bf87fc74..8cf4020d2e 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -78,17 +78,6 @@ int rx_pmch_khz_1dot25(PHY_VARS_UE *ue, unsigned char symbol*/ ,int mcs); -/** \brief Dump OCTAVE/MATLAB files for PMCH debugging - @param phy_vars_ue Pointer to UE variables - @param eNB_id index of eNB in ue variables - @param coded_bits_per_codeword G from 36.211 - @param subframe Index of subframe - @returns 0 on success -*/ -void dump_mch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe); - - - /** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception. @param stream0_in Input from channel compensated (MR combined) stream 0 @param stream1_in Input from channel compensated (MR combined) stream 1 @@ -580,216 +569,6 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, uint32_t llr_offset, uint8_t beamforming_mode); - -/** \fn dlsch_siso(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - uint8_t l, - uint16_t nb_rb) - \brief This function does the first stage of llr computation for SISO, by just extracting the pilots, PBCH and primary/secondary synchronization sequences. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param l symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ - -void dlsch_siso(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - uint8_t l, - uint16_t nb_rb); - -/** \fn dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb) - \brief This function does Alamouti combining on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ -void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb); - -/** \fn dlsch_antcyc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb) - \brief This function does antenna selection (based on antenna cycling pattern) on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals. Note that this is not LTE, it is just included for comparison purposes. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ -void dlsch_antcyc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb); - -/** \fn dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho, - int32_t **rho_i, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb, - uint8_t dual_stream_UE) - - \brief This function does maximal-ratio combining for dual-antenna receivers. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho Cross correlation between spatial channels - @param rho_i Cross correlation between signal and inteference channels - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation - @param dual_stream_UE Flag to indicate dual-stream detection -*/ -void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho, - int32_t **rho_i, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - int32_t **dl_ch_mag_i, - int32_t **dl_ch_magb_i, - uint8_t symbol, - uint16_t nb_rb, - uint8_t dual_stream_UE); - -void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *lte_ue_pdsch_vars, - int harq_pid, - int round, - unsigned char symbol, - unsigned short nb_rb, - unsigned char dual_stream_UE); - -/** \fn dlsch_extract_rbs_single(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - LTE_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for single antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_ch_estimates Channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe number - @param vrb_type Flag to indicate distributed VRB type - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_single(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms); - -/** \fn dlsch_extract_rbs_dual(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - LTE_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for dual antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_ch_estimates Channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe index - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_dual(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode); - -/** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, - int32_t **dl_bf_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_bf_ch_estimates_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for single antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_bf_ch_estimates Beamforming channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_bf_ch_estimates_ext Beamforming channel estimates for RBs in this allocation - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe number - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, - int32_t **dl_bf_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_bf_ch_estimates_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms); - /** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation. In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation) @param rxdataF_ext Frequency-domain received signal in RBs to be demodulated @param dl_ch_estimates_ext Frequency-domain channel estimates in RBs to be demodulated @@ -819,35 +598,6 @@ void dlsch_channel_compensation(int32_t **rxdataF_ext, uint8_t output_shift, PHY_MEASUREMENTS *phy_measurements); -void dlsch_channel_compensation_core(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - int **rho, - unsigned char n_tx, - unsigned char n_rx, - unsigned char mod_order, - unsigned char output_shift, - int length, - int start_point); - -void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift); - -void dlsch_dual_stream_correlationTM34(LTE_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift0, - unsigned char output_shift1); //This function is used to compute multiplications in Hhermitian * H matrix void conjch0_mult_ch1(int *ch0, int *ch1, @@ -869,10 +619,6 @@ void construct_HhH_elements(int *ch0conj_ch0, int32_t *after_mf_11, unsigned short nb_rb); -void squared_matrix_element(int32_t *Hh_h_00, - int32_t *Hh_h_00_sq, - unsigned short nb_rb); - void dlsch_channel_level_TM34_meas(int *ch00, int *ch01, int *ch10, @@ -901,38 +647,6 @@ uint8_t rank_estimation_tm3_tm4(int *dl_ch_estimates_00, int *dl_ch_estimates_11, unsigned short nb_rb); -void dlsch_channel_compensation_TM56(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - unsigned char *pmi_ext, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *phy_measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order, - unsigned short nb_rb, - unsigned char output_shift, - unsigned char dl_power_off); - - -void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *lte_ue_pdsch_vars, - PHY_MEASUREMENTS *phy_measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order0, - unsigned char mod_order1, - int harq_pid, - int round, - MIMO_mode_t mimo_mode, - unsigned short nb_rb, - unsigned short mmse_flag, - unsigned char output_shift0, - unsigned char output_shift1); - - /** \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 dl_ch_estimates_ext Channel estimates in allocated RBs @param frame_parms Pointer to frame descriptor @@ -1669,12 +1383,6 @@ uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2nd uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode); -uint32_t dlsch_decoding_abstraction(double *dlsch_MIPB, - LTE_DL_FRAME_PARMS *lte_frame_parms, - LTE_UE_DLSCH_t *dlsch, - uint8_t subframe, - uint8_t num_pdcch_symbols); - // DL power control functions double get_pa_dB(uint8_t pa); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index ab73bedb4f..980a625978 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -50,30 +50,6 @@ //#define DEBUG_DLSCH_DEMOD //#define DEBUG_PDSCH_RX -// [MCS][i_mod (0,1,2) = (2,4,6)] -//unsigned char offset_mumimo_llr_drange_fix=0; -//inferference-free case -/*unsigned char interf_unaw_shift_tm4_mcs[29]={5, 3, 4, 3, 3, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 0, - 1, 1, 1, 1, 0, 2, 1, 0, 1, 0, 1, 0, 0} ;*/ - -//unsigned char interf_unaw_shift_tm1_mcs[29]={5, 5, 4, 3, 3, 3, 2, 2, 4, 4, 2, 3, 3, 3, 1, 1, -// 0, 1, 1, 2, 5, 4, 4, 6, 5, 1, 0, 5, 6} ; // mcs 21, 26, 28 seem to be errorneous - -/* -unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{6,6,6},{6,6,6},{6,6,6},{5,5,5},{4,4,4},{1,2,4}, // QPSK -{5,5,4},{5,5,5},{5,5,5},{3,3,3},{2,2,2},{2,2,2},{2,2,2}, // 16-QAM -{2,2,1},{3,3,3},{3,3,3},{3,3,1},{2,2,2},{2,2,2},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; //64-QAM -*/ - /* - //first optimization try - unsigned char offset_mumimo_llr_drange[29][3]={{7, 8, 7},{6, 6, 7},{6, 6, 7},{6, 6, 6},{5, 6, 6},{5, 5, 6},{5, 5, 6},{4, 5, 4},{4, 3, 4},{3, 2, 2},{6, 5, 5},{5, 4, 4},{5, 5, 4},{3, 3, 2},{2, 2, 1},{2, 1, 1},{2, 2, 2},{3, 3, 3},{3, 3, 2},{3, 3, 2},{3, 2, 1},{2, 2, 2},{2, 2, 2},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; - */ - //second optimization try - /* - unsigned char offset_mumimo_llr_drange[29][3]={{5, 8, 7},{4, 6, 8},{3, 6, 7},{7, 7, 6},{4, 7, 8},{4, 7, 4},{6, 6, 6},{3, 6, 6},{3, 6, 6},{1, 3, 4},{1, 1, 0},{3, 3, 2},{3, 4, 1},{4, 0, 1},{4, 2, 2},{3, 1, 2},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; w - */ -//unsigned char offset_mumimo_llr_drange[29][3]= {{0, 6, 5},{0, 4, 5},{0, 4, 5},{0, 5, 4},{0, 5, 6},{0, 5, 3},{0, 4, 4},{0, 4, 4},{0, 3, 3},{0, 1, 2},{1, 1, 0},{1, 3, 2},{3, 4, 1},{2, 0, 0},{2, 2, 2},{1, 1, 1},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; - #define print_ints(s,x) printf("%s = %d %d %d %d\n",s,(x)[0],(x)[1],(x)[2],(x)[3]) #define print_shorts(s,x) printf("%s = [%d+j*%d, %d+j*%d, %d+j*%d, %d+j*%d]\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 8ca02917b0..b91accc6ff 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -2925,19 +2925,16 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, else ue->dlsch_mtch_errors[sync_area][0]++; - LOG_E(PHY,"[UE %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n", + LOG_E(PHY, + "[UE %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n", ue->Mod_id, - frame_rx,subframe_rx, + frame_rx, + subframe_rx, ue->dlsch_mcch_errors[sync_area][0], ue->dlsch_mtch_errors[sync_area][0], - ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, + ue->dlsch_MCH[0]->harq_processes[0]->TBS >> 3, ue->dlsch_MCH[0]->max_turbo_iterations, ue->dlsch_MCH[0]->harq_processes[0]->G); - // dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx); - //if(subframe_rx == 3){ - //dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx); - //exit_fun("nothing to add"); - //} if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { for (int i=0; idlsch_MCH[0]->harq_processes[0]->TBS>>3; i++) { @@ -2962,11 +2959,9 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, CC_id, frame_rx, ue->dlsch_MCH[0]->harq_processes[0]->b, - ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, - eNB_id,// not relevant in eMBMS context + ue->dlsch_MCH[0]->harq_processes[0]->TBS >> 3, + eNB_id, // not relevant in eMBMS context sync_area); - //dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx); - //exit_fun("nothing to add"); if (mcch_active == 1) ue->dlsch_mcch_received[sync_area][0]++;