Commit 5c6865fb authored by Thomas Schlichter's avatar Thomas Schlichter

5G NR: simplify init_timeshift_rotation()

Only Ncp1 is used, so get rid of the second timeshift_symbol_rotation array.
Also simplify the computation of "t0 * Tc * f".
parent 942037be
...@@ -747,69 +747,18 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { ...@@ -747,69 +747,18 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) {
void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp) void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
{ {
const double fd = 15e3*(float)(1<<fp->numerology_index); for (int i = 0; i < fp->ofdm_symbol_size; i++) {
const double Tc=(1/480e3/4096); double poff = -i * 2.0 * M_PI * 144.0 / 2048.0 / fp->ofdm_offset_divisor;
const double Ncp0=16*64 + (144*64*(1/(float)(1<<fp->numerology_index))); double exp_re = cos(poff);
const double Ncp1=(144*64*(1/(float)(1<<fp->numerology_index))); double exp_im = sin(-poff);
double t0; fp->timeshift_symbol_rotation[i*2] = (int16_t)round(exp_re * 32767);
double poff; fp->timeshift_symbol_rotation[i*2+1] = (int16_t)round(exp_im * 32767);
double exp_re;
double exp_im;
double f;
int16_t *timeshift_symbol_rotation;
int i;
for (i = 0; i < fp->ofdm_symbol_size/2; i++) {
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[0];
f = fd * i;
t0 = Ncp0 / fp->ofdm_offset_divisor;
poff = 2 * M_PI * -t0 * Tc * f;
exp_re = cos(poff);
exp_im = sin(-poff);
timeshift_symbol_rotation[i*2] = (int16_t)floor(exp_re * 32767);
timeshift_symbol_rotation[i*2+1] = (int16_t)floor(exp_im * 32767);
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[1];
t0 = Ncp1 / fp->ofdm_offset_divisor;
poff = 2 * M_PI * -t0 * Tc * f;
exp_re = cos(poff);
exp_im = sin(-poff);
timeshift_symbol_rotation[i*2] = (int16_t)floor(exp_re * 32767);
timeshift_symbol_rotation[i*2+1] = (int16_t)floor(exp_im * 32767);
if (i < 10) if (i < 10)
LOG_I(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",i, LOG_I(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",i,
fp->timeshift_symbol_rotation[0][i*2], fp->timeshift_symbol_rotation[i*2],
fp->timeshift_symbol_rotation[0][i*2+1], fp->timeshift_symbol_rotation[i*2+1],
poff);
}
i = 1;
for (int j = fp->ofdm_symbol_size-1; j > fp->ofdm_symbol_size/2-1; j--) {
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[0];
f = -fd * i;
t0 = Ncp0 / fp->ofdm_offset_divisor;
poff = 2 * M_PI * -t0 * Tc * f;
exp_re = cos(poff);
exp_im = sin(-poff);
timeshift_symbol_rotation[j*2] = (int16_t)ceil(exp_re * 32767);
timeshift_symbol_rotation[j*2+1] = (int16_t)ceil(exp_im * 32767);
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[1];
t0 = Ncp1 / fp->ofdm_offset_divisor;
poff = 2 * M_PI * -t0 * Tc * f;
exp_re = cos(poff);
exp_im = sin(-poff);
timeshift_symbol_rotation[j*2] = (int16_t)ceil(exp_re * 32767);
timeshift_symbol_rotation[j*2+1] = (int16_t)ceil(exp_im * 32767);
if (j > fp->ofdm_symbol_size-10-1)
LOG_I(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",-i,
fp->timeshift_symbol_rotation[0][j*2],
fp->timeshift_symbol_rotation[0][j*2+1],
poff); poff);
i++;
} }
} }
......
...@@ -158,7 +158,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -158,7 +158,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
frame_parms->ofdm_symbol_size, frame_parms->ofdm_symbol_size,
15); 15);
int16_t *shift_rot = frame_parms->timeshift_symbol_rotation[1]; int16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
multadd_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], multadd_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
shift_rot, shift_rot,
...@@ -367,7 +367,7 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, ...@@ -367,7 +367,7 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
length, length,
15); 15);
int16_t *shift_rot = frame_parms->timeshift_symbol_rotation[1]; int16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
multadd_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol], multadd_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
shift_rot, shift_rot,
......
...@@ -331,7 +331,7 @@ struct NR_DL_FRAME_PARMS { ...@@ -331,7 +331,7 @@ struct NR_DL_FRAME_PARMS {
int16_t symbol_rotation[2][224*2]; int16_t symbol_rotation[2][224*2];
/// sequence used to compensate the phase rotation due to timeshifted OFDM symbols /// sequence used to compensate the phase rotation due to timeshifted OFDM symbols
/// First dimenstion is for different CP lengths /// First dimenstion is for different CP lengths
int16_t timeshift_symbol_rotation[2][4096*2] __attribute__ ((aligned (16))); int16_t timeshift_symbol_rotation[4096*2] __attribute__ ((aligned (16)));
/// shift of pilot position in one RB /// shift of pilot position in one RB
uint8_t nushift; uint8_t nushift;
/// SRS configuration from TS 38.331 RRC /// SRS configuration from TS 38.331 RRC
......
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