|
|
@@ -662,7 +662,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|
|
|
unsigned short k;
|
|
|
|
unsigned short k;
|
|
|
|
unsigned int pilot_cnt;
|
|
|
|
unsigned int pilot_cnt;
|
|
|
|
int16_t ch_l[2],ch_r[2],ch[2],*pil,*rxF,*dl_ch;
|
|
|
|
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;
|
|
|
|
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];
|
|
|
|
//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);
|
|
|
|
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);
|
|
|
|
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;
|
|
|
|
nushift = (p>>1)&1;
|
|
|
|
ue->frame_parms.nushift = nushift;
|
|
|
|
ue->frame_parms.nushift = nushift;
|
|
|
|
switch (delta) {
|
|
|
|
switch (delta) {
|
|
|
@@ -728,11 +728,11 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
|
|
|
|
LOG_E(PHY,"pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {//pdsch_dmrs_type2
|
|
|
|
} else if (ue->fd_lin_interpolation == 1) {//pdsch_dmrs_type2
|
|
|
|
nushift = delta;
|
|
|
|
nushift = delta;
|
|
|
|
ue->frame_parms.nushift = nushift;
|
|
|
|
ue->frame_parms.nushift = nushift;
|
|
|
|
switch (delta) {
|
|
|
|
switch (delta) {
|
|
|
@@ -767,7 +767,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
|
|
|
|
LOG_E(PHY,"pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
break;
|
|
|
|
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);
|
|
|
|
printf("dl_ch addr %p nushift %d\n",dl_ch,nushift);
|
|
|
|
#endif
|
|
|
|
#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)
|
|
|
|
// Treat first 2 pilots specially (left edge)
|
|
|
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
|
|
|
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);
|
|
|
|
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)
|
|
|
|
// 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);
|
|
|
|
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
|
|
|
|
#ifdef DEBUG_PDSCH
|
|
|
|
dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset];
|
|
|
|
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++) {
|
|
|
|
for(uint16_t idxP=0; idxP<ceil((float)nb_rb_pdsch*12/8); idxP++) {
|
|
|
|