From 7a3dea31972084849662cb1b2d8b77aae78398a4 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 5 Sep 2022 11:23:29 +0200 Subject: [PATCH] fix at UE for DMRS when there is a bwp start offset --- openair1/PHY/NR_REFSIG/nr_dmrs_rx.c | 19 ++++---- openair1/PHY/NR_REFSIG/refsig_defs_ue.h | 1 - .../nr_dl_channel_estimation.c | 48 ++++++++++++------- openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h | 20 ++++---- .../PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 24 ++++------ openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 29 ++++------- 6 files changed, 70 insertions(+), 71 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c index 4f089562f6..b186f61bae 100644 --- a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c +++ b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c @@ -142,17 +142,17 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, for (int i=0; i>5])>>((i<<1)&0x1f))&1)<<1) ^ (((nr_gold_pdsch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1); - ((int16_t*)output)[i<<1] = mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1]; - ((int16_t*)output)[(i<<1)+1] = mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1]; + idx = ((((nr_gold_pdsch[(i<<1)>>5])>>((i<<1)&0x1f))&1)<<1) ^ (((nr_gold_pdsch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1); + ((int16_t*)output)[i<<1] = mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1]; + ((int16_t*)output)[(i<<1)+1] = mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1]; #ifdef DEBUG_PDSCH - printf("nr_pdsch_dmrs_rx dmrs config type %d port %d nb_pdsch_rb %d\n", config_type, p, nb_pdsch_rb); - printf("wf[%d] = %d wt[%d]= %d\n", i&1, wf[p-1000][i&1], lp, wt[p-1000][lp]); - printf("i %d idx %d pdsch gold %u b0-b1 %d-%d mod_dmrs %d %d\n", i, idx, nr_gold_pdsch[(i<<1)>>5], (((nr_gold_pdsch[(i<<1)>>5])>>((i<<1)&0x1f))&1), - (((nr_gold_pdsch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1), ((int16_t*)output)[i<<1], ((int16_t*)output)[(i<<1)+1]); + printf("nr_pdsch_dmrs_rx dmrs config type %d port %d nb_pdsch_rb %d\n", config_type, p, nb_pdsch_rb); + printf("wf[%d] = %d wt[%d]= %d\n", i&1, wf[p-1000][i&1], lp, wt[p-1000][lp]); + printf("i %d idx %d pdsch gold %u b0-b1 %d-%d mod_dmrs %d %d\n", i, idx, nr_gold_pdsch[(i<<1)>>5], (((nr_gold_pdsch[(i<<1)>>5])>>((i<<1)&0x1f))&1), + (((nr_gold_pdsch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1), ((int16_t*)output)[i<<1], ((int16_t*)output)[(i<<1)+1]); #endif } } else { @@ -167,7 +167,6 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue, - uint8_t eNB_offset, unsigned int Ns, unsigned int *nr_gold_pdcch, int32_t *output, diff --git a/openair1/PHY/NR_REFSIG/refsig_defs_ue.h b/openair1/PHY/NR_REFSIG/refsig_defs_ue.h index a6e57fb298..5145b113c1 100644 --- a/openair1/PHY/NR_REFSIG/refsig_defs_ue.h +++ b/openair1/PHY/NR_REFSIG/refsig_defs_ue.h @@ -39,7 +39,6 @@ int nr_pbch_dmrs_rx(int dmrss, @param PHY_VARS_NR_UE* ue structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables */ int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue, - uint8_t eNB_offset, unsigned int Ns, unsigned int *nr_gold_pdcch, int32_t *output, 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 ba7e61afe6..afa91d7d00 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -28,6 +28,7 @@ #include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/NR_REFSIG/ptrs_nr.h" #include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" +#include "common/utils/nr/nr_common.h" #include "filt16a_32.h" #include @@ -463,16 +464,16 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, return(0); } -int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, - UE_nr_rxtx_proc_t *proc, - uint8_t gNB_id, - unsigned char Ns, - unsigned char symbol, - unsigned short scrambling_id, - unsigned short coreset_start_subcarrier, - unsigned short nb_rb_coreset, - int32_t pdcch_est_size, - int32_t pdcch_dl_ch_estimates[][pdcch_est_size]) +void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, + UE_nr_rxtx_proc_t *proc, + uint8_t gNB_id, + unsigned char Ns, + unsigned char symbol, + fapi_nr_coreset_t *coreset, + uint16_t first_carrier_offset, + uint16_t BWPStart, + int32_t pdcch_est_size, + int32_t pdcch_dl_ch_estimates[][pdcch_est_size]) { unsigned char aarx; @@ -487,6 +488,17 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, symbol_offset = ue->frame_parms.ofdm_symbol_size*symbol; + int nb_rb_coreset=0; + int coreset_start_rb=0; + get_coreset_rballoc(coreset->frequency_domain_resource,&nb_rb_coreset,&coreset_start_rb); + if(nb_rb_coreset==0) return; + +#ifdef DEBUG_PDCCH + printf(PHY, "pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d, coreset_nb_rb %d\n", + first_carrier_offset, BWPStart, coreset_start_rb, nb_rb_coreset); +#endif + + unsigned short coreset_start_subcarrier = first_carrier_offset+(BWPStart + coreset_start_rb)*12; #ifdef DEBUG_PDCCH printf("PDCCH Channel Estimation : ThreadId %d, gNB_id %d ch_offset %d, OFDM size %d, Ncp=%d, Ns=%d, symbol %d\n", @@ -499,28 +511,32 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, int16_t *fr = filt16a_r1; #endif + unsigned short scrambling_id = coreset->pdcch_dmrs_scrambling_id; // checking if re-initialization of scrambling IDs is needed (should be done here but scrambling ID for PDCCH is not taken from RRC) if (scrambling_id != ue->scramblingID_pdcch){ ue->scramblingID_pdcch = scrambling_id; nr_gold_pdcch(ue,ue->scramblingID_pdcch); } - // generate pilot - int pilot[nb_rb_coreset * 3] __attribute__((aligned(16))); - nr_pdcch_dmrs_rx(ue,gNB_id,Ns,ue->nr_gold_pdcch[gNB_id][Ns][symbol], &pilot[0],2000,nb_rb_coreset); + int dmrs_ref = 0; + if (coreset->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG) + dmrs_ref = BWPStart; + // generate pilot + int pilot[(nb_rb_coreset + dmrs_ref) * 3] __attribute__((aligned(16))); + nr_pdcch_dmrs_rx(ue,Ns,ue->nr_gold_pdcch[gNB_id][Ns][symbol], &pilot[0],2000,(nb_rb_coreset+dmrs_ref)); for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) { k = coreset_start_subcarrier; - pil = (int16_t *)&pilot[0]; + pil = (int16_t *)&pilot[dmrs_ref*3]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; dl_ch = (int16_t *)&pdcch_dl_ch_estimates[aarx][ch_offset]; memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size)); #ifdef DEBUG_PDCCH - printf("pdcch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); + printf("pdcch ch est pilot addr %p RB_DL %d\n",&pilot[dmrs_ref*3], ue->frame_parms.N_RB_DL); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); printf("rxF addr %p\n", rxF); @@ -687,8 +703,6 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, //} } - - return(0); } int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index 52b3af9a96..74dfe63075 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -39,16 +39,16 @@ \param Ns slot number (0..19) \param symbol symbol within slot */ -int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, - UE_nr_rxtx_proc_t *proc, - uint8_t gNB_id, - unsigned char Ns, - unsigned char symbol, - unsigned short scrambling_id, - unsigned short coreset_start_subcarrier, - unsigned short nb_rb_coreset, - int32_t pdcch_est_size, - int32_t pdcch_dl_ch_estimates[][pdcch_est_size]); +void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, + UE_nr_rxtx_proc_t *proc, + uint8_t gNB_id, + unsigned char Ns, + unsigned char symbol, + fapi_nr_coreset_t *coreset, + uint16_t first_carrier_offset, + uint16_t BWPStart, + int32_t pdcch_est_size, + int32_t pdcch_dl_ch_estimates[][pdcch_est_size]); int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 064d4db1af..75941eebf9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -532,8 +532,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, if (sa==1 && ret==0) { bool dec = false; int gnb_id = 0; //FIXME - int coreset_nb_rb=0; - int coreset_start_rb=0; // Hold the channel estimates in frequency domain. int32_t pdcch_est_size = ((((fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH))+15)/16)*16); @@ -543,7 +541,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, for(int n_ss = 0; n_sssamples_per_frame+phy_pdcch_config.sfn*fp->samples_per_frame+ue->rx_offset); - if (coreset_nb_rb > 0) - nr_pdcch_channel_estimation(ue, - proc, - 0, - phy_pdcch_config.slot, - l, - fp->Nid_cell, - fp->first_carrier_offset+(phy_pdcch_config.pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, - coreset_nb_rb, - pdcch_est_size, - pdcch_dl_ch_estimates); + nr_pdcch_channel_estimation(ue, + proc, + 0, + phy_pdcch_config.slot, + l, + &phy_pdcch_config.pdcch_config[n_ss].coreset, + fp->first_carrier_offset, + phy_pdcch_config.pdcch_config[n_ss].BWPStart, + pdcch_est_size, + pdcch_dl_ch_estimates); } int dci_cnt = nr_ue_pdcch_procedures(gnb_id, ue, proc, pdcch_est_size, pdcch_dl_ch_estimates, &phy_pdcch_config, n_ss); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index c68702fa3f..363506c988 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1445,31 +1445,22 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, int32_t pdcch_est_size = ((((fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH))+15)/16)*16); __attribute__ ((aligned(16))) int32_t pdcch_dl_ch_estimates[4*fp->nb_antennas_rx][pdcch_est_size]; - int coreset_nb_rb=0; - int coreset_start_rb=0; - - if (phy_pdcch_config->nb_search_space > 0) - get_coreset_rballoc(phy_pdcch_config->pdcch_config[0].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb); - uint8_t dci_cnt = 0; for(int n_ss = 0; n_ssnb_search_space; n_ss++) { for (uint16_t l=0; lfirst_carrier_offset, phy_pdcch_config->pdcch_config[n_ss].BWPStart, coreset_start_rb, coreset_nb_rb); - if (coreset_nb_rb > 0) - nr_pdcch_channel_estimation(ue, - proc, - gNB_id, - nr_slot_rx, - l, - phy_pdcch_config->pdcch_config[n_ss].coreset.pdcch_dmrs_scrambling_id, - fp->first_carrier_offset+(phy_pdcch_config->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, - coreset_nb_rb, - pdcch_est_size, - pdcch_dl_ch_estimates); + nr_pdcch_channel_estimation(ue, + proc, + gNB_id, + nr_slot_rx, + l, + &phy_pdcch_config->pdcch_config[n_ss].coreset, + fp->first_carrier_offset, + phy_pdcch_config->pdcch_config[n_ss].BWPStart, + pdcch_est_size, + pdcch_dl_ch_estimates); stop_meas(&ue->ofdm_demod_stats);