From e56f28434712c4da0ac73f9b5dca9170ff8c513c Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 14 Mar 2022 15:29:10 +0000 Subject: [PATCH] Perform the channel interpolation for CSI-RS row 1 --- openair1/PHY/INIT/nr_init_ue.c | 2 +- openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c | 15 ++++++++++- openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h | 6 +++++ openair1/PHY/NR_UE_TRANSPORT/csi_rx.c | 31 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index fd9a021a80..a8db7203c7 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -373,7 +373,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ue->nr_csi_rs_info->csi_rs_generated_signal[i] = (int32_t *) malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t)); ue->nr_csi_rs_info->csi_rs_received_signal[i] = (int32_t *) malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t)); ue->nr_csi_rs_info->csi_rs_ls_estimated_channel[i] = (int32_t *) malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t)); - ue->nr_csi_rs_info->csi_rs_estimated_channel_freq[i] = (int32_t *) malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t)); + ue->nr_csi_rs_info->csi_rs_estimated_channel_freq[i] = (int32_t *) malloc16_clear(fp->ofdm_symbol_size * sizeof(int32_t)); } ue->nr_srs_info = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t)); diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c index 0c520aabe7..5d3362a8c7 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c +++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c @@ -282,4 +282,17 @@ short filt16_middle4[16] = { 4096,8192,8192,8192,8192,8192,8192,8192,4096,0,0,0,0,0,0,0}; short filt16_end[16] = { - 4096,8192,8192,8192,12288,16384,16384,16384,0,0,0,0,0,0,0,0}; \ No newline at end of file + 4096,8192,8192,8192,12288,16384,16384,16384,0,0,0,0,0,0,0,0}; + +// CSI-RS +short filt24_start[24] = { + 12288,11605,10923,10240,9557,8875,8192,7509,6827,6144,5461,4779, + 4096,0,0,0,0,0,0,0,0,0,0,0}; + +short filt24_end[24] = { + 4096,4779,5461,6144,6827,7509,8192,8875,9557,10240,10923,11605, + 16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384}; + +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}; \ 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 72d1318545..41109cb7bb 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h +++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h @@ -193,4 +193,10 @@ extern short filt8_end[8]; extern short filt16_start[16]; extern short filt16_middle4[16]; extern short filt16_end[16]; + +/*CSI-RS*/ +extern short filt24_start[24]; +extern short filt24_end[24]; +extern short filt24_middle[24]; + #endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index 8d339191bf..cc7906fabf 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -37,6 +37,7 @@ #include "PHY/phy_extern_nr_ue.h" #include "common/utils/nr/nr_common.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" +#include "PHY/NR_UE_ESTIMATION/filt16a_32.h" //#define NR_CSIRS_DEBUG @@ -177,9 +178,12 @@ int nr_csi_rs_channel_estimation(PHY_VARS_NR_UE *ue, /// Channel interpolation int16_t ls_estimated[2]; + memset(csi_rs_estimated_channel_freq[ant], 0, frame_parms->ofdm_symbol_size*sizeof(int32_t)); + for (int k_id = 0; k_id < nr_csi_rs_info->k_list_length; k_id++) { uint16_t k = nr_csi_rs_info->map_list[k_id]; + int16_t *csi_rs_estimated_channel16 = (int16_t *)&csi_rs_estimated_channel_freq[ant][k]; // There are many possibilities to allocate the CSI-RS in time, which would take the implementation of many filters. // In this approach, the LS for each symbol would be different, and it would be necessary to interpolate each symbol @@ -202,7 +206,34 @@ int nr_csi_rs_channel_estimation(PHY_VARS_NR_UE *ue, } ls_estimated[0] = (int16_t) (sum_csi_rs_ls_real / Nsymb); ls_estimated[1] = (int16_t) (sum_csi_rs_ls_imag / Nsymb); + + if( (k_id == 0) || (k_id > 0 && k < nr_csi_rs_info->map_list[k_id-1]) ) { // First occupied subcarrier case or Start of OFDM symbol case + multadd_real_vector_complex_scalar(filt24_start, ls_estimated, csi_rs_estimated_channel16, 24); + } else if( (k_id < nr_csi_rs_info->k_list_length-1 && nr_csi_rs_info->map_list[k_id+1] < k) || + (k_id == nr_csi_rs_info->k_list_length-1) ) { // End of OFDM symbol case or Last occupied subcarrier case + multadd_real_vector_complex_scalar(filt24_end, ls_estimated, csi_rs_estimated_channel16 - 3*sizeof(uint64_t), 24); + } else { // Middle case + multadd_real_vector_complex_scalar(filt24_middle, ls_estimated, csi_rs_estimated_channel16 - 3*sizeof(uint64_t), 24); + } } + +#ifdef NR_CSIRS_DEBUG + + uint64_t symbol_offset = csirs_config_pdu->symb_l0*frame_parms->ofdm_symbol_size; + int16_t *csi_rs_ls_estimated_channel = (int16_t*)&nr_csi_rs_info->csi_rs_ls_estimated_channel[ant][symbol_offset]; + int16_t *csi_rs_estimated_channel16 = (int16_t*)&nr_csi_rs_info->csi_rs_estimated_channel_freq[ant][0]; + + for(int k = 0; kofdm_symbol_size; k++) { + LOG_I(NR_PHY, "(%4d) |\tls (%4d,%4d)\tint (%4d,%4d)\n", + k, + csi_rs_ls_estimated_channel[k<<1], + csi_rs_ls_estimated_channel[(k<<1)+1], + csi_rs_estimated_channel16[k<<1], + csi_rs_estimated_channel16[(k<<1)+1]); + } + +#endif + } return 0;