Commit dd275d01 authored by Thomas Schlichter's avatar Thomas Schlichter

improve nr_slot_fep() and variants

parent eab6379b
...@@ -51,16 +51,13 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, ...@@ -51,16 +51,13 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
int nr_slot_fep(PHY_VARS_NR_UE *phy_vars_ue, int nr_slot_fep(PHY_VARS_NR_UE *phy_vars_ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
unsigned char l, unsigned char l,
unsigned char Ns, unsigned char Ns);
int sample_offset,
int no_prefix);
int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
unsigned char symbol, unsigned char symbol,
unsigned char Ns, unsigned char Ns,
int sample_offset, int sample_offset);
int no_prefix);
int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue, int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue,
unsigned char l, unsigned char l,
......
...@@ -74,7 +74,6 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, ...@@ -74,7 +74,6 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue,
\param symbol symbol within slot (0..12/14) \param symbol symbol within slot (0..12/14)
\param Ns Slot number (0..19) \param Ns Slot number (0..19)
\param sample_offset offset within rxdata (points to beginning of subframe) \param sample_offset offset within rxdata (points to beginning of subframe)
\param no_prefix if 1 prefix is removed by HW
*/ */
int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
...@@ -82,8 +81,7 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, ...@@ -82,8 +81,7 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
int32_t *rxdataF, int32_t *rxdataF,
unsigned char symbol, unsigned char symbol,
unsigned char Ns, unsigned char Ns,
int sample_offset, int sample_offset);
int no_prefix);
/*! /*!
\brief This function implements the dft transform precoding in PUSCH \brief This function implements the dft transform precoding in PUSCH
......
...@@ -29,362 +29,224 @@ ...@@ -29,362 +29,224 @@
//#define DEBUG_FEP //#define DEBUG_FEP
#define SOFFSET 0
/*#ifdef LOG_I /*#ifdef LOG_I
#undef LOG_I #undef LOG_I
#define LOG_I(A,B...) printf(A) #define LOG_I(A,B...) printf(A)
#endif*/ #endif*/
int nr_slot_fep(PHY_VARS_NR_UE *ue, dft_size_idx_t get_dft_size_idx(uint16_t ofdm_symbol_size)
UE_nr_rxtx_proc_t *proc,
unsigned char symbol,
unsigned char Ns,
int sample_offset,
int no_prefix)
{ {
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; switch (ofdm_symbol_size) {
NR_UE_COMMON *common_vars = &ue->common_vars;
unsigned char aa;
unsigned int nb_prefix_samples;
unsigned int nb_prefix_samples0;
unsigned int abs_symbol;
if (ue->is_synchronized) {
nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
}
else {
nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
}
//unsigned int subframe_offset;//,subframe_offset_F;
unsigned int slot_offset;
//int i;
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
unsigned int rx_offset;
dft_size_idx_t dftsize;
int tmp_dft_in[8192] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs
switch (frame_parms->ofdm_symbol_size) {
case 128: case 128:
dftsize = DFT_128; return DFT_128;
break;
case 256: case 256:
dftsize = DFT_256; return DFT_256;
break;
case 512: case 512:
dftsize = DFT_512; return DFT_512;
break;
case 1024: case 1024:
dftsize = DFT_1024; return DFT_1024;
break;
case 1536: case 1536:
dftsize = DFT_1536; return DFT_1536;
break;
case 2048: case 2048:
dftsize = DFT_2048; return DFT_2048;
break;
case 3072: case 3072:
dftsize = DFT_3072; return DFT_3072;
break;
case 4096: case 4096:
dftsize = DFT_4096; return DFT_4096;
break;
case 6144:
return DFT_6144;
case 8192: case 8192:
dftsize = DFT_8192; return DFT_8192;
break;
default: default:
printf("unsupported ofdm symbol size \n"); printf("unsupported ofdm symbol size \n");
assert(0); assert(0);
} }
if (no_prefix) { return DFT_SIZE_IDXTABLESIZE;
slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_slot) * (Ns); }
} else {
slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
}
/*if (l<0 || l>=7-frame_parms->Ncp) { int nr_slot_fep(PHY_VARS_NR_UE *ue,
printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp); UE_nr_rxtx_proc_t *proc,
return(-1); unsigned char symbol,
}*/ unsigned char Ns)
{
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
NR_UE_COMMON *common_vars = &ue->common_vars;
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);
if (Ns<0 || Ns>(frame_parms->slots_per_frame-1)) { unsigned int nb_prefix_samples;
printf("slot_fep: Ns must be between 0 and %d\n",frame_parms->slots_per_frame-1); unsigned int nb_prefix_samples0;
return(-1); if (ue->is_synchronized) {
nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = frame_parms->nb_prefix_samples0;
} else {
nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = frame_parms->nb_prefix_samples;
} }
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { dft_size_idx_t dftsize = get_dft_size_idx(frame_parms->ofdm_symbol_size);
memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int)); // This is for misalignment issues
int32_t tmp_dft_in[8192] __attribute__ ((aligned (32)));
rx_offset = sample_offset + slot_offset - SOFFSET; unsigned int rx_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
// Align with 256 bit unsigned int abs_symbol = Ns * frame_parms->symbols_per_slot + symbol;
// rx_offset = rx_offset&0xfffffff8; for (int idx_symb = Ns*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;
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
// if (ue->frame <100) // if (ue->frame <100)
/*LOG_I(PHY,*/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", printf("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, slot_offset, sample_offset, rx_offset, frame_length_samples); Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset);
#endif #endif
abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t));
for (int idx_symb = Ns*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;
if (abs_symbol%(0x7<<frame_parms->numerology_index)) {
rx_offset += nb_prefix_samples;
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
memcpy((short*) &common_vars->rxdata[aa][frame_length_samples],
(short*) &common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs
memcpy((void *)tmp_dft_in,
(void *) &common_vars->rxdata[aa][rx_offset % frame_length_samples],
frame_parms->ofdm_symbol_size*sizeof(int));
dft(dftsize,(int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} else { // use dft input from RX buffer directly
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
dft(dftsize,(int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples], int16_t *rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset];
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
#if UE_TIMING_TRACE // if input to dft is not 256-bit aligned
stop_meas(&ue->rx_dft_stats); if ((rx_offset & 7) != 0) {
#endif memcpy((void *)&tmp_dft_in[0],
} (void *)&common_vars->rxdata[aa][rx_offset],
} else { frame_parms->ofdm_symbol_size * sizeof(int32_t));
rxdata_ptr = (int16_t *)tmp_dft_in;
}
rx_offset += nb_prefix_samples0;
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
memcpy((void *) &common_vars->rxdata[aa][frame_length_samples],
(void *) &common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats); start_meas(&ue->rx_dft_stats);
#endif #endif
if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs dft(dftsize,
memcpy((void *)tmp_dft_in, rxdata_ptr,
(void *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples], (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
frame_parms->ofdm_symbol_size*sizeof(int)); 1);
dft(dftsize,(int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} else { // use dft input from RX buffer directly
dft(dftsize,(int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
}
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats); stop_meas(&ue->rx_dft_stats);
#endif #endif
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
} int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset];
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
// if (ue->frame <100) // if (ue->frame <100)
printf("slot_fep: symbol %d rx_offset %u\n", symbol, rx_offset); printf("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 #endif
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset];
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
rotate_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], rotate_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
(int16_t*)&rot2, (int16_t*)&rot2,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
frame_parms->ofdm_symbol_size, frame_parms->ofdm_symbol_size,
15); 15);
} }
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
printf("slot_fep: done\n"); printf("slot_fep: done\n");
#endif #endif
return(0);
return 0;
} }
int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
unsigned char symbol, unsigned char symbol,
unsigned char Ns, unsigned char Ns,
int sample_offset, int sample_offset)
int no_prefix)
{ {
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
NR_UE_COMMON *common_vars = &ue->common_vars; NR_UE_COMMON *common_vars = &ue->common_vars;
unsigned char aa;
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; unsigned int nb_prefix_samples;
unsigned int nb_prefix_samples0; unsigned int nb_prefix_samples0;
unsigned int abs_symbol;
if (ue->is_synchronized) { if (ue->is_synchronized) {
nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0); nb_prefix_samples0 = frame_parms->nb_prefix_samples0;
} }
else { else {
nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples); nb_prefix_samples0 = frame_parms->nb_prefix_samples;
} }
//unsigned int subframe_offset;//,subframe_offset_F; unsigned int frame_length_samples = frame_parms->samples_per_frame;
unsigned int slot_offset;
//int i;
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
unsigned int rx_offset;
dft_size_idx_t dftsize = get_dft_size_idx(frame_parms->ofdm_symbol_size);
// This is for misalignment issues
int32_t tmp_dft_in[8192] __attribute__ ((aligned (32)));
dft_size_idx_t dftsize; unsigned int slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
int tmp_dft_in[8192] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs unsigned int rx_offset = sample_offset + slot_offset;
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++)
rx_offset += (abs_symbol%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
rx_offset += frame_parms->ofdm_symbol_size * symbol;
switch (frame_parms->ofdm_symbol_size) { #ifdef DEBUG_FEP
case 128: // if (ue->frame <100)
dftsize = DFT_128; 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",
break; Ns, symbol, nb_prefix_samples, nb_prefix_samples0, slot_offset, sample_offset, rx_offset, frame_length_samples);
#endif
case 256:
dftsize = DFT_256;
break;
case 512:
dftsize = DFT_512;
break;
case 1024:
dftsize = DFT_1024;
break;
case 1536:
dftsize = DFT_1536;
break;
case 2048:
dftsize = DFT_2048;
break;
case 3072:
dftsize = DFT_3072;
break;
case 4096:
dftsize = DFT_4096;
break;
case 8192:
dftsize = DFT_8192;
break;
default: for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
printf("unsupported ofdm symbol size \n"); memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t));
assert(0);
}
if (no_prefix) { int16_t *rxdata_ptr;
slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_slot) * (Ns);
} else {
slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
}
/*if (l<0 || l>=7-frame_parms->Ncp) { if (frame_length_samples - rx_offset < frame_parms->ofdm_symbol_size) {
printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
return(-1);
}*/
if (Ns<0 || Ns>(frame_parms->slots_per_frame-1)) { memcpy((void *)&tmp_dft_in[0],
printf("slot_fep: Ns must be between 0 and %d\n",frame_parms->slots_per_frame-1); (void *)&common_vars->rxdata[aa][rx_offset],
return(-1); (frame_length_samples - rx_offset) * sizeof(int32_t));
} memcpy((void *)&tmp_dft_in[frame_length_samples - rx_offset],
(void *)&common_vars->rxdata[aa][0],
(frame_parms->ofdm_symbol_size - (frame_length_samples - rx_offset)) * sizeof(int32_t));
rxdata_ptr = (int16_t *)&tmp_dft_in[0];
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { } else if ((rx_offset & 7) != 0) {
memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
rx_offset = sample_offset + slot_offset - SOFFSET; // if input to dft is not 256-bit aligned
// Align with 256 bit memcpy((void *)&tmp_dft_in[0],
// rx_offset = rx_offset&0xfffffff8; (void *)&common_vars->rxdata[aa][rx_offset],
frame_parms->ofdm_symbol_size * sizeof(int32_t));
rxdata_ptr = (int16_t *)&tmp_dft_in[0];
#ifdef DEBUG_FEP } else {
// if (ue->frame <100)
/*LOG_I(PHY,*/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
abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; // use dft input from RX buffer directly
rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset];
for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb < abs_symbol; idx_symb++)
rx_offset += (abs_symbol%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
rx_offset += frame_parms->ofdm_symbol_size * symbol;
if (abs_symbol%(0x7<<frame_parms->numerology_index)) {
rx_offset += nb_prefix_samples;
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
memcpy((short*) &common_vars->rxdata[aa][frame_length_samples],
(short*) &common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs
memcpy((void *)tmp_dft_in,
(void *) &common_vars->rxdata[aa][rx_offset],
frame_parms->ofdm_symbol_size*sizeof(int));
dft(dftsize,(int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} else { // use dft input from RX buffer directly
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
}
dft(dftsize,(int16_t *) &common_vars->rxdata[aa][rx_offset],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats); start_meas(&ue->rx_dft_stats);
#endif #endif
}
} else {
rx_offset += nb_prefix_samples0; dft(dftsize,
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) rxdata_ptr,
memcpy((void *) &common_vars->rxdata[aa][frame_length_samples], (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
(void *) &common_vars->rxdata[aa][0], 1);
frame_parms->ofdm_symbol_size*sizeof(int));
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
memcpy((void *)tmp_dft_in,
(void *) &common_vars->rxdata[aa][rx_offset],
frame_parms->ofdm_symbol_size*sizeof(int));
dft(dftsize,(int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} else { // use dft input from RX buffer directly
dft(dftsize,(int16_t *) &common_vars->rxdata[aa][rx_offset],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
}
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats); stop_meas(&ue->rx_dft_stats);
#endif #endif
}
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset]; int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset];
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
...@@ -400,14 +262,13 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, ...@@ -400,14 +262,13 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
frame_parms->ofdm_symbol_size, frame_parms->ofdm_symbol_size,
15); 15);
} }
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
printf("slot_fep: done\n"); printf("slot_fep: done\n");
#endif #endif
return(0);
return 0;
} }
...@@ -416,91 +277,60 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, ...@@ -416,91 +277,60 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
int32_t *rxdataF, int32_t *rxdataF,
unsigned char symbol, unsigned char symbol,
unsigned char Ns, unsigned char Ns,
int sample_offset, int sample_offset)
int no_prefix)
{ {
int32_t slot_offset, rxdata_offset; unsigned int nb_prefix_samples = frame_parms->nb_prefix_samples;
unsigned int nb_prefix_samples0 = frame_parms->nb_prefix_samples0;
unsigned int nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
int tmp_dft_in[8192] __attribute__ ((aligned (32))); dft_size_idx_t dftsize = get_dft_size_idx(frame_parms->ofdm_symbol_size);
// This is for misalignment issues
int32_t tmp_dft_in[8192] __attribute__ ((aligned (32)));
dft_size_idx_t dftsize; unsigned int slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
switch (frame_parms->ofdm_symbol_size) { // offset of first OFDM symbol
case 128: int32_t rxdata_offset = slot_offset + nb_prefix_samples0;
dftsize = DFT_128; // offset of n-th OFDM symbol
break; rxdata_offset += symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples);
// use OFDM symbol from within 1/8th of the CP to avoid ISI
rxdata_offset -= nb_prefix_samples / 8;
case 256: int16_t *rxdata_ptr;
dftsize = DFT_256;
break;
case 512: if(sample_offset > rxdata_offset) {
dftsize = DFT_512;
break;
case 1024: memcpy((void *)&tmp_dft_in[0],
dftsize = DFT_1024; (void *)&rxdata[frame_parms->samples_per_frame - sample_offset + rxdata_offset],
break; (sample_offset - rxdata_offset) * sizeof(int32_t));
memcpy((void *)&tmp_dft_in[sample_offset - rxdata_offset],
(void *)&rxdata[0],
(frame_parms->ofdm_symbol_size - sample_offset + rxdata_offset) * sizeof(int32_t));
rxdata_ptr = (int16_t *)&tmp_dft_in[0];
case 1536: } else if (((rxdata_offset - sample_offset) & 7) != 0) {
dftsize = DFT_1536;
break;
case 2048: // if input to dft is not 256-bit aligned
dftsize = DFT_2048; memcpy((void *)&tmp_dft_in[0],
break; (void *)&rxdata[rxdata_offset - sample_offset],
(frame_parms->ofdm_symbol_size) * sizeof(int32_t));
rxdata_ptr = (int16_t *)&tmp_dft_in[0];
case 4096: } else {
dftsize = DFT_4096;
break;
case 8192: // use dft input from RX buffer directly
dftsize = DFT_8192; rxdata_ptr = (int16_t *)&rxdata[rxdata_offset - sample_offset];
break;
default:
dftsize = DFT_512;
break;
} }
slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
// offset of first OFDM symbol
rxdata_offset = slot_offset + nb_prefix_samples0 - SOFFSET;
// offset of n-th OFDM symbol
rxdata_offset += symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples);
// use OFDM symbol from within 1/8th of the CP to avoid ISI
rxdata_offset -= nb_prefix_samples / 8;
if(sample_offset>rxdata_offset) {
memcpy1((void *)tmp_dft_in,
(void *) &rxdata[frame_parms->samples_per_frame-sample_offset+rxdata_offset],
(sample_offset-rxdata_offset)*sizeof(int));
memcpy1((void *)&tmp_dft_in[sample_offset-rxdata_offset],
(void *) &rxdata[0],
(frame_parms->ofdm_symbol_size-sample_offset+rxdata_offset)*sizeof(int));
dft(dftsize,(int16_t *)&tmp_dft_in, dft(dftsize,
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1); rxdata_ptr,
} (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size],
else { 1);
//dft(dftsize,(int16_t *)&rxdata[rxdata_offset-sample_offset],
// (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
memcpy((void *)tmp_dft_in,
(void *) &rxdata[rxdata_offset-sample_offset],
(frame_parms->ofdm_symbol_size)*sizeof(int));
dft(dftsize,(int16_t *)&tmp_dft_in,
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
}
// clear DC carrier from OFDM symbols // clear DC carrier from OFDM symbols
rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0; rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0;
return(0); return 0;
} }
void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
......
...@@ -289,8 +289,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) ...@@ -289,8 +289,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames)
proc, proc,
i, i,
0, 0,
is*fp->samples_per_frame+ue->ssb_offset, is*fp->samples_per_frame+ue->ssb_offset);
0);
#ifdef DEBUG_INITIAL_SYNCH #ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"Calling sss detection (normal CP)\n"); LOG_I(PHY,"Calling sss detection (normal CP)\n");
......
...@@ -520,8 +520,7 @@ void nr_fep0(RU_t *ru, int first_half) { ...@@ -520,8 +520,7 @@ void nr_fep0(RU_t *ru, int first_half) {
ru->common.rxdataF[aa], ru->common.rxdataF[aa],
l, l,
proc->tti_rx, proc->tti_rx,
ru->N_TA_offset, ru->N_TA_offset);
0);
} }
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+proc->tti_rx, 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+proc->tti_rx, 0);
...@@ -657,8 +656,7 @@ void nr_fep_full(RU_t *ru, int slot) { ...@@ -657,8 +656,7 @@ void nr_fep_full(RU_t *ru, int slot) {
ru->common.rxdataF[aa], ru->common.rxdataF[aa],
l, l,
proc->tti_rx, proc->tti_rx,
ru->N_TA_offset, ru->N_TA_offset);
0);
} }
} }
......
...@@ -508,15 +508,12 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -508,15 +508,12 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
unsigned char aa; unsigned char aa;
for(symbol = 0; symbol < (gNB->frame_parms.Ncp==EXTENDED?12:14); symbol++) { for(symbol = 0; symbol < (gNB->frame_parms.Ncp==EXTENDED?12:14); symbol++) {
// nr_slot_fep_ul(gNB, symbol, proc->slot_rx, 0, 0);
for (aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) { for (aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
nr_slot_fep_ul(&gNB->frame_parms, nr_slot_fep_ul(&gNB->frame_parms,
gNB->common_vars.rxdata[aa], gNB->common_vars.rxdata[aa],
gNB->common_vars.rxdataF[aa], gNB->common_vars.rxdataF[aa],
symbol, symbol,
slot_rx, slot_rx,
0,
0); 0);
} }
} }
......
...@@ -1689,9 +1689,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1689,9 +1689,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
nr_slot_fep(ue, nr_slot_fep(ue,
proc, proc,
(ue->symbol_offset+i)%(fp->symbols_per_slot), (ue->symbol_offset+i)%(fp->symbols_per_slot),
nr_slot_rx, nr_slot_rx);
0,
0);
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->dlsch_channel_estimation_stats); start_meas(&ue->dlsch_channel_estimation_stats);
...@@ -1744,9 +1742,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1744,9 +1742,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
nr_slot_fep(ue, nr_slot_fep(ue,
proc, proc,
l, l,
nr_slot_rx, nr_slot_rx);
0,
0);
dci_cnt = 0; dci_cnt = 0;
for(int n_ss = 0; n_ss<pdcch_vars->nb_search_space; n_ss++) { for(int n_ss = 0; n_ss<pdcch_vars->nb_search_space; n_ss++) {
...@@ -1805,9 +1801,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1805,9 +1801,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
nr_slot_fep(ue, nr_slot_fep(ue,
proc, proc,
m, //to be updated from higher layer m, //to be updated from higher layer
nr_slot_rx, nr_slot_rx);
0,
0);
} }
} }
} else { } else {
......
...@@ -692,9 +692,7 @@ int main(int argc, char **argv) ...@@ -692,9 +692,7 @@ int main(int argc, char **argv)
nr_slot_fep(UE, nr_slot_fep(UE,
&proc, &proc,
i%frame_parms->symbols_per_slot, i%frame_parms->symbols_per_slot,
ssb_slot, ssb_slot);
0,
0);
nr_pbch_channel_estimation(UE,&proc,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf); nr_pbch_channel_estimation(UE,&proc,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
......
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