Commit f982d9b5 authored by Laurent THOMAS's avatar Laurent THOMAS

rename a function to what it does (it generate a reference signal) and minor readability changes

parent 032fc5e9
...@@ -150,7 +150,7 @@ int nr_pdsch_dmrs_rx(const PHY_VARS_NR_UE *ue, ...@@ -150,7 +150,7 @@ int nr_pdsch_dmrs_rx(const PHY_VARS_NR_UE *ue,
return(0); return(0);
} }
void nr_pdcch_dmrs_rx(const unsigned int *nr_gold_pdcch, c16_t *output, unsigned short nb_rb_coreset) void nr_pdcch_dmrs_ref(const unsigned int *nr_gold_pdcch, c16_t *output, unsigned short nb_rb_coreset)
{ {
for (int i = 0; i < ((nb_rb_coreset * 6) >> 1); i++) { for (int i = 0; i < ((nb_rb_coreset * 6) >> 1); i++) {
output[i] = get_modulated(nr_gold_pdcch, i, true); output[i] = get_modulated(nr_gold_pdcch, i, true);
......
...@@ -35,7 +35,7 @@ void nr_pbch_dmrs_rx(int dmrss, const unsigned int *nr_gold_pbch, c16_t *output, ...@@ -35,7 +35,7 @@ void nr_pbch_dmrs_rx(int dmrss, const unsigned int *nr_gold_pbch, c16_t *output,
/*!\brief This function generates the NR Gold sequence (38-211, Sec 5.2.1) for the PDCCH DMRS. /*!\brief This function generates the NR Gold sequence (38-211, Sec 5.2.1) for the PDCCH DMRS.
@param PHY_VARS_NR_UE* ue structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables @param PHY_VARS_NR_UE* ue structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables
*/ */
void nr_pdcch_dmrs_rx(const unsigned int *nr_gold_pdcch, c16_t *output, unsigned short nb_rb_corset); void nr_pdcch_dmrs_ref(const unsigned int *nr_gold_pdcch, c16_t *output, unsigned short nb_rb_corset);
int nr_pdsch_dmrs_rx(const PHY_VARS_NR_UE *ue, int nr_pdsch_dmrs_rx(const PHY_VARS_NR_UE *ue,
unsigned int Ns, unsigned int Ns,
......
...@@ -807,10 +807,8 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -807,10 +807,8 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
c16_t pdcch_dl_ch_estimates[][pdcch_est_size], c16_t pdcch_dl_ch_estimates[][pdcch_est_size],
c16_t rxdataF[ue->frame_parms.nb_antennas_rx][ue->frame_parms.ofdm_symbol_size]) c16_t rxdataF[ue->frame_parms.nb_antennas_rx][ue->frame_parms.ofdm_symbol_size])
{ {
const int symb_sz = ue->frame_parms.ofdm_symbol_size;
int slot = proc->nr_slot_rx; int slot = proc->nr_slot_rx;
unsigned char aarx;
unsigned short k;
unsigned int pilot_cnt;
int nb_rb_coreset=0; int nb_rb_coreset=0;
int coreset_start_rb=0; int coreset_start_rb=0;
...@@ -824,14 +822,6 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -824,14 +822,6 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
unsigned short coreset_start_subcarrier = first_carrier_offset+(BWPStart + coreset_start_rb)*12; unsigned short coreset_start_subcarrier = first_carrier_offset+(BWPStart + coreset_start_rb)*12;
#ifdef DEBUG_PDCCH
printf("PDCCH Channel Estimation : OFDM size %d, Ncp=%d, slot=%d, symbol %d\n",
ue->frame_parms.ofdm_symbol_size,
ue->frame_parms.Ncp,
slot,
symbol);
#endif
#if CH_INTERP #if CH_INTERP
int16_t *fl = filt16a_l1; int16_t *fl = filt16a_l1;
int16_t *fm = filt16a_m1; int16_t *fm = filt16a_m1;
...@@ -846,14 +836,13 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -846,14 +836,13 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
c16_t pilot[(nb_rb_coreset + dmrs_ref) * 3] __attribute__((aligned(16))); c16_t pilot[(nb_rb_coreset + dmrs_ref) * 3] __attribute__((aligned(16)));
// Note: pilot returned by the following function is already the complex conjugate of the transmitted DMRS // Note: pilot returned by the following function is already the complex conjugate of the transmitted DMRS
const uint32_t *gold = nr_gold_pdcch(ue->frame_parms.N_RB_DL, ue->frame_parms.symbols_per_slot, scrambling_id, slot, symbol); const uint32_t *gold = nr_gold_pdcch(ue->frame_parms.N_RB_DL, ue->frame_parms.symbols_per_slot, scrambling_id, slot, symbol);
nr_pdcch_dmrs_rx(gold, pilot, nb_rb_coreset + dmrs_ref); nr_pdcch_dmrs_ref(gold, pilot, nb_rb_coreset + dmrs_ref);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (int aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) {
int k = coreset_start_subcarrier;
k = coreset_start_subcarrier;
c16_t *pil = &pilot[dmrs_ref * 3]; c16_t *pil = &pilot[dmrs_ref * 3];
c16_t *rxF = &rxdataF[aarx][k + 1]; c16_t *rxF = &rxdataF[aarx][k + 1];
c16_t *dl_ch = &pdcch_dl_ch_estimates[aarx][0]; c16_t *dl_ch = pdcch_dl_ch_estimates[aarx];
memset(dl_ch, 0, sizeof(c16_t) * ue->frame_parms.ofdm_symbol_size); memset(dl_ch, 0, sizeof(c16_t) * ue->frame_parms.ofdm_symbol_size);
...@@ -871,36 +860,36 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -871,36 +860,36 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
rxF += 4; rxF += 4;
k += 2; k += 2;
if (k >= ue->frame_parms.ofdm_symbol_size) { if (k >= symb_sz) {
k -= ue->frame_parms.ofdm_symbol_size; k -= symb_sz;
rxF = &rxdataF[aarx][k + 1]; rxF = &rxdataF[aarx][k + 1];
} }
multadd_real_vector_complex_scalar(fm, c16mulShift(*pil++, *rxF, 15), dl_ch, 16); multadd_real_vector_complex_scalar(fm, c16mulShift(*pil++, *rxF, 15), dl_ch, 16);
k = (k + 4) % ue->frame_parms.ofdm_symbol_size; k = (k + 4) % symb_sz;
rxF = (c16_t *)&rxdataF[aarx][k + 1)]; rxF = &rxdataF[aarx][k + 1)];
multadd_real_vector_complex_scalar(fr, c16mulShift(*pil++, *rxF, 15), dl_ch, 16); multadd_real_vector_complex_scalar(fr, c16mulShift(*pil++, *rxF, 15), dl_ch, 16);
dl_ch += 12; dl_ch += 12;
k = (k + 4) % ue->frame_parms.ofdm_symbol_size; k = (k + 4) % symb_sz;
rxF = (c16_t *)&rxdataF[aarx][k + 1]; rxF = &rxdataF[aarx][k + 1];
for (pilot_cnt=3; pilot_cnt<(3*nb_rb_coreset); pilot_cnt += 3) { for (int pilot_cnt = 3; pilot_cnt < (3 * nb_rb_coreset); pilot_cnt += 3) {
multadd_real_vector_complex_scalar(fl, c16mulShift(*pil++, *rxF, 15), dl_ch, 16); multadd_real_vector_complex_scalar(fl, c16mulShift(*pil++, *rxF, 15), dl_ch, 16);
k = (k + 4) % ue->frame_parms.ofdm_symbol_size; k = (k + 4) % symb_sz;
rxF = (c16_t *)&rxdataF[aarx][k + 1]; rxF = &rxdataF[aarx][k + 1];
multadd_real_vector_complex_scalar(fm, c16mulShift(*pil++, *rxF, 15), dl_ch, 16); multadd_real_vector_complex_scalar(fm, c16mulShift(*pil++, *rxF, 15), dl_ch, 16);
k = (k + 4) % ue->frame_parms.ofdm_symbol_size; k = (k + 4) % symb_sz;
rxF = (c16_t *)&rxdataF[aarx][k + 1]; rxF = &rxdataF[aarx][k + 1];
multadd_real_vector_complex_scalar(fr, c16mulShift(*pil++, *rxF, 15), dl_ch, 16); multadd_real_vector_complex_scalar(fr, c16mulShift(*pil++, *rxF, 15), dl_ch, 16);
dl_ch += 12; dl_ch += 12;
k = (k + 4) % ue->frame_parms.ofdm_symbol_size; k = (k + 4) % symb_sz;
rxF = (c16_t *)&rxdataF[aarx][k + 1]; rxF = &rxdataF[aarx][k + 1];
} }
#else //ELSE CH_INTERP #else //ELSE CH_INTERP
c32_t ch_sum = {0, 0}; c32_t ch_sum = {0, 0};
for (pilot_cnt = 0; pilot_cnt < 3*nb_rb_coreset; pilot_cnt++) { for (int pilot_cnt = 0; pilot_cnt < 3 * nb_rb_coreset; pilot_cnt++) {
#ifdef DEBUG_PDCCH #ifdef DEBUG_PDCCH
printf("pilot[%u] = (%d, %d)\trxF[%d] = (%d, %d)\n", pilot_cnt, pil[0], pil[1], k+1, rxF[0], rxF[1]); printf("pilot[%u] = (%d, %d)\trxF[%d] = (%d, %d)\n", pilot_cnt, pil[0], pil[1], k+1, rxF[0], rxF[1]);
...@@ -908,8 +897,8 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -908,8 +897,8 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
c16_t ch = c16mulShift(*pil++, *rxF, 15); c16_t ch = c16mulShift(*pil++, *rxF, 15);
ch_sum.r += ch.r; ch_sum.r += ch.r;
ch_sum.i += ch.i; ch_sum.i += ch.i;
k = (k + 4) % ue->frame_parms.ofdm_symbol_size; k = (k + 4) % symb_sz;
rxF = (c16_t *)&rxdataF[aarx][k + 1]; rxF = &rxdataF[aarx][k + 1];
if (pilot_cnt % 3 == 2) { if (pilot_cnt % 3 == 2) {
ch.r = ch_sum.r / 3; ch.r = ch_sum.r / 3;
...@@ -923,11 +912,10 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -923,11 +912,10 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
ch_sum = (c32_t){0}; ch_sum = (c32_t){0};
} }
} }
#endif //END CH_INTERP #endif //END CH_INTERP
//} //}
} }
} }
......
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