diff --git a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c index 4f089562f6..45078d7398 100644 --- a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c +++ b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c @@ -137,29 +137,33 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, if (config_type > 1) LOG_E(PHY,"Bad PDSCH DMRS config type %d\n", config_type); - if ((p>=1000) && (p<((config_type==NFAPI_NR_DMRS_TYPE1) ? 1008 : 1012))) { - if (ue->frame_parms.Ncp == NORMAL) { + if ((p >= 1000) && (p < ((config_type == NFAPI_NR_DMRS_TYPE1) ? 1008 : 1012))) { + if (ue->frame_parms.Ncp == NORMAL) { + for (int i = 0; i < nb_pdsch_rb * ((config_type == NFAPI_NR_DMRS_TYPE1) ? 6 : 4); i++) { + w = (wf[p - 1000][i & 1]) * (wt[p - 1000][lp]); + mod_table = (w == 1) ? nr_rx_mod_table : nr_rx_nmod_table; - 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 { - LOG_E(PHY,"extended cp not supported for PDSCH DMRS yet\n"); } + } else { + LOG_E(PHY, "extended cp not supported for PDSCH DMRS yet\n"); + } } else { - LOG_E(PHY,"Illegal p %d PDSCH DMRS port\n",p); + LOG_E(PHY, "Illegal p %d PDSCH DMRS port\n", p); } return(0); @@ -167,7 +171,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_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index c8b5af6ea5..c6156d63bc 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -87,7 +87,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); cset_start_sc = frame_parms->first_carrier_offset + (pdcch_pdu_rel15->BWPStart + rb_offset) * NR_NB_SC_PER_RB; - int16_t mod_dmrs[pdcch_pdu_rel15->StartSymbolIndex+pdcch_pdu_rel15->DurationSymbols][(n_rb+rb_offset)*6] __attribute__((aligned(16))); // 3 for the max coreset duration + int16_t mod_dmrs[pdcch_pdu_rel15->StartSymbolIndex+pdcch_pdu_rel15->DurationSymbols][(((n_rb+rb_offset+pdcch_pdu_rel15->BWPStart)*6+15)>>4)<<4] __attribute__((aligned(16))); // 3 for the max coreset duration for (int d=0;dnumDlDci;d++) { /*The coreset is initialised @@ -109,7 +109,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, LOG_D(PHY, "pdcch: Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart); LOG_D(PHY, "pdcch: Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); // DMRS length is per OFDM symbol - uint32_t dmrs_length = n_rb*6; //2(QPSK)*3(per RB)*6(REG per CCE) + uint32_t dmrs_length = (n_rb+pdcch_pdu_rel15->BWPStart)*6; //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t encoded_length = dci_pdu->AggregationLevel*108; //2(QPSK)*9(per RB)*6(REG per CCE) if (dci_pdu->RNTI != 0xFFFF) LOG_D(PHY, "DL_DCI : rb_offset %d, nb_rb %d, DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d, reg_mapping %d), Scrambling_Id %d, ScramblingRNTI %x, PayloadSizeBits %d\n", @@ -210,7 +210,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, // dmrs index depends on reference point for k according to 38.211 7.4.1.3.2 int eff_reg_idx = cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx/pdcch_pdu_rel15->DurationSymbols; if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG) - dmrs_idx = eff_reg_idx * 3; + dmrs_idx = (eff_reg_idx + pdcch_pdu_rel15->BWPStart) * 3; else dmrs_idx = (eff_reg_idx + rb_offset) * 3; 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 aa2d617112..ce9cd9bfba 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -529,8 +529,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); @@ -540,7 +538,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);