From 2d3ac5803edbaf5788da4ef4d9e7b0b83bc4c3f3 Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 29 Sep 2024 17:55:28 +0200 Subject: [PATCH 1/2] formatting --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 121 +++++++++--------- 1 file changed, 61 insertions(+), 60 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index ee83cccad0..0622c7d697 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -1257,7 +1257,7 @@ static void nr_dlsch_extract_rbs(uint32_t rxdataF_sz, } static void nr_dlsch_detection_mrc(uint32_t rx_size_symbol, - short n_tx, + short nl, short n_rx, int32_t rxdataF_comp[][n_rx][rx_size_symbol * NR_SYMBOLS_PER_SLOT], int ***rho, @@ -1268,19 +1268,19 @@ static void nr_dlsch_detection_mrc(uint32_t rx_size_symbol, int length) { simde__m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0,*dl_ch_mag128_1,*dl_ch_mag128_0b,*dl_ch_mag128_1b,*dl_ch_mag128_0r,*dl_ch_mag128_1r; - uint32_t nb_rb_0 = length/12 + ((length%12)?1:0); + uint32_t nb_rb_0 = length / 12 + ((length % 12) ? 1 : 0); if (n_rx > 1) { - for (int aatx = 0; aatx < n_tx; aatx++) { - rxdataF_comp128_0 = (simde__m128i *)(rxdataF_comp[aatx][0] + symbol * rx_size_symbol); - dl_ch_mag128_0 = (simde__m128i *)dl_ch_mag[aatx][0]; - dl_ch_mag128_0b = (simde__m128i *)dl_ch_magb[aatx][0]; - dl_ch_mag128_0r = (simde__m128i *)dl_ch_magr[aatx][0]; + for (int l = 0; l < nl; l++) { + rxdataF_comp128_0 = (simde__m128i *)(rxdataF_comp[l][0] + symbol * rx_size_symbol); + dl_ch_mag128_0 = (simde__m128i *)dl_ch_mag[l][0]; + dl_ch_mag128_0b = (simde__m128i *)dl_ch_magb[l][0]; + dl_ch_mag128_0r = (simde__m128i *)dl_ch_magr[l][0]; for (int aarx = 1; aarx < n_rx; aarx++) { - rxdataF_comp128_1 = (simde__m128i *)(rxdataF_comp[aatx][aarx] + symbol * rx_size_symbol); - dl_ch_mag128_1 = (simde__m128i *)dl_ch_mag[aatx][aarx]; - dl_ch_mag128_1b = (simde__m128i *)dl_ch_magb[aatx][aarx]; - dl_ch_mag128_1r = (simde__m128i *)dl_ch_magr[aatx][aarx]; + rxdataF_comp128_1 = (simde__m128i *)(rxdataF_comp[l][aarx] + symbol * rx_size_symbol); + dl_ch_mag128_1 = (simde__m128i *)dl_ch_mag[l][aarx]; + dl_ch_mag128_1b = (simde__m128i *)dl_ch_magb[l][aarx]; + dl_ch_mag128_1r = (simde__m128i *)dl_ch_magr[l][aarx]; // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM/256 llr computation) for (int i = 0; i < nb_rb_0 * 3; i++) { @@ -1293,7 +1293,7 @@ static void nr_dlsch_detection_mrc(uint32_t rx_size_symbol, } #ifdef DEBUG_DLSCH_DEMOD for (int i = 0; i < nb_rb_0 * 3; i++) { - printf("symbol%d RB %d\n", symbol,i / 3); + printf("symbol%d RB %d\n", symbol, i / 3); rxdataF_comp128_0 = (simde__m128i *)(rxdataF_comp[0][0] + symbol * rx_size_symbol); rxdataF_comp128_1 = (simde__m128i *)(rxdataF_comp[0][n_rx] + symbol * rx_size_symbol); print_shorts("tx 1 mrc_re/mrc_Im:",(int16_t*)&rxdataF_comp128_0[i]); @@ -1677,7 +1677,7 @@ void nr_conjch0_mult_ch1(int *ch0, */ static void nr_dlsch_mmse(uint32_t rx_size_symbol, unsigned char n_rx, - unsigned char n_tx, // number of layer + unsigned char nl, // number of layer int32_t rxdataF_comp[][n_rx][rx_size_symbol * NR_SYMBOLS_PER_SLOT], int32_t dl_ch_mag[][n_rx][rx_size_symbol], int32_t dl_ch_magb[][n_rx][rx_size_symbol], @@ -1690,25 +1690,24 @@ static void nr_dlsch_mmse(uint32_t rx_size_symbol, int length, uint32_t noise_var) { - int *ch0r, *ch0c; - uint32_t nb_rb_0 = length/12 + ((length%12)?1:0); + uint32_t nb_rb_0 = length / 12 + ((length % 12) ? 1 : 0); c16_t determ_fin[12 * nb_rb_0] __attribute__((aligned(32))); ///Allocate H^*H matrix elements and sub elements - c16_t conjH_H_elements_data[n_rx][n_tx][n_tx][12 * nb_rb_0]; + c16_t conjH_H_elements_data[n_rx][nl][nl][12 * nb_rb_0]; memset(conjH_H_elements_data, 0, sizeof(conjH_H_elements_data)); - c16_t *conjH_H_elements[n_rx][n_tx][n_tx]; + c16_t *conjH_H_elements[n_rx][nl][nl]; for (int aarx = 0; aarx < n_rx; aarx++) - for (int rtx = 0; rtx < n_tx; rtx++) - for (int ctx = 0; ctx < n_tx; ctx++) + for (int rtx = 0; rtx < nl; rtx++) + for (int ctx = 0; ctx < nl; ctx++) conjH_H_elements[aarx][rtx][ctx] = conjH_H_elements_data[aarx][rtx][ctx]; //Compute H^*H matrix elements and sub elements:(1/2^log2_maxh)*conjH_H_elements - for (int rtx=0;rtx> 3); - for (int p = 0; p < n_tx; p++) { + for (int p = 0; p < nl; p++) { simde__m128i *conjH_H_128i = (simde__m128i *)conjH_H_elements[0][p][p]; for (int k = 0; k < 3 * nb_rb_0; k++) { conjH_H_128i[0] = simde_mm_add_epi32(conjH_H_128i[0], nvar_128i); @@ -1734,15 +1733,15 @@ static void nr_dlsch_mmse(uint32_t rx_size_symbol, //Compute the inverse and determinant of the H^*H matrix //Allocate the inverse matrix - c16_t *inv_H_h_H[n_tx][n_tx]; - c16_t inv_H_h_H_data[n_tx][n_tx][12 * nb_rb_0]; + c16_t *inv_H_h_H[nl][nl]; + c16_t inv_H_h_H_data[nl][nl][12 * nb_rb_0]; memset(inv_H_h_H_data, 0, sizeof(inv_H_h_H_data)); - for (int rtx = 0; rtx < n_tx; rtx++) - for (int ctx = 0; ctx < n_tx; ctx++) + for (int rtx = 0; rtx < nl; rtx++) + for (int ctx = 0; ctx < nl; ctx++) inv_H_h_H[ctx][rtx] = inv_H_h_H_data[ctx][rtx]; int fp_flag = 1;//0: float point calc 1: Fixed point calc - nr_matrix_inverse(n_tx, + nr_matrix_inverse(nl, conjH_H_elements[0], // Input matrix inv_H_h_H, // Inverse determ_fin, // determin @@ -1753,30 +1752,33 @@ static void nr_dlsch_mmse(uint32_t rx_size_symbol, // multiply Matrix inversion pf H_h_H by the rx signal vector c16_t outtemp[12 * nb_rb_0] __attribute__((aligned(32))); //Allocate rxdataF for zforcing out - c16_t rxdataF_zforcing[n_tx][12 * nb_rb_0]; + c16_t rxdataF_zforcing[nl][12 * nb_rb_0]; memset(rxdataF_zforcing, 0, sizeof(rxdataF_zforcing)); - for (int rtx=0;rtx