Commit dfbedadd authored by Raghavendra Dinavahi's avatar Raghavendra Dinavahi

Use nr_slot_fep for sidelink, removed sl_nr_slot_fep

parent 9126e3dd
...@@ -53,13 +53,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -53,13 +53,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
const UE_nr_rxtx_proc_t *proc, const UE_nr_rxtx_proc_t *proc,
unsigned char symbol, unsigned char symbol,
c16_t rxdataF[][frame_parms->samples_per_slot_wCP], c16_t rxdataF[][frame_parms->samples_per_slot_wCP],
uint32_t linktype); uint32_t linktype,
int sl_nr_slot_fep(PHY_VARS_NR_UE *ue, uint32_t sample_offset);
UE_nr_rxtx_proc_t *proc,
unsigned char symbol,
unsigned char Ns,
uint32_t sample_offset,
c16_t rxdataF[][ue->SL_UE_PHY_PARAMS.sl_frame_params.samples_per_slot_wCP]);
int nr_slot_fep_init_sync(const NR_DL_FRAME_PARMS *frame_parms, int nr_slot_fep_init_sync(const NR_DL_FRAME_PARMS *frame_parms,
unsigned char symbol, unsigned char symbol,
......
...@@ -34,108 +34,13 @@ ...@@ -34,108 +34,13 @@
#define LOG_I(A,B...) printf(A) #define LOG_I(A,B...) printf(A)
#endif*/ #endif*/
int sl_nr_slot_fep(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
unsigned char symbol,
unsigned char Ns,
uint32_t sample_offset,
c16_t rxdataF[][ue->SL_UE_PHY_PARAMS.sl_frame_params.samples_per_slot_wCP])
{
NR_DL_FRAME_PARMS *frame_params = &ue->SL_UE_PHY_PARAMS.sl_frame_params;
NR_UE_COMMON *common_vars = &ue->common_vars;
AssertFatal(symbol < frame_params->symbols_per_slot,
"slot_fep: symbol must be between 0 and %d\n",
frame_params->symbols_per_slot - 1);
AssertFatal(Ns < frame_params->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_params->slots_per_frame - 1);
unsigned int nb_prefix_samples = frame_params->nb_prefix_samples;
unsigned int nb_prefix_samples0 = frame_params->nb_prefix_samples0;
dft_size_idx_t dftsize = get_dft(frame_params->ofdm_symbol_size);
// This is for misalignment issues
int32_t tmp_dft_in[8192] __attribute__((aligned(32)));
unsigned int rx_offset = frame_params->get_samples_slot_timestamp(Ns, frame_params, 0);
unsigned int abs_symbol = Ns * frame_params->symbols_per_slot + symbol;
rx_offset += sample_offset;
for (int idx_symb = Ns * frame_params->symbols_per_slot; idx_symb <= abs_symbol; idx_symb++)
rx_offset += (idx_symb % (0x7 << frame_params->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
rx_offset += frame_params->ofdm_symbol_size * symbol;
// use OFDM symbol from within 1/8th of the CP to avoid ISI
rx_offset -= (nb_prefix_samples / frame_params->ofdm_offset_divisor);
#ifdef SL_DEBUG_SLOT_FEP
// if (ue->frame <100)
LOG_I(PHY,
"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u\n",
Ns,
symbol,
nb_prefix_samples,
nb_prefix_samples0,
rx_offset);
#endif
for (unsigned char aa = 0; aa < frame_params->nb_antennas_rx; aa++) {
memset(&rxdataF[aa][frame_params->ofdm_symbol_size * symbol], 0, frame_params->ofdm_symbol_size * sizeof(int32_t));
int16_t *rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset];
// if input to dft is not 256-bit aligned
if ((rx_offset & 7) != 0) {
memcpy((void *)&tmp_dft_in[0], (void *)&common_vars->rxdata[aa][rx_offset], frame_params->ofdm_symbol_size * sizeof(int32_t));
rxdata_ptr = (int16_t *)tmp_dft_in;
}
dft(dftsize, rxdata_ptr, (int16_t *)&rxdataF[aa][frame_params->ofdm_symbol_size * symbol], 1);
int symb_offset = (Ns % frame_params->slots_per_subframe) * frame_params->symbols_per_slot;
int32_t rot2 = ((uint32_t *)frame_params->symbol_rotation[2])[symbol + symb_offset];
((int16_t *)&rot2)[1] = -((int16_t *)&rot2)[1];
#ifdef SL_DEBUG_SLOT_FEP
// if (ue->frame <100)
LOG_I(PHY,
"slot_fep: slot %d, symbol %d rx_offset %u, rotation symbol %d %d.%d\n",
Ns,
symbol,
rx_offset,
symbol + symb_offset,
((int16_t *)&rot2)[0],
((int16_t *)&rot2)[1]);
#endif
rotate_cpx_vector((c16_t *)&rxdataF[aa][frame_params->ofdm_symbol_size * symbol],
(c16_t *)&rot2,
(c16_t *)&rxdataF[aa][frame_params->ofdm_symbol_size * symbol],
frame_params->ofdm_symbol_size,
15);
int16_t *shift_rot = (int16_t *)frame_params->timeshift_symbol_rotation;
multadd_cpx_vector((int16_t *)&rxdataF[aa][frame_params->ofdm_symbol_size * symbol],
shift_rot,
(int16_t *)&rxdataF[aa][frame_params->ofdm_symbol_size * symbol],
1,
frame_params->ofdm_symbol_size,
15);
}
LOG_D(PHY, "SIDELINK RX: Slot FEP: done for symbol:%d\n", symbol);
return 0;
}
int nr_slot_fep(PHY_VARS_NR_UE *ue, int nr_slot_fep(PHY_VARS_NR_UE *ue,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
const UE_nr_rxtx_proc_t *proc, const UE_nr_rxtx_proc_t *proc,
unsigned char symbol, unsigned char symbol,
c16_t rxdataF[][frame_parms->samples_per_slot_wCP], c16_t rxdataF[][frame_parms->samples_per_slot_wCP],
uint32_t linktype) uint32_t linktype,
uint32_t sample_offset)
{ {
NR_UE_COMMON *common_vars = &ue->common_vars; NR_UE_COMMON *common_vars = &ue->common_vars;
int Ns = proc->nr_slot_rx; int Ns = proc->nr_slot_rx;
...@@ -148,6 +53,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -148,6 +53,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
if (ue->is_synchronized) { if (ue->is_synchronized) {
nb_prefix_samples = frame_parms->nb_prefix_samples; nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = frame_parms->nb_prefix_samples0; nb_prefix_samples0 = frame_parms->nb_prefix_samples0;
AssertFatal(sample_offset == 0, "Sample offset if syncronised should be 0\n");
} else { } else {
nb_prefix_samples = frame_parms->nb_prefix_samples; nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = frame_parms->nb_prefix_samples; nb_prefix_samples0 = frame_parms->nb_prefix_samples;
...@@ -163,14 +69,16 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -163,14 +69,16 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
rx_offset += (idx_symb%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; rx_offset += (idx_symb%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
rx_offset += frame_parms->ofdm_symbol_size * symbol; rx_offset += frame_parms->ofdm_symbol_size * symbol;
rx_offset += sample_offset;
// use OFDM symbol from within 1/8th of the CP to avoid ISI // use OFDM symbol from within 1/8th of the CP to avoid ISI
rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor); rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
//#ifdef DEBUG_FEP #ifdef DEBUG_FEP
// if (ue->frame <100) // if (ue->frame <100)
LOG_D(PHY,"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d\n", LOG_D(PHY,"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d\n",
Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy((int32_t *)&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size))); Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy((int32_t *)&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size)));
//#endif #endif
for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) { for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
int16_t *rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset]; int16_t *rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset];
......
...@@ -447,7 +447,7 @@ nr_initial_sync_t sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, ...@@ -447,7 +447,7 @@ nr_initial_sync_t sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc,
/* In order to achieve correct processing for NR prefix samples is forced to 0 and then restored after function call */ /* In order to achieve correct processing for NR prefix samples is forced to 0 and then restored after function call */
for (int symbol = 0; symbol < SL_NR_NUMSYM_SLSS_NORMAL_CP; symbol++) { for (int symbol = 0; symbol < SL_NR_NUMSYM_SLSS_NORMAL_CP; symbol++) {
sl_nr_slot_fep(UE, NULL, symbol, 0, sync_params->ssb_offset, rxdataF); nr_slot_fep(UE, frame_parms, proc, symbol, rxdataF, link_type_sl, sync_params->ssb_offset);
} }
sl_nr_extract_sss(UE, NULL, &metric_tdd_ncp, &phase_tdd_ncp, rxdataF); sl_nr_extract_sss(UE, NULL, &metric_tdd_ncp, &phase_tdd_ncp, rxdataF);
......
...@@ -907,7 +907,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_ ...@@ -907,7 +907,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[fp->nb_antennas_rx][fp->ofdm_symbol_size]; __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[fp->nb_antennas_rx][fp->ofdm_symbol_size];
for (int i=1; i<4; i++) { for (int i=1; i<4; i++) {
nr_slot_fep(ue, fp, proc, (ssb_start_symbol + i) % (fp->symbols_per_slot), rxdataF, link_type_dl); nr_slot_fep(ue, fp, proc, (ssb_start_symbol + i) % (fp->symbols_per_slot), rxdataF, link_type_dl, 0);
nr_pbch_channel_estimation(&ue->frame_parms, nr_pbch_channel_estimation(&ue->frame_parms,
NULL, NULL,
...@@ -971,7 +971,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_ ...@@ -971,7 +971,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
{ {
for(int j = prs_config->SymbolStart; j < (prs_config->SymbolStart+prs_config->NumPRSSymbols); j++) for(int j = prs_config->SymbolStart; j < (prs_config->SymbolStart+prs_config->NumPRSSymbols); j++)
{ {
nr_slot_fep(ue, fp, proc, (j % fp->symbols_per_slot), rxdataF, link_type_dl); nr_slot_fep(ue, fp, proc, (j % fp->symbols_per_slot), rxdataF, link_type_dl, 0);
} }
nr_prs_channel_estimation(gNB_id, rsc_id, i, ue, proc, fp, rxdataF); nr_prs_channel_estimation(gNB_id, rsc_id, i, ue, proc, fp, rxdataF);
} }
...@@ -1000,7 +1000,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_ ...@@ -1000,7 +1000,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
uint8_t nb_symb_pdcch = phy_pdcch_config->nb_search_space > 0 ? phy_pdcch_config->pdcch_config[0].coreset.duration : 0; uint8_t nb_symb_pdcch = phy_pdcch_config->nb_search_space > 0 ? phy_pdcch_config->pdcch_config[0].coreset.duration : 0;
for (uint16_t l=0; l<nb_symb_pdcch; l++) { for (uint16_t l=0; l<nb_symb_pdcch; l++) {
nr_slot_fep(ue, fp, proc, l, rxdataF, link_type_dl); nr_slot_fep(ue, fp, proc, l, rxdataF, link_type_dl, 0);
} }
// Hold the channel estimates in frequency domain. // Hold the channel estimates in frequency domain.
...@@ -1050,7 +1050,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ ...@@ -1050,7 +1050,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
for(int symb_idx = 0; symb_idx < 4; symb_idx++) { for(int symb_idx = 0; symb_idx < 4; symb_idx++) {
int symb = ue->csiim_vars[gNB_id]->csiim_config_pdu.l_csiim[symb_idx]; int symb = ue->csiim_vars[gNB_id]->csiim_config_pdu.l_csiim[symb_idx];
if (!slot_fep_map[symb]) { if (!slot_fep_map[symb]) {
nr_slot_fep(ue, &ue->frame_parms, proc, symb, rxdataF, link_type_dl); nr_slot_fep(ue, &ue->frame_parms, proc, symb, rxdataF, link_type_dl, 0);
slot_fep_map[symb] = true; slot_fep_map[symb] = true;
} }
} }
...@@ -1063,7 +1063,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ ...@@ -1063,7 +1063,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
for(int symb = 0; symb < NR_SYMBOLS_PER_SLOT; symb++) { for(int symb = 0; symb < NR_SYMBOLS_PER_SLOT; symb++) {
if(is_csi_rs_in_symbol(ue->csirs_vars[gNB_id]->csirs_config_pdu, symb)) { if(is_csi_rs_in_symbol(ue->csirs_vars[gNB_id]->csirs_config_pdu, symb)) {
if (!slot_fep_map[symb]) { if (!slot_fep_map[symb]) {
nr_slot_fep(ue, &ue->frame_parms, proc, symb, rxdataF, link_type_dl); nr_slot_fep(ue, &ue->frame_parms, proc, symb, rxdataF, link_type_dl, 0);
slot_fep_map[symb] = true; slot_fep_map[symb] = true;
} }
} }
...@@ -1082,7 +1082,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ ...@@ -1082,7 +1082,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
for (int m = start_symb_sch; m < (nb_symb_sch + start_symb_sch) ; m++) { for (int m = start_symb_sch; m < (nb_symb_sch + start_symb_sch) ; m++) {
if (!slot_fep_map[m]) { if (!slot_fep_map[m]) {
nr_slot_fep(ue, &ue->frame_parms, proc, m, rxdataF, link_type_dl); nr_slot_fep(ue, &ue->frame_parms, proc, m, rxdataF, link_type_dl, 0);
slot_fep_map[m] = true; slot_fep_map[m] = true;
} }
} }
......
...@@ -149,7 +149,8 @@ static int nr_ue_psbch_procedures(PHY_VARS_NR_UE *ue, ...@@ -149,7 +149,8 @@ static int nr_ue_psbch_procedures(PHY_VARS_NR_UE *ue,
} else { } else {
result = decoded_pdu; result = decoded_pdu;
sl_phy_params->psbch.rx_ok++; sl_phy_params->psbch.rx_ok++;
LOG_I(NR_PHY, "%d:%d PSBCH RX:OK. RSRP: %d dB/RE\n", proc->frame_rx, proc->nr_slot_rx, sl_phy_params->psbch.rsrp_dB_per_RE); LOG_I(NR_PHY, "[UE%d] %d:%d PSBCH RX:OK. RSRP: %d dB/RE\n",
ue->Mod_id, proc->frame_rx, proc->nr_slot_rx, sl_phy_params->psbch.rsrp_dB_per_RE);
} }
nr_fill_sl_indication(&sl_indication, &rx_ind, NULL, proc, ue, phy_data); nr_fill_sl_indication(&sl_indication, &rx_ind, NULL, proc, ue, phy_data);
...@@ -191,7 +192,7 @@ int psbch_pscch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr ...@@ -191,7 +192,7 @@ int psbch_pscch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr
const int numsym = (fp->Ncp) ? SL_NR_NUM_SYMBOLS_SSB_EXT_CP : SL_NR_NUM_SYMBOLS_SSB_NORMAL_CP; const int numsym = (fp->Ncp) ? SL_NR_NUM_SYMBOLS_SSB_EXT_CP : SL_NR_NUM_SYMBOLS_SSB_NORMAL_CP;
for (int sym = 0; sym < numsym;) { for (int sym = 0; sym < numsym;) {
nr_slot_fep(ue, fp, proc, sym, rxdataF, link_type_sl); nr_slot_fep(ue, fp, proc, sym, rxdataF, link_type_sl, 0);
start_meas(&sl_phy_params->channel_estimation_stats); start_meas(&sl_phy_params->channel_estimation_stats);
nr_pbch_channel_estimation(fp, nr_pbch_channel_estimation(fp,
......
...@@ -799,7 +799,7 @@ int main(int argc, char **argv) ...@@ -799,7 +799,7 @@ int main(int argc, char **argv)
proc.nr_slot_rx = ssb_slot; proc.nr_slot_rx = ssb_slot;
proc.gNB_id = 0; proc.gNB_id = 0;
for (int i = UE->symbol_offset + 1; i < UE->symbol_offset + 4; i++) { for (int i = UE->symbol_offset + 1; i < UE->symbol_offset + 4; i++) {
nr_slot_fep(UE, frame_parms, &proc, i % frame_parms->symbols_per_slot, rxdataF, link_type_dl); nr_slot_fep(UE, frame_parms, &proc, i % frame_parms->symbols_per_slot, rxdataF, link_type_dl,0);
nr_pbch_channel_estimation(&UE->frame_parms, nr_pbch_channel_estimation(&UE->frame_parms,
&UE->SL_UE_PHY_PARAMS, &UE->SL_UE_PHY_PARAMS,
......
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