Commit 1ddac7cb authored by Khodr Saaifan's avatar Khodr Saaifan

Enable DMRS config2 for PDSCH and fix bug in the UE phy_procedures_nr_ue

parent 1ba71620
......@@ -713,7 +713,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
// dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0;
// dmrs_Uplink_Config->pusch_maxLength = pusch_len1;
//-------------------------------------------------//
ue->dmrs_DownlinkConfig.pdsch_dmrs_type = pdsch_dmrs_type1;//sfn
ue->dmrs_DownlinkConfig.pdsch_dmrs_type = pdsch_dmrs_type2;
ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition = pdsch_dmrs_pos0;
ue->dmrs_DownlinkConfig.pdsch_maxLength = pdsch_len1;
//-------------------------------------------------//
......
......@@ -726,7 +726,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
}
} else {//pdsch_dmrs_type2
nushift = delta;
ue->frame_parms.nushift = nushift>>1;//SFN:fixMe IT MUST BE WITHOUT >>1
ue->frame_parms.nushift = nushift;
switch (delta) {
case 0://port 0,1
fl = filt8_l2;//left interpolation Filter should be fml
......
......@@ -589,7 +589,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r);
LOG_I(PHY,"Segment %u CRC OK\n\033[0m",r);
if (r==0)
for (int i=0;i<10;i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]);
......@@ -598,7 +598,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
ret = no_iteration_ldpc;
}
else {
LOG_D(PHY,"CRC NOK\n\033[0m");
LOG_I(PHY,"CRC NOK\n\033[0m");
ret = 1 + dlsch->max_ldpc_iterations;
}
......
......@@ -151,6 +151,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
uint32_t llr_offset_symbol;
//uint16_t bundle_L = 2;
uint8_t pilots=0;
uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type;
uint16_t n_tx=1, n_rx=1;
int32_t median[16];
uint32_t len;
......@@ -373,6 +374,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
pdsch_vars[eNB_id]->pmi_ext,
symbol,
pilots,
config_type,
start_rb,
nb_rb_pdsch,
nr_tti_rx,
......@@ -389,7 +391,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
return(-1);
}
len = (pilots==1)? (nb_rb*6):(nb_rb*12);
len = (pilots==1)? ((config_type==pdsch_dmrs_type1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12);
#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]);
......@@ -413,6 +415,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dlsch,
symbol,
pilots,
len,
nb_rb);
#if UE_TIMING_TRACE
......@@ -1797,6 +1800,7 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext,
NR_UE_DLSCH_t **dlsch_ue,
uint8_t symbol,
uint8_t pilots,
uint32_t len,
unsigned short nb_rb)
{
......@@ -1805,12 +1809,9 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext,
short rb, ch_amp;
unsigned char aatx,aarx;
__m128i *dl_ch128, ch_amp128;
if (pilots==1){
nb_rb = nb_rb>>1;
}
uint32_t nb_rb_0 = len/12 + ((len%12)?1:0);
// Determine scaling amplitude based the symbol
ch_amp = 1024*8; //((pilots) ? (dlsch_ue[0]->sqrt_rho_b) : (dlsch_ue[0]->sqrt_rho_a));
......@@ -1825,7 +1826,7 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext,
dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12];
for (rb=0;rb<nb_rb;rb++) {
for (rb=0;rb<nb_rb_0;rb++) {
dl_ch128[0] = _mm_mulhi_epi16(dl_ch128[0],ch_amp128);
dl_ch128[0] = _mm_slli_epi16(dl_ch128[0],3);
......@@ -2351,6 +2352,7 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
unsigned char *pmi_ext,
unsigned char symbol,
uint8_t pilots,
uint8_t config_type,
unsigned short start_rb,
unsigned short nb_rb_pdsch,
unsigned char nr_tti_rx,
......@@ -2367,8 +2369,12 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
unsigned char j=0;
AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 1,
if (config_type==pdsch_dmrs_type1)
AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 1,
"nushift %d is illegal\n",frame_parms->nushift);
else
AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 2 || frame_parms->nushift == 4,
"nushift %d is illegal\n",frame_parms->nushift);
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
......@@ -2394,20 +2400,36 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext));
dl_ch0_ext+=12;
rxF_ext+=12;
} else {
j=0;
for (i = (1-frame_parms->nushift);
} else {//the symbol contains DMRS
j=0;
if (config_type==pdsch_dmrs_type1){
for (i = (1-frame_parms->nushift);
i<12;
i+=2) {
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
dl_ch0_ext+=6;
rxF_ext+=6;
} else {
for (i = (2+frame_parms->nushift);
i<6;
i++) {
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
for (i = (8+frame_parms->nushift);
i<12;
i++) {
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
dl_ch0_ext+= 8;
rxF_ext+= 8;
}
dl_ch0_ext+=6;
rxF_ext+=6;
}
dl_ch0+=12;
......
......@@ -715,6 +715,7 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
unsigned char *pmi_ext,
unsigned char symbol,
uint8_t pilots,
uint8_t config_type,
unsigned short start_rb,
unsigned short nb_pdsch_rb,
unsigned char nr_tti_rx,
......@@ -1003,6 +1004,7 @@ void nr_dlsch_scale_channel(int32_t **dl_ch_estimates_ext,
NR_UE_DLSCH_t **dlsch_ue,
uint8_t symbol,
uint8_t start_symbol,
uint32_t len,
uint16_t nb_rb);
/** \brief This is the top-level entry point for DLSCH decoding in UE. It should be replicated on several
......
......@@ -705,6 +705,8 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_id, PDSCH_t pdsch, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1) {
int nr_tti_rx = proc->nr_tti_rx;
int nr_frame_rx = proc->frame_rx;//LOG_M
char filename[100];//LOG_M
int m;
int i_mod,eNB_id_i,dual_stream_UE;
int first_symbol_flag=0;
......@@ -728,15 +730,23 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
// do channel estimation for first DMRS only
for (m = s0; m < 3; m++) {
if (((1<<m)&dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos) > 0) {
nr_pdsch_channel_estimation(ue,
for (uint8_t aatx=0; aatx<1; aatx++) {//for MIMO Config: it shall loop over no_layers
nr_pdsch_channel_estimation(ue,
0 /*eNB_id*/,
nr_tti_rx,
0 /*p*/,
aatx /*p*/,
m,
ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12,
pdsch_nb_rb);
LOG_D(PHY,"Channel Estimation in symbol %d\n",m);
break;
///LOG_M: the channel estimation
LOG_D(PHY,"PDSCH Channel estimation gNB id %d, PDSCH antenna port %d, slot %d, symbol %d\n",0,aatx,nr_tti_rx,m);
for (uint8_t aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
sprintf(filename,"PDSCH_CHANNEL_frame%d_slot%d_sym%d_port%d_rx%d.m", nr_frame_rx, nr_tti_rx, m, aatx,aarx);//LOG_M
int **dl_ch_estimates = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][0]->dl_ch_estimates;
//LOG_M(filename,"channel_F",&dl_ch_estimates[aatx*ue->frame_parms.nb_antennas_rx+aarx][ue->frame_parms.ofdm_symbol_size*m],ue->frame_parms.ofdm_symbol_size, 1, 1);
}
}
break;
}
}
for (m = s0; m < (s1 + s0); m++) {
......@@ -1039,7 +1049,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
harq_pid,
pdsch==PDSCH?1:0,
dlsch0->harq_processes[harq_pid]->TBS>256?1:0);
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is defined, ret = %d\n", ret);
LOG_I(PHY,"UE_DLSCH_PARALLELISATION is defined, ret = %d\n", ret);
#else
ret = nr_dlsch_decoding(ue,
pdsch_vars->llr[0],
......@@ -1052,7 +1062,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
harq_pid,
pdsch==PDSCH?1:0,
dlsch0->harq_processes[harq_pid]->TBS>256?1:0);
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is NOT defined, ret = %d\n", ret);
LOG_I(PHY,"UE_DLSCH_PARALLELISATION is NOT defined, ret = %d\n", ret);
//printf("start cW0 dlsch decoding\n");
#endif
......
......@@ -815,7 +815,7 @@ void nr_generate_Msg2(module_id_t module_idP,
pdsch_pdu_rel15->nrOfLayers = 1;
pdsch_pdu_rel15->transmissionScheme = 0;
pdsch_pdu_rel15->refPoint = 0;
pdsch_pdu_rel15->dmrsConfigType = 0;
pdsch_pdu_rel15->dmrsConfigType = 1;
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
pdsch_pdu_rel15->SCID = 0;
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2;
......
......@@ -133,7 +133,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
pdsch_pdu_rel15->transmissionScheme = 0;
pdsch_pdu_rel15->refPoint = 0; // Point A
pdsch_pdu_rel15->dmrsConfigType = 0; // Type 1 by default for InitialBWP
pdsch_pdu_rel15->dmrsConfigType = 1; // Type 1 by default for InitialBWP
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
pdsch_pdu_rel15->SCID = 0;
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 1;
......
......@@ -555,7 +555,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup));
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type));
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL;
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL;
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment