From 65fb8a84b868a49a9dc12022148631ab88c836be Mon Sep 17 00:00:00 2001 From: Parminder Singh Date: Fri, 30 Oct 2020 11:37:05 +0100 Subject: [PATCH] Fixed Channel compensation for dlsim for multiple DMRS - fixed channel compensation by choosing most recent DMRS symbol ina slot - Removed code to find nearest DMRS symbol for channle compensation - Updated TBS calculation in DLSIM - Added debug prints in PTRS CPE estimation for DMRS symbol --- openair1/PHY/NR_REFSIG/ptrs_nr.c | 14 +++++++++- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 5 ++-- .../nr_dl_channel_estimation.c | 1 + .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 3 +-- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 26 +++++++------------ openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- 6 files changed, 28 insertions(+), 23 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 1dba1b6c16..75bf068568 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -213,6 +213,11 @@ uint8_t get_next_estimate_in_slot(uint16_t ptrsSymbPos,uint16_t dmrsSymbPos, u { return nextPtrs; } + /* Special case when DMRS is next valid estimation */ + if(nextPtrs == 0 && nextDmrs !=0) + { + return nextDmrs; + } return (nextPtrs > nextDmrs)?nextDmrs:nextPtrs; } @@ -366,6 +371,9 @@ int8_t nr_ptrs_process_slot(uint16_t dmrsSymbPos, /* set DMRS estimation */ estPerSymb[symb*2]=(int16_t)((1<<15)-1); // 32767 estPerSymb[(symb*2)+1]= 0; // no angle +#ifdef DEBUG_PTRS + printf("[PHY][PTRS]: DMRS Symbol %d :(%4d %4d)\n", symb, estPerSymb[symb*2],estPerSymb[(symb*2)+1]); +#endif } /* Update left and right reference from an estimated symbol */ if((is_ptrs_symbol(symb, ptrsSymbPos)) || (is_dmrs_symbol(symb,dmrsSymbPos))) @@ -387,7 +395,11 @@ int8_t nr_ptrs_process_slot(uint16_t dmrsSymbPos, { /* calculate slope from next valid estimates*/ tmp = get_next_estimate_in_slot(ptrsSymbPos,dmrsSymbPos,rightRef+1,symbInSlot); - get_slope_from_estimates(rightRef, tmp, estPerSymb, slope_p); + /* Special case when DMRS is not followed by PTRS symbol then reuse old slope */ + if(tmp!=0) + { + get_slope_from_estimates(rightRef, tmp, estPerSymb, slope_p); + } ptrs_estimate_from_slope(estPerSymb,slope_p,leftRef, rightRef); symb = rightRef -1; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 2c7bdfd110..0523d6c825 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -120,6 +120,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, uint32_t ***pdsch_dmrs = gNB->nr_gold_pdsch_dmrs[slot]; int32_t** txdataF = gNB->common_vars.txdataF; int16_t amp = AMP; + int xOverhead = 0; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; time_stats_t *dlsch_encoding_stats=&gNB->dlsch_encoding_stats; time_stats_t *dlsch_scrambling_stats=&gNB->dlsch_scrambling_stats; @@ -157,9 +158,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, uint16_t dmrs_symbol_map = rel15->dlDmrsSymbPos;//single DMRS: 010000100 Double DMRS 110001100 uint8_t dmrs_len = get_num_dmrs(rel15->dlDmrsSymbPos); - - uint16_t nb_re; - nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs-dmrs_len)*rel15->rbSize*rel15->NrOfCodewords; + uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->NrOfCodewords; uint8_t Qm = rel15->qamModOrder[0]; uint32_t encoded_length = nb_re*Qm; int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16))); 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 5890dd63c5..5a6f23b2b8 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -1059,6 +1059,7 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue, &phase_per_symbol[2* symbol], &ptrs_re_symbol[symbol]); /* if very first symbol is PTRS then we need to undo conjugate done in estimation */ + /* The PTRS estimation before DMRS symbol is pure error, shall be used as it is*/ if(symbol == *startSymbIndex) { phase_per_symbol[(2* symbol)+1] = (-1) * phase_per_symbol[(2* symbol)+1]; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 505d5cf18a..c1403f82ae 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -275,8 +275,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, nb_re_dmrs = 4*harq_process->n_dmrs_cdm_groups; } uint16_t dmrs_length = get_num_dmrs(harq_process->dlDmrsSymbPos); - AssertFatal(dmrs_length == 1 || dmrs_length == 2 || dmrs_length == 3 ,"Illegal dmrs_length %d\n",dmrs_length); - + uint32_t i,j; __m128i *pv = (__m128i*)&z; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 601c60b7b4..bd18477d18 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -39,6 +39,7 @@ #include "T.h" #include "openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h" #include "openair1/PHY/NR_TRANSPORT/nr_dlsch.h" +#include "PHY/NR_REFSIG/nr_refsig.h" #ifndef USER_MODE #define NOCYGWIN_STATIC static @@ -2098,9 +2099,8 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, unsigned char i,aarx; //,nsymb,sss_symb,pss_symb=0,l; int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; - uint8_t ClosestDMRSIdx = 15; //closest DMRS index to the current OFDM symbol - uint8_t ClosestDMRSdist = 15; //temporarily save the distance to the closest DMRS symbol int8_t DMRSdist = 15; //temporarily save the distance to the DMRS symbol + static uint8_t validDmrsEst = 0; //store last DMRS Symbol index unsigned char j=0; @@ -2111,21 +2111,15 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, k = frame_parms->first_carrier_offset + NR_NB_SC_PER_RB*start_rb; - if (high_speed_flag == 1) { - for (int i=0; i<16; i++) { //loop over all possible DMRS symbols - if ( (1< 0 ) { - DMRSdist = symbol-i; - DMRSdist = DMRSdist>=0 ? DMRSdist : -DMRSdist; - if ( DMRSdist < ClosestDMRSdist ) { - ClosestDMRSIdx = i; - ClosestDMRSdist = DMRSdist; - } - } - } - dl_ch0 = &dl_ch_estimates[aarx][(ClosestDMRSIdx*(frame_parms->ofdm_symbol_size))]; //use closest DMRS + if(validDmrsEst == 0) + { + validDmrsEst = get_next_dmrs_symbol_in_slot(dlDmrsSymbPos, symbol, DMRSdist); } - else - dl_ch0 = &dl_ch_estimates[aarx][0]; + if(is_dmrs_symbol(symbol,dlDmrsSymbPos ) == 1) + { + validDmrsEst = symbol; + } + dl_ch0 = &dl_ch_estimates[aarx][(validDmrsEst*(frame_parms->ofdm_symbol_size))]; //use closest DMRS dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(nb_rb_pdsch*12)]; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 61fafa5360..1aea7916bb 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -981,7 +981,7 @@ int main(int argc, char **argv) int16_t *UE_llr = pdsch_vars[0]->llr[0]; TBS = UE_harq_process->TBS;//rel15->TBSize[0]; - uint16_t length_dmrs = 1; + uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos); uint16_t nb_rb = rel15->rbSize; uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4; uint8_t mod_order = rel15->qamModOrder[0];