Commit d26d6030 authored by Raymond Knopp's avatar Raymond Knopp

added a PRB-based channel estimation. It averages the 4/6 DMRS LS channel...

added a PRB-based channel estimation. It averages the 4/6 DMRS LS channel estimates and uses a single value per PRB. Improves performance of high MCS

PHY_VARS_NR_UE now has a flag fd_lin_interpolation which turns this on/off. By default it uses the "new" method.
parent e14786b3
......@@ -662,7 +662,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
unsigned short k;
unsigned int pilot_cnt;
int16_t ch_l[2],ch_r[2],ch[2],*pil,*rxF,*dl_ch;
int16_t *fl,*fm,*fr,*fml,*fmr,*fmm,*fdcl,*fdcr,*fdclh,*fdcrh, *frl, *frr;
int16_t *fl=NULL,*fm=NULL,*fr=NULL,*fml=NULL,*fmr=NULL,*fmm=NULL,*fdcl=NULL,*fdcr=NULL,*fdclh=NULL,*fdcrh=NULL, *frl=NULL, *frr=NULL;
int ch_offset,symbol_offset;
//uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
......@@ -692,7 +692,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
int8_t delta = get_delta(p, config_type);
nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][symbol][0], &pilot[0],1000,0,nb_rb_pdsch+rb_offset);
if (config_type == pdsch_dmrs_type1){
if (config_type == pdsch_dmrs_type1 && ue->fd_lin_interpolation == 1){
nushift = (p>>1)&1;
ue->frame_parms.nushift = nushift;
switch (delta) {
......@@ -728,11 +728,11 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
break;
default:
msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
LOG_E(PHY,"pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
return -1;
break;
}
} else {//pdsch_dmrs_type2
} else if (ue->fd_lin_interpolation == 1) {//pdsch_dmrs_type2
nushift = delta;
ue->frame_parms.nushift = nushift;
switch (delta) {
......@@ -767,7 +767,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
break;
default:
msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
LOG_E(PHY,"pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
return -1;
break;
}
......@@ -792,7 +792,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
printf("dl_ch addr %p nushift %d\n",dl_ch,nushift);
#endif
if (config_type == pdsch_dmrs_type1) {
if (config_type == pdsch_dmrs_type1 && ue->fd_lin_interpolation == 1) {
// Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
......@@ -975,7 +975,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
8);
}
}
} else { //pdsch_dmrs_type2 |dmrs_r,dmrs_l,0,0,0,0,dmrs_r,dmrs_l,0,0,0,0|
} else if (config_type==pdsch_dmrs_type2 && ue->fd_lin_interpolation == 1){ //pdsch_dmrs_type2 |dmrs_r,dmrs_l,0,0,0,0,dmrs_r,dmrs_l,0,0,0,0|
// Treat first 4 pilots specially (left edge)
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
......@@ -1187,7 +1187,96 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
}
}
}
else if (config_type==pdsch_dmrs_type1) { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 6 DMRS REs and use a common value for the whole PRB
for (pilot_cnt=0; pilot_cnt<6*nb_rb_pdsch; pilot_cnt+=6) {
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0]/=6;
ch[1]/=6;
((__m128i*)dl_ch)[0]=_mm_set1_epi32(*(int32_t*)ch);
((__m128i*)dl_ch)[1]=((__m128i*)dl_ch)[0];
((__m128i*)dl_ch)[2]=((__m128i*)dl_ch)[0];
dl_ch+=24;
}
}
else { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 4 DMRS REs and use a common value for the whole PRB
for (pilot_cnt=0; pilot_cnt<4*nb_rb_pdsch; pilot_cnt+=4) {
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0]>>=2;
ch[1]>>=2;
((__m128i*)dl_ch)[0]=_mm_set1_epi32(*(int32_t*)ch);
((__m128i*)dl_ch)[1]=((__m128i*)dl_ch)[0];
((__m128i*)dl_ch)[2]=((__m128i*)dl_ch)[0];
dl_ch+=24;
}
}
#ifdef DEBUG_PDSCH
dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset];
for(uint16_t idxP=0; idxP<ceil((float)nb_rb_pdsch*12/8); idxP++) {
......
......@@ -474,7 +474,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2)+3;
pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2)+1;
}
else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM)
{
......
......@@ -852,6 +852,9 @@ typedef struct {
uint32_t high_speed_flag;
uint32_t perfect_ce;
// flag to activate linear interpolation in frequency-domain channel estimation
// when off (default), this just averages channel on per-PRB basis
uint32_t fd_lin_interpolation;
int16_t ch_est_alpha;
int generate_ul_signal[NUMBER_OF_CONNECTED_gNB_MAX];
......
......@@ -1168,7 +1168,7 @@ int main(int argc, char **argv)
LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1);
if (UE->frame_parms.nb_antennas_rx>1)
LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1);
LOG_M("chestF0.m","chF0",UE->pdsch_vars[0][0]->dl_ch_estimates_ext,N_RB_DL*12*14,1,1);
LOG_M("chestF0.m","chF0",&UE->pdsch_vars[0][0]->dl_ch_estimates_ext[0][0],g_rbSize*12*14,1,1);
write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1);
LOG_M("rxF_llr.m","rxFllr",UE->pdsch_vars[UE_proc.thread_id][0]->llr[0],available_bits,1,0);
break;
......
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