From eb41150d01578a6144421cf662e2b788e292e78c Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Thu, 13 Oct 2022 18:17:22 +0100 Subject: [PATCH 1/5] Filters improvement for linear interpolation as UL channel estimation technique --- .../NR_ESTIMATION/nr_ul_channel_estimation.c | 35 ++++++------------- openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c | 13 +++++++ openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h | 5 +++ 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index c965e68fba..e6b7ecba44 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -108,7 +108,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, unsigned short bwp_start_subcarrier, nfapi_nr_pusch_pdu_t *pusch_pdu) { c16_t pilot[3280] __attribute__((aligned(16))); - int16_t *fl,*fm,*fr,*fml,*fmr,*fmm,*fdcl,*fdcr,*fdclh,*fdcrh; + int16_t *fdcl, *fdcr, *fdclh, *fdcrh; const int chest_freq = gNB->chest_freq; @@ -139,12 +139,6 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, switch (nushift) { case 0: - fl = filt8_l0; - fm = filt8_m0; - fr = filt8_r0; - fmm = filt8_mm0; - fml = filt8_m0; - fmr = filt8_mr0; fdcl = filt8_dcl0; fdcr = filt8_dcr0; fdclh = filt8_dcl0_h; @@ -152,12 +146,6 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, break; case 1: - fl = filt8_l1; - fm = filt8_m1; - fr = filt8_r1; - fmm = filt8_mm1; - fml = filt8_ml1; - fmr = filt8_mm1; fdcl = filt8_dcl1; fdcr = filt8_dcr1; fdclh = filt8_dcl1_h; @@ -256,19 +244,16 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, #endif if (pilot_cnt == 0) { - c16multaddVectRealComplex(fl, &ch16, ul_ch, 8); - } else if (pilot_cnt == 1) { - c16multaddVectRealComplex(fml, &ch16, ul_ch, 8); - } else if (pilot_cnt == (6*nb_rb_pusch-2)) { - c16multaddVectRealComplex(fmr, &ch16, ul_ch, 8); - ul_ch+=4; - } else if (pilot_cnt == (6*nb_rb_pusch-1)) { - c16multaddVectRealComplex(fr, &ch16, ul_ch, 8); - } else if (pilot_cnt%2 == 0) { - c16multaddVectRealComplex(fmm, &ch16, ul_ch, 8); - ul_ch+=4; + c16multaddVectRealComplex(filt16_ul_p0, &ch16, ul_ch, 16); + } else if (pilot_cnt == 1 || pilot_cnt == 2) { + c16multaddVectRealComplex(filt16_ul_p1p2, &ch16, ul_ch, 16); + } else if (pilot_cnt == (6 * nb_rb_pusch - 1)) { + c16multaddVectRealComplex(filt16_ul_last, &ch16, ul_ch, 16); } else { - c16multaddVectRealComplex(fm, &ch16, ul_ch, 8); + c16multaddVectRealComplex(filt16_ul_middle, &ch16, ul_ch, 16); + if (pilot_cnt % 2 == 0) { + ul_ch += 4; + } } pilot_cnt++; diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c index 0fde06b0cb..c3ef1edb28 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c +++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c @@ -329,3 +329,16 @@ short filt24_end[24] = { short filt24_middle[24] = { 4096,4779,5461,6144,6827,7509,8192,8875,9557,10240,10923,11605, 12288,11605,10923,10240,9557,8875,8192,7509,6827,6144,5461,4779}; + +// UL +short filt16_ul_p0[16] = {4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 0, 0, 0, 0, 0, 0, 0, 0}; + +short filt16_ul_p1p2[16] = {4096, 4096, 4096, 4096, 2048, 2048, 2048, 2048, + 2048, 2048, 2048, 2048, 0, 0, 0, 0}; + +short filt16_ul_middle[16] = {2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, + 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048}; + +short filt16_ul_last[16] = {4096, 4096, 4096, 4096, 8192, 8192, 8192, 8192, + 0, 0, 0, 0, 0, 0, 0, 0}; \ No newline at end of file diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h index d8c3342af9..8a3b0a9870 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h +++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h @@ -219,4 +219,9 @@ extern short filt24_start[24]; extern short filt24_end[24]; extern short filt24_middle[24]; +/*UL*/ +extern short filt16_ul_p0[16]; +extern short filt16_ul_p1p2[16]; +extern short filt16_ul_middle[16]; +extern short filt16_ul_last[16]; #endif From 9162b115c20b4e4be39dcecbefac7ea99a37b8e1 Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Tue, 8 Nov 2022 12:55:32 +0000 Subject: [PATCH 2/5] Run UL 3GPP CI tests with Linear interpolation as Channel estimation technique in Frequency domain --- cmake_targets/autotests/test_case_list.xml | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 6f3f5dd5a0..ec3048c50e 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -436,30 +436,30 @@ (Test23: 3GPP G-FR1-A5-14, PUSCH Type B, 100 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test), (Test24: 3GPP G-FR1-A5-14, PUSCH Type B, 100 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test) nr_ulsim - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z2 -s12.4 -S12.4 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z4 -s8.5 -S8.5 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z8 -s5.4 -S5.4 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z2 -s12.5 -S12.5 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z4 -s8.9 -S8.9 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z8 -s5.7 -S5.7 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z2 -s12.6 -S12.6 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z4 -s8.9 -S8.9 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z8 -s5.8 -S5.8 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z2 -s12.3 -S12.3 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z4 -s8.8 -S8.8 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z8 -s5.7 -S5.7 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z2 -s12.5 -S12.5 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z4 -s8.6 -S8.6 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z8 -s5.6 -S5.6 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z2 -s12.5 -S12.5 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z4 -s8.6 -S8.6 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z8 -s5.6 -S5.6 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z2 -s12.5 -S12.5 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z4 -s8.7 -S8.7 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z8 -s5.5 -S5.5 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z2 -s13.1 -S13.1 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z4 -s9.2 -S9.2 - -n100 -b14 -I15 -i 1,1 -g A,l -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z8 -s5.9 -S5.9 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z2 -s12.4 -S12.4 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z4 -s8.5 -S8.5 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z8 -s5.4 -S5.4 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z2 -s12.5 -S12.5 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z4 -s8.9 -S8.9 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z8 -s5.7 -S5.7 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z2 -s12.6 -S12.6 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z4 -s8.9 -S8.9 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z8 -s5.8 -S5.8 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z2 -s12.3 -S12.3 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z4 -s8.8 -S8.8 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z8 -s5.7 -S5.7 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z2 -s12.5 -S12.5 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z4 -s8.6 -S8.6 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z8 -s5.6 -S5.6 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z2 -s12.5 -S12.5 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z4 -s8.6 -S8.6 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z8 -s5.6 -S5.6 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z2 -s12.5 -S12.5 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z4 -s8.7 -S8.7 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z8 -s5.5 -S5.5 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z2 -s13.1 -S13.1 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z4 -s9.2 -S9.2 + -n100 -b14 -I15 -i 0,1 -g A,l -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z8 -s5.9 -S5.9 test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 test20 test21 test22 test23 test24 PUSCH test OK segmentation fault|assertion|exiting|fatal From a35035f9a6db0e4390964641b060980dad2b7a2c Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Fri, 18 Nov 2022 11:48:31 +0000 Subject: [PATCH 3/5] Remove replicated code in nr_pdsch_channel_estimation() --- .../nr_dl_channel_estimation.c | 340 +++++------------- 1 file changed, 80 insertions(+), 260 deletions(-) diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 8c016b862a..70210e29b2 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -1378,145 +1378,51 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, } } - for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) { - pil = (int16_t *)&pilot[rb_offset*((config_type == NFAPI_NR_DMRS_TYPE1) ? 6:4)]; - k = k % ue->frame_parms.ofdm_symbol_size; - re_offset = k; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+re_offset+nushift)]; - dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset]; + for (aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) { - memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size)); #ifdef DEBUG_PDSCH - printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); - printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); - printf("rxF addr %p p %d\n", rxF,p); - printf("dl_ch addr %p nushift %d\n",dl_ch,nushift); + printf("\n============================================\n"); + printf("==== Tx port %i, Rx antenna %i, Symbol %i ====\n", p, aarx, symbol); + printf("============================================\n"); #endif + + pil = (int16_t *)&pilot[rb_offset * ((config_type == NFAPI_NR_DMRS_TYPE1) ? 6 : 4)]; + k = k % ue->frame_parms.ofdm_symbol_size; + re_offset = k; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + re_offset + nushift)]; + dl_ch = (int16_t *)&dl_ch_estimates[p * ue->frame_parms.nb_antennas_rx + aarx][ch_offset]; + memset(dl_ch, 0, 4 * (ue->frame_parms.ofdm_symbol_size)); + if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->chest_freq == 0) { - // Treat first 2 pilots specially (left edge) - ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); -#ifdef DEBUG_PDSCH - printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); - printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]); - printf("data 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[2],rxF[3],&rxF[2],ch[0],ch[1],pil[0],pil[1]); -#endif - multadd_real_vector_complex_scalar(fl, - ch, - dl_ch, - 8); - pil += 2; - re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - //for (int i= 0; i<8; i++) - //printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i)); + for (pilot_cnt = 0; pilot_cnt < (6 * nb_rb_pdsch); pilot_cnt++) { + ch[0] = (int16_t)(((int32_t)pil[0] * rxF[0] - (int32_t)pil[1] * rxF[1]) >> 15); + ch[1] = (int16_t)(((int32_t)pil[0] * rxF[1] + (int32_t)pil[1] * rxF[0]) >> 15); - ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_PDSCH - printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); + printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil[0], pil[1], rxF[0], rxF[1], ch[0], ch[1]); #endif - multadd_real_vector_complex_scalar(fml, - ch, - dl_ch, - 8); - pil += 2; - re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - //printf("dl_ch addr %p\n",dl_ch); - - ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); -#ifdef DEBUG_PDSCH - printf("pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); -#endif - multadd_real_vector_complex_scalar(fmm, - ch, - dl_ch, - 8); - - pil += 2; - re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - dl_ch += 8; - - for (pilot_cnt=3; pilot_cnt<(6*nb_rb_pdsch-3); pilot_cnt += 2) { - - ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); -#ifdef DEBUG_PDSCH - printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); -#endif - multadd_real_vector_complex_scalar(fm, - ch, - dl_ch, - 8); + if (pilot_cnt == 0) { + multadd_real_vector_complex_scalar(fl, ch, dl_ch, 8); + } else if (pilot_cnt == 1) { + multadd_real_vector_complex_scalar(fml, ch, dl_ch, 8); + } else if (pilot_cnt == 6 * nb_rb_pdsch - 2) { + multadd_real_vector_complex_scalar(fmr, ch, dl_ch, 8); + dl_ch += 8; + } else if (pilot_cnt == 6 * nb_rb_pdsch - 1) { + multadd_real_vector_complex_scalar(fr, ch, dl_ch, 8); + } else if (pilot_cnt % 2 == 0) { + multadd_real_vector_complex_scalar(fmm, ch, dl_ch, 8); + dl_ch += 8; + } else { + multadd_real_vector_complex_scalar(fm, ch, dl_ch, 8); + } pil += 2; - re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - - ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); -#ifdef DEBUG_PDSCH - printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); -#endif - multadd_real_vector_complex_scalar(fmm, - ch, - dl_ch, - 8); - pil += 2; - re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - dl_ch += 8; - + re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)]; } - - // Treat first 2 pilots specially (right edge) - ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); -#ifdef DEBUG_PDSCH - printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); -#endif - multadd_real_vector_complex_scalar(fm, - ch, - dl_ch, - 8); - - //for (int i= 0; i<8; i++) - //printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i)); - pil += 2; - re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - - ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); -#ifdef DEBUG_PDSCH - printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); - printf("pilot %u: rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]); -#endif - multadd_real_vector_complex_scalar(fmr, - ch, - dl_ch, - 8); - - pil += 2; - re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - dl_ch += 8; - - ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); -#ifdef DEBUG_PDSCH - printf("pilot %u: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); -#endif - multadd_real_vector_complex_scalar(fr, - ch, - dl_ch, - 8); - // check if PRB crosses DC and improve estimates around DC if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pdsch*12 >= ue->frame_parms.ofdm_symbol_size)) { dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; @@ -1571,150 +1477,64 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, } } else if (config_type == NFAPI_NR_DMRS_TYPE2 && ue->chest_freq == 0){ //pdsch_dmrs_type2 |dmrs_r,dmrs_l,0,0,0,0,dmrs_r,dmrs_l,0,0,0,0| - // Treat first 4 pilots specially (left edge) - ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); + for (pilot_cnt = 0; pilot_cnt < 4 * nb_rb_pdsch; pilot_cnt++) { + if (pilot_cnt % 2 == 0) { + ch_l[0] = (int16_t)(((int32_t)pil[0] * rxF[0] - (int32_t)pil[1] * rxF[1]) >> 15); + ch_l[1] = (int16_t)(((int32_t)pil[0] * rxF[1] + (int32_t)pil[1] * rxF[0]) >> 15); #ifdef DEBUG_PDSCH - printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); - printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch_l[0],ch_l[1],pil[0],pil[1]); + printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil[0], pil[1], rxF[0], rxF[1], ch_l[0], ch_l[1]); #endif - pil += 2; - re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - - ch[0] = (ch_l[0]+ch_r[0])>>1; - ch[1] = (ch_l[1]+ch_r[1])>>1; - - dl_ch[(0+2*nushift)] = ch[0]; - dl_ch[(1+2*nushift)] = ch[1]; - dl_ch[2+2*nushift] = ch[0]; - dl_ch[3+2*nushift] = ch[1]; - - multadd_real_vector_complex_scalar(fl, - ch, - dl_ch, - 8); - - pil += 2; - re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - - pil += 2; - re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - - ch[0] = (ch_l[0]+ch_r[0])>>1; - ch[1] = (ch_l[1]+ch_r[1])>>1; - - multadd_real_vector_complex_scalar(fr, - ch, - dl_ch, - 8); - - dl_ch += 12; - dl_ch[0+2*nushift] = ch[0]; - dl_ch[1+2*nushift] = ch[1]; - dl_ch[2+2*nushift] = ch[0]; - dl_ch[3+2*nushift] = ch[1]; - dl_ch += 4; - - for (pilot_cnt=4; pilot_cnt<4*nb_rb_pdsch; pilot_cnt += 4) { - - multadd_real_vector_complex_scalar(fml, - ch, - dl_ch, - 8); - pil += 2; - re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); + } else { + ch_r[0] = (int16_t)(((int32_t)pil[0] * rxF[0] - (int32_t)pil[1] * rxF[1]) >> 15); + ch_r[1] = (int16_t)(((int32_t)pil[0] * rxF[1] + (int32_t)pil[1] * rxF[0]) >> 15); #ifdef DEBUG_PDSCH - printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch_l[0],ch_l[1],pil[0],pil[1]); + printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil[0], pil[1], rxF[0], rxF[1], ch_r[0], ch_r[1]); #endif + ch[0] = (ch_l[0] + ch_r[0]) >> 1; + ch[1] = (ch_l[1] + ch_r[1]) >> 1; + + if (pilot_cnt == 3) { + multadd_real_vector_complex_scalar(fr, ch, dl_ch, 8); + dl_ch += 12; + } else if (pilot_cnt % 4 == 1) { + multadd_real_vector_complex_scalar(fmr, ch, dl_ch, 8); + dl_ch += 8; + } else if (pilot_cnt > 3) { + multadd_real_vector_complex_scalar(fmm, ch, dl_ch, 8); + dl_ch += 12; + } + + dl_ch[0 + (nushift << 1)] = ch[0]; + dl_ch[1 + (nushift << 1)] = ch[1]; + dl_ch[2 + (nushift << 1)] = ch[0]; + dl_ch[3 + (nushift << 1)] = ch[1]; + + if (pilot_cnt == 1) { + multadd_real_vector_complex_scalar(fl, ch, dl_ch, 8); + } else if (pilot_cnt % 4 == 1) { + multadd_real_vector_complex_scalar(fm, ch, dl_ch, 8); + + } else if (pilot_cnt == (4 * nb_rb_pdsch - 1)) { + dl_ch += 4; + // Treat last 2 pilots specially (right edge) + multadd_real_vector_complex_scalar(frl, dl_ch - 2 + (nushift << 1), dl_ch, 8); + multadd_real_vector_complex_scalar(frr, dl_ch - 14 + (nushift << 1), dl_ch, 8); + + } else { + dl_ch += 4; + multadd_real_vector_complex_scalar(fml, ch, dl_ch, 8); + } + } pil += 2; - re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - - ch[0] = (ch_l[0]+ch_r[0])>>1; - ch[1] = (ch_l[1]+ch_r[1])>>1; - -#ifdef DEBUG_PDSCH - printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch_r[0],ch_r[1],pil[0],pil[1]); -#endif - - multadd_real_vector_complex_scalar(fmr, - ch, - dl_ch, - 8); - - dl_ch += 8; - dl_ch[0+2*nushift] = ch[0]; - dl_ch[1+2*nushift] = ch[1]; - dl_ch[2+2*nushift] = ch[0]; - dl_ch[3+2*nushift] = ch[1]; - - multadd_real_vector_complex_scalar(fm, - ch, - dl_ch, - 8); - - pil += 2; - re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - - pil += 2; - re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; - ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); - ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - -#ifdef DEBUG_PDSCH - printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch_r[0],ch_r[1],pil[0],pil[1]); -#endif - - ch[0] = (ch_l[0]+ch_r[0])>>1; - ch[1] = (ch_l[1]+ch_r[1])>>1; - - multadd_real_vector_complex_scalar(fmm, - ch, - dl_ch, - 8); - - dl_ch += 12; - dl_ch[0+2*nushift] = ch[0]; - dl_ch[1+2*nushift] = ch[1]; - dl_ch[2+2*nushift] = ch[0]; - dl_ch[3+2*nushift] = ch[1]; - dl_ch += 4; + int re_offset_add = pilot_cnt % 2 == 0 ? 1 : 5; + re_offset = (re_offset + re_offset_add) % ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)]; } - // Treat last 2 pilots specially (right edge) - // dl_ch-2+nushift<<1 - multadd_real_vector_complex_scalar(frl, - dl_ch-2+2*nushift, - dl_ch, - 8); - - multadd_real_vector_complex_scalar(frr, - dl_ch-14+2*nushift,/*14*/ - dl_ch, - 8); - // check if PRB crosses DC and improve estimates around DC if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pdsch*12 >= ue->frame_parms.ofdm_symbol_size) && (p<2)) { From 0c9047e11fe15e5fec2731a80d54c09dc7289375 Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Fri, 18 Nov 2022 15:10:48 +0000 Subject: [PATCH 4/5] Fix DL channel estimation for 2-layers for DMRS Type 1 --- .../nr_dl_channel_estimation.c | 61 ++++++++++++++----- openair1/SIMULATION/NR_PHY/dlsim.c | 1 + 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 70210e29b2..927734e538 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -1395,9 +1395,22 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->chest_freq == 0) { - for (pilot_cnt = 0; pilot_cnt < (6 * nb_rb_pdsch); pilot_cnt++) { - ch[0] = (int16_t)(((int32_t)pil[0] * rxF[0] - (int32_t)pil[1] * rxF[1]) >> 15); - ch[1] = (int16_t)(((int32_t)pil[0] * rxF[1] + (int32_t)pil[1] * rxF[0]) >> 15); + for (pilot_cnt = 0; pilot_cnt < 6 * nb_rb_pdsch; pilot_cnt++) { + + if (pilot_cnt % 2 == 0) { + ch[0] = (int16_t)(((int32_t)pil[0] * rxF[0] - (int32_t)pil[1] * rxF[1]) >> 15); + ch[1] = (int16_t)(((int32_t)pil[0] * rxF[1] + (int32_t)pil[1] * rxF[0]) >> 15); + pil += 2; + re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)]; + ch[0] += (int16_t)(((int32_t)pil[0] * rxF[0] - (int32_t)pil[1] * rxF[1]) >> 15); + ch[1] += (int16_t)(((int32_t)pil[0] * rxF[1] + (int32_t)pil[1] * rxF[0]) >> 15); + ch[0] >>= 1; + ch[1] >>= 1; + pil += 2; + re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)]; + } #ifdef DEBUG_PDSCH printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil[0], pil[1], rxF[0], rxF[1], ch[0], ch[1]); @@ -1418,9 +1431,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, } else { multadd_real_vector_complex_scalar(fm, ch, dl_ch, 8); } - pil += 2; - re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)]; } // check if PRB crosses DC and improve estimates around DC @@ -1437,7 +1447,14 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - + pil += 2; + re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)]; + ch[0] += (int16_t)(((int32_t)pil[0] * rxF[0] - (int32_t)pil[1] * rxF[1]) >> 15); + ch[1] += (int16_t)(((int32_t)pil[0] * rxF[1] + (int32_t)pil[1] * rxF[0]) >> 15); + ch[0] >>= 1; + ch[1] >>= 1; + // for proper allignment of SIMD vectors if((ue->frame_parms.N_RB_DL&1) == 0) { @@ -1446,12 +1463,19 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, dl_ch-4, 8); - pil += 4; - re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size; + pil += 2; + re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - + pil += 2; + re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)]; + ch[0] += (int16_t)(((int32_t)pil[0] * rxF[0] - (int32_t)pil[1] * rxF[1]) >> 15); + ch[1] += (int16_t)(((int32_t)pil[0] * rxF[1] + (int32_t)pil[1] * rxF[0]) >> 15); + ch[0] >>= 1; + ch[1] >>= 1; + multadd_real_vector_complex_scalar(fdcr, ch, dl_ch-4, @@ -1463,12 +1487,19 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, dl_ch, 8); - pil += 4; - re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size; + pil += 2; + re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - + pil += 2; + re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)]; + ch[0] += (int16_t)(((int32_t)pil[0] * rxF[0] - (int32_t)pil[1] * rxF[1]) >> 15); + ch[1] += (int16_t)(((int32_t)pil[0] * rxF[1] + (int32_t)pil[1] * rxF[0]) >> 15); + ch[0] >>= 1; + ch[1] >>= 1; + multadd_real_vector_complex_scalar(fdcrh, ch, dl_ch, @@ -1985,9 +2016,9 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset]; for(uint16_t idxP=0; idxP Date: Wed, 23 Nov 2022 11:16:05 +0000 Subject: [PATCH 5/5] Update RRC configuration for DMRS type --- openair2/RRC/NR/nr_rrc_config.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 114b0f7610..471aa0a98a 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -951,10 +951,7 @@ struct NR_SetupRelease_PDSCH_Config *config_pdsch(uint64_t ssb_bitmap, int bwp_I pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present = NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1, sizeof(*pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); NR_DMRS_DownlinkConfig_t *dmrs_DownlinkForPDSCH_MappingTypeA = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; - if ((get_softmodem_params()->do_ra || get_softmodem_params()->phy_test) && dl_antenna_ports > 1) // for MIMO, we use DMRS Config Type 2 but only with OAI UE - dmrs_DownlinkForPDSCH_MappingTypeA->dmrs_Type = calloc(1, sizeof(*dmrs_DownlinkForPDSCH_MappingTypeA->dmrs_Type)); - else - dmrs_DownlinkForPDSCH_MappingTypeA->dmrs_Type = NULL; + dmrs_DownlinkForPDSCH_MappingTypeA->dmrs_Type = NULL; dmrs_DownlinkForPDSCH_MappingTypeA->maxLength = NULL; dmrs_DownlinkForPDSCH_MappingTypeA->scramblingID0 = NULL; dmrs_DownlinkForPDSCH_MappingTypeA->scramblingID1 = NULL;