Commit 114ea60c authored by Raghavendra Dinavahi's avatar Raghavendra Dinavahi

removed nr_slot_fep_init_sync and used nr_slot_fep in UE

parent dfbedadd
......@@ -49,19 +49,13 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
int reset_freq_est);
int nr_slot_fep(PHY_VARS_NR_UE *ue,
NR_DL_FRAME_PARMS *frame_parms,
const UE_nr_rxtx_proc_t *proc,
unsigned char symbol,
const NR_DL_FRAME_PARMS *frame_parms,
unsigned int slot,
unsigned int symbol,
c16_t rxdataF[][frame_parms->samples_per_slot_wCP],
uint32_t linktype,
uint32_t sample_offset);
int nr_slot_fep_init_sync(const NR_DL_FRAME_PARMS *frame_parms,
unsigned char symbol,
int sample_offset,
const c16_t **rxdata,
c16_t rxdataF[][frame_parms->samples_per_slot_wCP],
int link_type);
enum nr_Link linktype,
uint32_t sample_offset,
c16_t **rxdata);
int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue,
unsigned char l,
......
......@@ -120,14 +120,14 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp);
void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp);
void apply_nr_rotation_RX(NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxdataF,
c16_t *rot,
int slot,
void apply_nr_rotation_RX(const NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxdataF,
const c16_t *rot,
int slot,
int nb_rb,
int soffset,
int first_symbol,
int nsymb);
int first_symbol,
int nsymb);
/*! \brief Perform NR precoding. TS 38.211 V15.4.0 subclause 6.3.1.5
@param[in] datatx_F_precoding, Pointer to n_layers*re data array
......
......@@ -35,37 +35,43 @@
#endif*/
int nr_slot_fep(PHY_VARS_NR_UE *ue,
NR_DL_FRAME_PARMS *frame_parms,
const UE_nr_rxtx_proc_t *proc,
unsigned char symbol,
const NR_DL_FRAME_PARMS *frame_parms,
unsigned int slot,
unsigned int symbol,
c16_t rxdataF[][frame_parms->samples_per_slot_wCP],
uint32_t linktype,
uint32_t sample_offset)
enum nr_Link linktype,
uint32_t sample_offset,
c16_t **rxdata)
{
NR_UE_COMMON *common_vars = &ue->common_vars;
int Ns = proc->nr_slot_rx;
AssertFatal(symbol < frame_parms->symbols_per_slot, "slot_fep: symbol must be between 0 and %d\n", frame_parms->symbols_per_slot-1);
AssertFatal(Ns < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame-1);
AssertFatal(slot < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame - 1);
bool is_sl = (linktype == link_type_sl) ? true : false;
bool is_synchronized = (ue) ? ue->is_synchronized : false;
unsigned int nb_prefix_samples;
unsigned int nb_prefix_samples0;
if (ue->is_synchronized) {
// For Sidelink 16 frames worth of samples is processed to find SSB, for 5G-NR 2.
unsigned int total_samples = (is_sl) ? 16 * frame_parms->samples_per_frame : 2 * frame_parms->samples_per_frame;
int N_RB = (is_sl) ? frame_parms->N_RB_SL : frame_parms->N_RB_DL;
if (is_synchronized || is_sl) {
nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = frame_parms->nb_prefix_samples0;
AssertFatal(sample_offset == 0, "Sample offset if syncronised should be 0\n");
} else {
nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = frame_parms->nb_prefix_samples;
AssertFatal(slot == 0, "Slot should be 0\n");
}
dft_size_idx_t dftsize = get_dft(frame_parms->ofdm_symbol_size);
// This is for misalignment issues
int32_t tmp_dft_in[8192] __attribute__ ((aligned (32)));
unsigned int rx_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
unsigned int abs_symbol = Ns * frame_parms->symbols_per_slot + symbol;
for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb <= abs_symbol; idx_symb++)
unsigned int rx_offset = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0);
unsigned int abs_symbol = slot * frame_parms->symbols_per_slot + symbol;
for (int idx_symb = slot * frame_parms->symbols_per_slot; idx_symb <= abs_symbol; idx_symb++)
rx_offset += (idx_symb%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
rx_offset += frame_parms->ofdm_symbol_size * symbol;
......@@ -81,107 +87,39 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#endif
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 *)&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_parms->ofdm_symbol_size * sizeof(int32_t));
rxdata_ptr = (int16_t *)tmp_dft_in;
}
start_meas_nr_ue_phy(ue, RX_DFT_STATS);
dft(dftsize,
rxdata_ptr,
(int16_t *)&rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
1);
stop_meas_nr_ue_phy(ue, RX_DFT_STATS);
rx_offset %= total_samples;
apply_nr_rotation_RX(frame_parms, rxdataF[aa], frame_parms->symbol_rotation[linktype], Ns, frame_parms->N_RB_DL, 0, symbol, 1);
}
#ifdef DEBUG_FEP
printf("slot_fep: done\n");
#endif
return 0;
}
int nr_slot_fep_init_sync(const NR_DL_FRAME_PARMS *frame_parms,
unsigned char symbol,
int sample_offset,
const c16_t **rxdata,
c16_t rxdataF[][frame_parms->samples_per_slot_wCP],
int link_type)
{
int Ns = 0;
AssertFatal(symbol < frame_parms->symbols_per_slot, "slot_fep: symbol must be between 0 and %d\n", frame_parms->symbols_per_slot-1);
AssertFatal(Ns < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame-1);
unsigned int nb_prefix_samples = frame_parms->nb_prefix_samples;
unsigned int frame_length_samples = frame_parms->samples_per_frame;
dft_size_idx_t dftsize = get_dft(frame_parms->ofdm_symbol_size);
// This is for misalignment issues
int32_t tmp_dft_in[8192] __attribute__ ((aligned (32)));
unsigned int slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
unsigned int rx_offset = sample_offset + slot_offset;
rx_offset += (frame_parms->ofdm_symbol_size + nb_prefix_samples) * symbol + nb_prefix_samples;
#ifdef DEBUG_FEP
// if (ue->frame <100)
printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u\n",
Ns, symbol, nb_prefix_samples, nb_prefix_samples0, slot_offset, sample_offset, rx_offset, frame_length_samples);
#endif
for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
int16_t *rxdata_ptr;
rx_offset%=frame_length_samples*2;
if (rx_offset+frame_parms->ofdm_symbol_size > frame_length_samples*2 ) {
// This happens only during initial sync
if (rx_offset + frame_parms->ofdm_symbol_size > total_samples) {
// rxdata is 2 frames len
// we have to wrap on the end
memcpy((void *)&tmp_dft_in[0], (void *)&rxdata[aa][rx_offset], (frame_length_samples * 2 - rx_offset) * sizeof(int32_t));
memcpy((void *)&tmp_dft_in[frame_length_samples * 2 - rx_offset],
memcpy((void *)&tmp_dft_in[0], (void *)&rxdata[aa][rx_offset], (total_samples - rx_offset) * sizeof(int32_t));
memcpy((void *)&tmp_dft_in[total_samples - rx_offset],
(void *)&rxdata[aa][0],
(frame_parms->ofdm_symbol_size - (frame_length_samples * 2 - rx_offset)) * sizeof(int32_t));
(frame_parms->ofdm_symbol_size - (total_samples - rx_offset)) * sizeof(int32_t));
rxdata_ptr = (int16_t *)tmp_dft_in;
} else if ((rx_offset & 7) != 0) {
// if input to dft is not 256-bit aligned
} else if ((rx_offset & 7) != 0) { // if input to dft is not 256-bit aligned
memcpy((void *)&tmp_dft_in[0], (void *)&rxdata[aa][rx_offset], frame_parms->ofdm_symbol_size * sizeof(int32_t));
rxdata_ptr = (int16_t *)tmp_dft_in;
} else {
// use dft input from RX buffer directly
rxdata_ptr = (int16_t *)&rxdata[aa][rx_offset];
rxdata_ptr = (int16_t *)tmp_dft_in;
}
if (ue)
start_meas_nr_ue_phy(ue, RX_DFT_STATS);
dft(dftsize,
rxdata_ptr,
(int16_t *)&rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
1);
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
c16_t rot2 = frame_parms->symbol_rotation[link_type][symbol + symb_offset];
rot2.i=-rot2.i;
#ifdef DEBUG_FEP
// if (ue->frame <100)
printf("slot_fep: slot %d, symbol %d rx_offset %u, rotation symbol %d %d.%d\n", Ns,symbol, rx_offset,
symbol+symb_offset,rot2.r,rot2.i);
#endif
if (ue)
stop_meas_nr_ue_phy(ue, RX_DFT_STATS);
c16_t *this_symbol = &rxdataF[aa][frame_parms->ofdm_symbol_size*symbol];
rotate_cpx_vector(this_symbol, &rot2, this_symbol, frame_parms->ofdm_symbol_size, 15);
apply_nr_rotation_RX(frame_parms, rxdataF[aa], frame_parms->symbol_rotation[linktype], slot, N_RB, 0, symbol, 1);
}
#ifdef DEBUG_FEP
......@@ -191,7 +129,6 @@ int nr_slot_fep_init_sync(const NR_DL_FRAME_PARMS *frame_parms,
return 0;
}
int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
int32_t *rxdata,
int32_t *rxdataF,
......@@ -251,14 +188,14 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
return 0;
}
void apply_nr_rotation_RX(NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxdataF,
c16_t *rot,
int slot,
void apply_nr_rotation_RX(const NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxdataF,
const c16_t *rot,
int slot,
int nb_rb,
int soffset,
int first_symbol,
int nsymb)
int first_symbol,
int nsymb)
{
AssertFatal(first_symbol + nsymb <= NR_NUMBER_OF_SYMBOLS_PER_SLOT,
"First symbol %d and number of symbol %d not compatible with number of symbols in a slot %d\n",
......@@ -270,7 +207,7 @@ void apply_nr_rotation_RX(NR_DL_FRAME_PARMS *frame_parms,
c16_t rot2 = rot[symbol + symb_offset];
rot2.i = -rot2.i;
LOG_D(PHY,"slot %d, symb_offset %d rotating by %d.%d\n", slot, symb_offset, rot2.r, rot2.i);
c16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
const c16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
c16_t *this_symbol = &rxdataF[soffset + (frame_parms->ofdm_symbol_size * symbol)];
if (nb_rb & 1) {
......
......@@ -244,12 +244,7 @@ void nr_scan_ssb(void *arg)
const uint32_t rxdataF_sz = fp->samples_per_slot_wCP;
__attribute__((aligned(32))) c16_t rxdataF[fp->nb_antennas_rx][rxdataF_sz];
for (int i = 0; i < NR_N_SYMBOLS_SSB; i++)
nr_slot_fep_init_sync(fp,
i,
frame_id * fp->samples_per_frame + ssbInfo->ssbOffset,
(const c16_t **)rxdata,
rxdataF,
link_type_dl);
nr_slot_fep(NULL, fp, 0, i, rxdataF, link_type_dl, frame_id * fp->samples_per_frame + ssbInfo->ssbOffset, (c16_t **)rxdata);
int freq_offset_sss = 0;
int32_t metric_tdd_ncp = 0;
......
......@@ -447,7 +447,14 @@ 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 */
for (int symbol = 0; symbol < SL_NR_NUMSYM_SLSS_NORMAL_CP; symbol++) {
nr_slot_fep(UE, frame_parms, proc, symbol, rxdataF, link_type_sl, sync_params->ssb_offset);
nr_slot_fep(UE,
frame_parms,
proc->nr_slot_rx,
symbol,
rxdataF,
link_type_sl,
sync_params->ssb_offset,
UE->common_vars.rxdata);
}
sl_nr_extract_sss(UE, NULL, &metric_tdd_ncp, &phase_tdd_ncp, rxdataF);
......
......@@ -907,7 +907,14 @@ 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];
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, 0);
nr_slot_fep(ue,
fp,
proc->nr_slot_rx,
(ssb_start_symbol + i) % (fp->symbols_per_slot),
rxdataF,
link_type_dl,
0,
ue->common_vars.rxdata);
nr_pbch_channel_estimation(&ue->frame_parms,
NULL,
......@@ -971,7 +978,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++)
{
nr_slot_fep(ue, fp, proc, (j % fp->symbols_per_slot), rxdataF, link_type_dl, 0);
nr_slot_fep(ue, fp, proc->nr_slot_rx, (j % fp->symbols_per_slot), rxdataF, link_type_dl, 0, ue->common_vars.rxdata);
}
nr_prs_channel_estimation(gNB_id, rsc_id, i, ue, proc, fp, rxdataF);
}
......@@ -1000,7 +1007,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;
for (uint16_t l=0; l<nb_symb_pdcch; l++) {
nr_slot_fep(ue, fp, proc, l, rxdataF, link_type_dl, 0);
nr_slot_fep(ue, fp, proc->nr_slot_rx, l, rxdataF, link_type_dl, 0, ue->common_vars.rxdata);
}
// Hold the channel estimates in frequency domain.
......@@ -1050,7 +1057,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++) {
int symb = ue->csiim_vars[gNB_id]->csiim_config_pdu.l_csiim[symb_idx];
if (!slot_fep_map[symb]) {
nr_slot_fep(ue, &ue->frame_parms, proc, symb, rxdataF, link_type_dl, 0);
nr_slot_fep(ue, &ue->frame_parms, proc->nr_slot_rx, symb, rxdataF, link_type_dl, 0, ue->common_vars.rxdata);
slot_fep_map[symb] = true;
}
}
......@@ -1063,7 +1070,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++) {
if(is_csi_rs_in_symbol(ue->csirs_vars[gNB_id]->csirs_config_pdu, symb)) {
if (!slot_fep_map[symb]) {
nr_slot_fep(ue, &ue->frame_parms, proc, symb, rxdataF, link_type_dl, 0);
nr_slot_fep(ue, &ue->frame_parms, proc->nr_slot_rx, symb, rxdataF, link_type_dl, 0, ue->common_vars.rxdata);
slot_fep_map[symb] = true;
}
}
......@@ -1082,7 +1089,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++) {
if (!slot_fep_map[m]) {
nr_slot_fep(ue, &ue->frame_parms, proc, m, rxdataF, link_type_dl, 0);
nr_slot_fep(ue, &ue->frame_parms, proc->nr_slot_rx, m, rxdataF, link_type_dl, 0, ue->common_vars.rxdata);
slot_fep_map[m] = true;
}
}
......
......@@ -149,8 +149,12 @@ static int nr_ue_psbch_procedures(PHY_VARS_NR_UE *ue,
} else {
result = decoded_pdu;
sl_phy_params->psbch.rx_ok++;
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);
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);
......@@ -192,7 +196,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;
for (int sym = 0; sym < numsym;) {
nr_slot_fep(ue, fp, proc, sym, rxdataF, link_type_sl, 0);
nr_slot_fep(ue, fp, proc->nr_slot_rx, sym, rxdataF, link_type_sl, 0, ue->common_vars.rxdata);
start_meas(&sl_phy_params->channel_estimation_stats);
nr_pbch_channel_estimation(fp,
......
......@@ -799,7 +799,14 @@ int main(int argc, char **argv)
proc.nr_slot_rx = ssb_slot;
proc.gNB_id = 0;
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,0);
nr_slot_fep(UE,
frame_parms,
proc.nr_slot_rx,
i % frame_parms->symbols_per_slot,
rxdataF,
link_type_dl,
0,
UE->common_vars.rxdata);
nr_pbch_channel_estimation(&UE->frame_parms,
&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