Commit 0c9047e1 authored by Roberto Louro Magueta's avatar Roberto Louro Magueta

Fix DL channel estimation for 2-layers for DMRS Type 1

parent a35035f9
...@@ -1395,9 +1395,22 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -1395,9 +1395,22 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->chest_freq == 0) { if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->chest_freq == 0) {
for (pilot_cnt = 0; pilot_cnt < (6 * nb_rb_pdsch); pilot_cnt++) { for (pilot_cnt = 0; pilot_cnt < 6 * nb_rb_pdsch; pilot_cnt++) {
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); if (pilot_cnt % 2 == 0) {
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);
ch[0] >>= 1;
ch[1] >>= 1;
pil += 2;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)];
}
#ifdef DEBUG_PDSCH #ifdef DEBUG_PDSCH
printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil[0], pil[1], rxF[0], rxF[1], ch[0], ch[1]); printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil[0], pil[1], rxF[0], rxF[1], ch[0], ch[1]);
...@@ -1418,9 +1431,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -1418,9 +1431,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
} else { } else {
multadd_real_vector_complex_scalar(fm, ch, dl_ch, 8); multadd_real_vector_complex_scalar(fm, ch, dl_ch, 8);
} }
pil += 2;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset + nushift + re_offset)];
} }
// check if PRB crosses DC and improve estimates around DC // check if PRB crosses DC and improve estimates around DC
...@@ -1437,7 +1447,14 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -1437,7 +1447,14 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; 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[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); 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);
ch[0] >>= 1;
ch[1] >>= 1;
// for proper allignment of SIMD vectors // for proper allignment of SIMD vectors
if((ue->frame_parms.N_RB_DL&1) == 0) { if((ue->frame_parms.N_RB_DL&1) == 0) {
...@@ -1446,12 +1463,19 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -1446,12 +1463,19 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch-4, dl_ch-4,
8); 8);
pil += 4; pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size; re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; 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[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); 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);
ch[0] >>= 1;
ch[1] >>= 1;
multadd_real_vector_complex_scalar(fdcr, multadd_real_vector_complex_scalar(fdcr,
ch, ch,
dl_ch-4, dl_ch-4,
...@@ -1463,12 +1487,19 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -1463,12 +1487,19 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch, dl_ch,
8); 8);
pil += 4; pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size; re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; 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[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); 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);
ch[0] >>= 1;
ch[1] >>= 1;
multadd_real_vector_complex_scalar(fdcrh, multadd_real_vector_complex_scalar(fdcrh,
ch, ch,
dl_ch, dl_ch,
...@@ -1985,9 +2016,9 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -1985,9 +2016,9 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
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++) {
for(uint8_t idxI=0; idxI<16; idxI += 2) { for(uint8_t idxI=0; idxI<16; idxI += 2) {
printf("%d\t%d\t",dl_ch[idxP*16+idxI],dl_ch[idxP*16+idxI+1]); printf("%4d\t%4d\t",dl_ch[idxP*16+idxI],dl_ch[idxP*16+idxI+1]);
} }
printf("%d\n",idxP); printf("%2d\n",idxP);
} }
#endif #endif
} }
......
...@@ -700,6 +700,7 @@ int main(int argc, char **argv) ...@@ -700,6 +700,7 @@ int main(int argc, char **argv)
printf("-g [A,B,C,D,E,F,G,R] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models or R for MIMO model (ignores delay spread and Ricean factor)\n"); printf("-g [A,B,C,D,E,F,G,R] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models or R for MIMO model (ignores delay spread and Ricean factor)\n");
printf("-y Number of TX antennas used in gNB\n"); printf("-y Number of TX antennas used in gNB\n");
printf("-z Number of RX antennas used in UE\n"); printf("-z Number of RX antennas used in UE\n");
printf("-x Num of layer for PDSCH\n");
printf("-i Change channel estimation technique. Arguments list: Frequency domain {0:Linear interpolation, 1:PRB based averaging}, Time domain {0:Estimates of last DMRS symbol, 1:Average of DMRS symbols}\n"); printf("-i Change channel estimation technique. Arguments list: Frequency domain {0:Linear interpolation, 1:PRB based averaging}, Time domain {0:Estimates of last DMRS symbol, 1:Average of DMRS symbols}\n");
//printf("-j Relative strength of second intefering gNB (in dB) - cell_id mod 3 = 2\n"); //printf("-j Relative strength of second intefering gNB (in dB) - cell_id mod 3 = 2\n");
printf("-R N_RB_DL\n"); printf("-R N_RB_DL\n");
......
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