Commit cbb257a5 authored by Roberto Louro Magueta's avatar Roberto Louro Magueta Committed by laurent

Creation of function NFAPI_NR_DMRS_TYPE1_linear_interp(),...

Creation of function NFAPI_NR_DMRS_TYPE1_linear_interp(), NFAPI_NR_DMRS_TYPE1_average_prb(), NFAPI_NR_DMRS_TYPE2_linear_interp() and NFAPI_NR_DMRS_TYPE2_average_prb()
parent f1d5a92c
......@@ -1054,7 +1054,7 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)];
dl_ch = (int16_t *)&pdcch_dl_ch_estimates[aarx][ch_offset];
memset(dl_ch, 0, sizeof(*dl_ch) * ue->frame_parms.ofdm_symbol_size);
memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size));
#ifdef DEBUG_PDCCH
printf("pdcch ch est pilot addr %p RB_DL %d\n",&pilot[dmrs_ref*3], ue->frame_parms.N_RB_DL);
......@@ -1230,67 +1230,23 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
}
}
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
bool is_SI,
unsigned short p,
unsigned char symbol,
unsigned char nscid,
unsigned short scrambling_id,
unsigned short BWPStart,
uint8_t config_type,
void NFAPI_NR_DMRS_TYPE1_linear_interp(NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxF,
c16_t *pil,
c16_t *dl_ch,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch,
uint32_t pdsch_est_size,
int32_t dl_ch_estimates[][pdsch_est_size],
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
int8_t delta)
{
int gNB_id = proc->gNB_id;
int Ns = proc->nr_slot_rx;
const int ch_offset = ue->frame_parms.ofdm_symbol_size * symbol;
const int symbol_offset = ue->frame_parms.ofdm_symbol_size * symbol;
#ifdef DEBUG_PDSCH
printf("PDSCH Channel Estimation : gNB_id %d ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, Ns=%d, bwp_start_subcarrier=%d symbol %d\n",
gNB_id,
ch_offset,
symbol_offset,
ue->frame_parms.ofdm_symbol_size,
ue->frame_parms.Ncp,
Ns,
bwp_start_subcarrier,
symbol);
#endif
// generate pilot for gNB port number 1000+p
uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12;
if (is_SI) {
rb_offset -= BWPStart;
}
int8_t delta = get_delta(p, config_type);
// checking if re-initialization of scrambling IDs is needed
if (scrambling_id != ue->scramblingID_dlsch[nscid]) {
ue->scramblingID_dlsch[nscid] = scrambling_id;
nr_gold_pdsch(ue, nscid, scrambling_id);
}
c16_t pilot[3280] __attribute__((aligned(16)));
nr_pdsch_dmrs_rx(ue, Ns, ue->nr_gold_pdsch[gNB_id][Ns][symbol][0], (int32_t *)pilot, 1000 + p, 0, nb_rb_pdsch + rb_offset, config_type);
int re_offset = bwp_start_subcarrier % frame_parms->ofdm_symbol_size;
c16_t *pil0 = pil;
c16_t *dl_ch0 = dl_ch;
c16_t ch = {0};
int16_t *fdcl = NULL;
int16_t *fdcr = NULL;
int16_t *fdclh = NULL;
int16_t *fdcrh = NULL;
uint8_t nushift = 0;
if (config_type == NFAPI_NR_DMRS_TYPE1) {
nushift = (p >> 1) & 1;
if (p < 4)
ue->frame_parms.nushift = nushift;
switch (delta) {
case 0: // port 0,1
fdcl = filt8_dcl0; // left DC interpolation Filter (even RB)
......@@ -1307,72 +1263,23 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
break;
default:
LOG_E(PHY, "pdsch_channel_estimation: nushift=%d -> ERROR\n", nushift);
return -1;
break;
}
} else { // NFAPI_NR_DMRS_TYPE2
nushift = delta;
if (p < 6)
ue->frame_parms.nushift = nushift;
switch (delta) {
case 0: // ports 0,1
fdcl = filt8_dcl1;
fdcr = filt8_dcr1;
fdclh = filt8_dcl1_h;
fdcrh = filt8_dcr1_h;
break;
case 2: // ports 2,3
fdcl = NULL;
fdcr = NULL;
fdclh = NULL;
fdcrh = NULL;
break;
default:
LOG_E(PHY, "pdsch_channel_estimation: nushift=%d -> ERROR\n", nushift);
return -1;
AssertFatal(1 == 0, "pdsch_channel_estimation: Invalid delta %i\n", delta);
break;
}
}
for (int aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) {
#ifdef DEBUG_PDSCH
printf("\n============================================\n");
printf("==== Tx port %i, Rx antenna %i, Symbol %i ====\n", p, aarx, symbol);
printf("============================================\n");
#endif
int re_offset = bwp_start_subcarrier % ue->frame_parms.ofdm_symbol_size;
c16_t *pil = &pilot[rb_offset * ((config_type == NFAPI_NR_DMRS_TYPE1) ? 6 : 4)];
c16_t *rxF = &rxdataF[aarx][(symbol_offset + re_offset + nushift)];
c16_t *dl_ch = (c16_t *)&dl_ch_estimates[p * ue->frame_parms.nb_antennas_rx + aarx][ch_offset];
memset(dl_ch, 0, sizeof(*dl_ch) * ue->frame_parms.ofdm_symbol_size);
c16_t ch = {0};
if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->chest_freq == 0) {
for (int pilot_cnt = 0; pilot_cnt < 6 * nb_rb_pdsch; pilot_cnt++) {
if (pilot_cnt % 2 == 0) {
ch = c16mulShift(*pil, *rxF, 15);
ch = c16mulShift(*pil, rxF[re_offset], 15);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
ch = c16maddShift(*pil, *rxF, ch, 15);
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
ch = c16maddShift(*pil, rxF[re_offset], ch, 15);
ch = c16Shift(ch, 1);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
}
#ifdef DEBUG_PDSCH
printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF->r, rxF->i, ch.r, ch.i);
printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch.r, ch.i);
#endif
if (pilot_cnt == 0) { // Treat first pilot
......@@ -1388,132 +1295,63 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
}
// check if PRB crosses DC and improve estimates around DC
if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier + nb_rb_pdsch * 12 >= ue->frame_parms.ofdm_symbol_size)) {
dl_ch = (c16_t *)&dl_ch_estimates[aarx][ch_offset];
uint16_t idxDC = 2 * (ue->frame_parms.ofdm_symbol_size - bwp_start_subcarrier);
if ((bwp_start_subcarrier < frame_parms->ofdm_symbol_size) && (bwp_start_subcarrier + nb_rb_pdsch * 12 >= frame_parms->ofdm_symbol_size)) {
dl_ch = dl_ch0;
uint16_t idxDC = 2 * (frame_parms->ofdm_symbol_size - bwp_start_subcarrier);
uint16_t idxPil = idxDC / 4;
re_offset = bwp_start_subcarrier % ue->frame_parms.ofdm_symbol_size;
pil = &pilot[rb_offset * ((config_type == NFAPI_NR_DMRS_TYPE1) ? 6 : 4)];
re_offset = bwp_start_subcarrier % frame_parms->ofdm_symbol_size;
pil = pil0;
pil += (idxPil - 1);
dl_ch += (idxDC / 2 - 2);
dl_ch = memset(dl_ch, 0, sizeof(c16_t) * 5);
re_offset = (re_offset + idxDC / 2 - 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
ch = c16mulShift(*pil, *rxF, 15);
re_offset = (re_offset + idxDC / 2 - 2) % frame_parms->ofdm_symbol_size;
ch = c16mulShift(*pil, rxF[re_offset], 15);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
ch = c16maddShift(*pil, *rxF, ch, 15);
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
ch = c16maddShift(*pil, rxF[re_offset], ch, 15);
ch = c16Shift(ch, 1);
// for proper allignment of SIMD vectors
if ((ue->frame_parms.N_RB_DL & 1) == 0) {
if ((frame_parms->N_RB_DL & 1) == 0) {
c16multaddVectRealComplex(fdcl, &ch, dl_ch - 2, 8);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
ch = c16mulShift(*pil, *rxF, 15);
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
ch = c16mulShift(*pil, rxF[re_offset], 15);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
ch = c16maddShift(*pil, *rxF, ch, 15);
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
ch = c16maddShift(*pil, rxF[re_offset], ch, 15);
ch = c16Shift(ch, 1);
c16multaddVectRealComplex(fdcr, &ch, dl_ch - 2, 8);
} else {
c16multaddVectRealComplex(fdclh, &ch, dl_ch, 8);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
ch = c16mulShift(*pil, *rxF, 15);
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
ch = c16mulShift(*pil, rxF[re_offset], 15);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
ch = c16maddShift(*pil, *rxF, ch, 15);
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
ch = c16maddShift(*pil, rxF[re_offset], ch, 15);
ch = c16Shift(ch, 1);
c16multaddVectRealComplex(fdcrh, &ch, dl_ch, 8);
}
}
}
// pdsch_dmrs_type2 |dmrs_r,dmrs_l,0,0,0,0,dmrs_r,dmrs_l,0,0,0,0|
} else if (config_type == NFAPI_NR_DMRS_TYPE2 && ue->chest_freq == 0) {
c16_t ch_l = {0};
c16_t ch_r = {0};
for (int pilot_cnt = 0; pilot_cnt < 4 * nb_rb_pdsch; pilot_cnt += 2) {
ch_l = c16mulShift(*pil, *rxF, 15);
#ifdef DEBUG_PDSCH
printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF->r, rxF->i, ch_l.r, ch_l.i);
#endif
pil++;
re_offset = (re_offset + 1) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
ch_r = c16mulShift(*pil, *rxF, 15);
#ifdef DEBUG_PDSCH
printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF->r, rxF->i, ch_r.r, ch_r.i);
#endif
ch = c16addShift(ch_l, ch_r, 1);
if (pilot_cnt == 1) {
multadd_real_vector_complex_scalar(filt16_dl_first_type2, (int16_t *)&ch, (int16_t *)dl_ch, 16);
dl_ch += 3;
} else if (pilot_cnt == (4 * nb_rb_pdsch - 1)) {
multadd_real_vector_complex_scalar(filt16_dl_last_type2, (int16_t *)&ch, (int16_t *)dl_ch, 16);
} else {
multadd_real_vector_complex_scalar(filt16_dl_middle_type2, (int16_t *)&ch, (int16_t *)dl_ch, 16);
dl_ch += 6;
}
pil++;
re_offset = (re_offset + 5) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
}
// check if PRB crosses DC and improve estimates around DC
if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier + nb_rb_pdsch * 12 >= ue->frame_parms.ofdm_symbol_size) && (p < 2)) {
dl_ch = (c16_t *)&dl_ch_estimates[p * ue->frame_parms.nb_antennas_rx + aarx][ch_offset];
uint16_t idxDC = 2 * (ue->frame_parms.ofdm_symbol_size - bwp_start_subcarrier);
dl_ch += (idxDC / 2 - 4);
dl_ch = memset(dl_ch, 0, sizeof(c16_t) * 10);
dl_ch--;
ch_r = *dl_ch;
dl_ch += 11;
ch_l = *dl_ch;
// for proper allignment of SIMD vectors
if ((ue->frame_parms.N_RB_DL & 1) == 0) {
dl_ch -= 10;
// Interpolate fdcrl1 with ch_r
c16multaddVectRealComplex(filt8_dcrl1, &ch_r, dl_ch, 8);
// Interpolate fdclh1 with ch_l
c16multaddVectRealComplex(filt8_dclh1, &ch_l, dl_ch, 8);
dl_ch += 8;
// Interpolate fdcrh1 with ch_r
c16multaddVectRealComplex(filt8_dcrh1, &ch_r, dl_ch, 8);
// Interpolate fdcll1 with ch_l
c16multaddVectRealComplex(filt8_dcll1, &ch_l, dl_ch, 8);
} else {
dl_ch -= 14;
// Interpolate fdcrl1 with ch_r
c16multaddVectRealComplex(filt8_dcrl2, &ch_r, dl_ch, 8);
// Interpolate fdclh1 with ch_l
c16multaddVectRealComplex(filt8_dclh2, &ch_l, dl_ch, 8);
dl_ch += 8;
// Interpolate fdcrh1 with ch_r
c16multaddVectRealComplex(filt8_dcrh2, &ch_r, dl_ch, 8);
// Interpolate fdcll1 with ch_l
c16multaddVectRealComplex(filt8_dcll2, &ch_l, dl_ch, 8);
}
}
// 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
} else if (config_type == NFAPI_NR_DMRS_TYPE1) {
void NFAPI_NR_DMRS_TYPE1_average_prb(NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxF,
c16_t *pil,
c16_t *dl_ch,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch)
{
int re_offset = bwp_start_subcarrier % frame_parms->ofdm_symbol_size;
c16_t ch = {0};
int P_average = 6;
c32_t ch32 = {0};
for (int p_av = 0; p_av < P_average; p_av++) {
ch32 = c32x16maddShift(*pil, *rxF, ch32, 15);
ch32 = c32x16maddShift(*pil, rxF[re_offset], ch32, 15);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
}
ch = c16x32div(ch32, P_average);
......@@ -1535,10 +1373,9 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch32.r = 0;
ch32.i = 0;
for (int p_av = 0; p_av < P_average; p_av++) {
ch32 = c32x16maddShift(*pil, *rxF, ch32, 15);
ch32 = c32x16maddShift(*pil, rxF[re_offset], ch32, 15);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
}
ch = c16x32div(ch32, P_average);
......@@ -1563,10 +1400,9 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch32.r = 0;
ch32.i = 0;
for (int p_av = 0; p_av < P_average; p_av++) {
ch32 = c32x16maddShift(*pil, *rxF, ch32, 15);
ch32 = c32x16maddShift(*pil, rxF[re_offset], ch32, 15);
pil++;
re_offset = (re_offset + 2) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
}
ch = c16x32div(ch32, P_average);
......@@ -1583,17 +1419,103 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch += 8;
c16multaddVectRealComplex(filt8_avlip6, &ch, dl_ch, 8);
#endif
}
void NFAPI_NR_DMRS_TYPE2_linear_interp(NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxF,
c16_t *pil,
c16_t *dl_ch,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch,
int8_t delta,
unsigned short p)
{
int re_offset = bwp_start_subcarrier % frame_parms->ofdm_symbol_size;
c16_t *dl_ch0 = dl_ch;
c16_t ch = {0};
c16_t ch_l = {0};
c16_t ch_r = {0};
// 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 (int pilot_cnt = 0; pilot_cnt < 4 * nb_rb_pdsch; pilot_cnt += 2) {
ch_l = c16mulShift(*pil, rxF[re_offset], 15);
#ifdef DEBUG_PDSCH
printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_l.r, ch_l.i);
#endif
pil++;
re_offset = (re_offset + 1) % frame_parms->ofdm_symbol_size;
ch_r = c16mulShift(*pil, rxF[re_offset], 15);
#ifdef DEBUG_PDSCH
printf("pilot %3u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_r.r, ch_r.i);
#endif
ch = c16addShift(ch_l, ch_r, 1);
if (pilot_cnt == 1) {
multadd_real_vector_complex_scalar(filt16_dl_first_type2, (int16_t *)&ch, (int16_t *)dl_ch, 16);
dl_ch += 3;
} else if (pilot_cnt == (4 * nb_rb_pdsch - 1)) {
multadd_real_vector_complex_scalar(filt16_dl_last_type2, (int16_t *)&ch, (int16_t *)dl_ch, 16);
} else {
multadd_real_vector_complex_scalar(filt16_dl_middle_type2, (int16_t *)&ch, (int16_t *)dl_ch, 16);
dl_ch += 6;
}
pil++;
re_offset = (re_offset + 5) % frame_parms->ofdm_symbol_size;
}
// check if PRB crosses DC and improve estimates around DC
if ((bwp_start_subcarrier < frame_parms->ofdm_symbol_size) && (bwp_start_subcarrier + nb_rb_pdsch * 12 >= frame_parms->ofdm_symbol_size) && (p < 2)) {
dl_ch = dl_ch0;
uint16_t idxDC = 2 * (frame_parms->ofdm_symbol_size - bwp_start_subcarrier);
dl_ch += (idxDC / 2 - 4);
dl_ch = memset(dl_ch, 0, sizeof(c16_t) * 10);
dl_ch--;
ch_r = *dl_ch;
dl_ch += 11;
ch_l = *dl_ch;
// for proper allignment of SIMD vectors
if ((frame_parms->N_RB_DL & 1) == 0) {
dl_ch -= 10;
// Interpolate fdcrl1 with ch_r
c16multaddVectRealComplex(filt8_dcrl1, &ch_r, dl_ch, 8);
// Interpolate fdclh1 with ch_l
c16multaddVectRealComplex(filt8_dclh1, &ch_l, dl_ch, 8);
dl_ch += 8;
// Interpolate fdcrh1 with ch_r
c16multaddVectRealComplex(filt8_dcrh1, &ch_r, dl_ch, 8);
// Interpolate fdcll1 with ch_l
c16multaddVectRealComplex(filt8_dcll1, &ch_l, dl_ch, 8);
} else {
dl_ch -= 14;
// Interpolate fdcrl1 with ch_r
c16multaddVectRealComplex(filt8_dcrl2, &ch_r, dl_ch, 8);
// Interpolate fdclh1 with ch_l
c16multaddVectRealComplex(filt8_dclh2, &ch_l, dl_ch, 8);
dl_ch += 8;
// Interpolate fdcrh1 with ch_r
c16multaddVectRealComplex(filt8_dcrh2, &ch_r, dl_ch, 8);
// Interpolate fdcll1 with ch_l
c16multaddVectRealComplex(filt8_dcll2, &ch_l, dl_ch, 8);
}
}
}
void NFAPI_NR_DMRS_TYPE2_average_prb(NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxF,
c16_t *pil,
c16_t *dl_ch,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch)
{
int re_offset = bwp_start_subcarrier % frame_parms->ofdm_symbol_size;
c16_t ch = {0};
int P_average = 4;
c32_t ch32 = {0};
for (int p_av = 0; p_av < P_average; p_av++) {
ch32 = c32x16maddShift(*pil, *rxF, ch32, 15);
ch32 = c32x16maddShift(*pil, rxF[re_offset], ch32, 15);
pil++;
re_offset = (re_offset + 1) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
re_offset = (re_offset + 1) % frame_parms->ofdm_symbol_size;
}
ch = c16x32div(ch32, P_average);
......@@ -1615,10 +1537,9 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch32.r = 0;
ch32.i = 0;
for (int p_av = 0; p_av < P_average; p_av++) {
ch32 = c32x16maddShift(*pil, *rxF, ch32, 15);
ch32 = c32x16maddShift(*pil, rxF[re_offset], ch32, 15);
pil++;
re_offset = (re_offset + 5) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
re_offset = (re_offset + 5) % frame_parms->ofdm_symbol_size;
}
ch = c16x32div(ch32, P_average);
......@@ -1643,10 +1564,9 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch32.r = 0;
ch32.i = 0;
for (int p_av = 0; p_av < P_average; p_av++) {
ch32 = c32x16maddShift(*pil, *rxF, ch32, 15);
ch32 = c32x16maddShift(*pil, rxF[re_offset], ch32, 15);
pil++;
re_offset = (re_offset + 5) % ue->frame_parms.ofdm_symbol_size;
rxF = &rxdataF[aarx][(symbol_offset + nushift + re_offset)];
re_offset = (re_offset + 5) % frame_parms->ofdm_symbol_size;
}
ch = c16x32div(ch32, P_average);
......@@ -1663,7 +1583,115 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch += 8;
c16multaddVectRealComplex(filt8_avlip6, &ch, dl_ch, 8);
#endif
}
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
bool is_SI,
unsigned short p,
unsigned char symbol,
unsigned char nscid,
unsigned short scrambling_id,
unsigned short BWPStart,
uint8_t config_type,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch,
uint32_t pdsch_est_size,
int32_t dl_ch_estimates[][pdsch_est_size],
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
{
int gNB_id = proc->gNB_id;
int Ns = proc->nr_slot_rx;
const int ch_offset = ue->frame_parms.ofdm_symbol_size * symbol;
const int symbol_offset = ue->frame_parms.ofdm_symbol_size * symbol;
#ifdef DEBUG_PDSCH
printf("PDSCH Channel Estimation : gNB_id %d ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, Ns=%d, bwp_start_subcarrier=%d symbol %d\n",
gNB_id,
ch_offset,
symbol_offset,
ue->frame_parms.ofdm_symbol_size,
ue->frame_parms.Ncp,
Ns,
bwp_start_subcarrier,
symbol);
#endif
// generate pilot for gNB port number 1000+p
uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12;
if (is_SI) {
rb_offset -= BWPStart;
}
int8_t delta = get_delta(p, config_type);
// checking if re-initialization of scrambling IDs is needed
if (scrambling_id != ue->scramblingID_dlsch[nscid]) {
ue->scramblingID_dlsch[nscid] = scrambling_id;
nr_gold_pdsch(ue, nscid, scrambling_id);
}
c16_t pilot[3280] __attribute__((aligned(16)));
nr_pdsch_dmrs_rx(ue, Ns, ue->nr_gold_pdsch[gNB_id][Ns][symbol][0], (int32_t *)pilot, 1000 + p, 0, nb_rb_pdsch + rb_offset, config_type);
uint8_t nushift = 0;
if (config_type == NFAPI_NR_DMRS_TYPE1) {
nushift = (p >> 1) & 1;
if (p < 4)
ue->frame_parms.nushift = nushift;
} else { // NFAPI_NR_DMRS_TYPE2
nushift = delta;
if (p < 6)
ue->frame_parms.nushift = nushift;
}
for (int aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) {
#ifdef DEBUG_PDSCH
printf("\n============================================\n");
printf("==== Tx port %i, Rx antenna %i, Symbol %i ====\n", p, aarx, symbol);
printf("============================================\n");
#endif
c16_t *rxF = &rxdataF[aarx][symbol_offset + nushift];
c16_t *dl_ch = (c16_t *)&dl_ch_estimates[p * ue->frame_parms.nb_antennas_rx + aarx][ch_offset];
memset(dl_ch, 0, sizeof(*dl_ch) * ue->frame_parms.ofdm_symbol_size);
if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->chest_freq == 0) {
NFAPI_NR_DMRS_TYPE1_linear_interp(&ue->frame_parms,
rxF,
&pilot[6 * rb_offset],
dl_ch,
bwp_start_subcarrier,
nb_rb_pdsch,
delta);
} else if (config_type == NFAPI_NR_DMRS_TYPE2 && ue->chest_freq == 0) {
NFAPI_NR_DMRS_TYPE2_linear_interp(&ue->frame_parms,
rxF,
&pilot[4 * rb_offset],
dl_ch,
bwp_start_subcarrier,
nb_rb_pdsch,
delta,
p);
} else if (config_type == NFAPI_NR_DMRS_TYPE1) {
NFAPI_NR_DMRS_TYPE1_average_prb(&ue->frame_parms,
rxF,
&pilot[6 * rb_offset],
dl_ch,
bwp_start_subcarrier,
nb_rb_pdsch);
} else {
NFAPI_NR_DMRS_TYPE2_average_prb(&ue->frame_parms,
rxF,
&pilot[4 * rb_offset],
dl_ch,
bwp_start_subcarrier,
nb_rb_pdsch);
}
#ifdef DEBUG_PDSCH
dl_ch = (c16_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++) {
......
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