Commit 215f263a authored by Sakthivel Velumani's avatar Sakthivel Velumani

Making sample offset as cmd line parameter

for gNB its in L1 section of config file
for UE its a cmd line paramenter
parent 11111bcd
......@@ -242,6 +242,7 @@ void init_tpools(uint8_t nun_dlsch_threads) {
}
static void get_options(void) {
nrUE_params.ofdm_offset_divisor = 8;
paramdef_t cmdline_params[] =CMDLINE_NRUEPARAMS_DESC ;
int numparams = sizeof(cmdline_params)/sizeof(paramdef_t);
config_process_cmdline( cmdline_params,numparams,NULL);
......@@ -325,6 +326,8 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs);
fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor;
}
void init_openair0(void) {
......
......@@ -8,7 +8,8 @@
#define CONFIG_HLP_DLSCH_PARA "number of threads for dlsch processing 0 for no parallelization"
#define CONFIG_HLP_DLSCH_PARA "number of threads for dlsch processing 0 for no parallelization\n"
#define CONFIG_HLP_OFFSET_DIV "Divisor for computing OFDM symbol offset in Rx chain (num samples in CP/<the value>). Default value is 8. To set the sample offset to 0, set this value ~ 10e6\n"
/***************************************************************************************************************************************/
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
when calling config_get or config_getlist functions */
......@@ -29,6 +30,7 @@
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, iptr:(int32_t *)&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \
{"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, uptr:(uint32_t *)&nrUE_params.ofdm_offset_divisor, defuintval:UINT_MAX, TYPE_UINT32, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \
......@@ -66,6 +68,7 @@
typedef struct {
uint64_t optmask; //mask to store boolean config options
uint32_t ofdm_offset_divisor; // Divisor for sample offset computation for each OFDM symbol
uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization
tpool_t Tpool; // thread pool
} nrUE_params_t;
......
......@@ -483,6 +483,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
nr_init_frame_parms(gNB_config, fp);
fp->ofdm_offset_divisor = UINT_MAX;
gNB->configured = 1;
LOG_I(PHY,"gNB configured\n");
}
......@@ -534,6 +535,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
// }
RC.gNB[Mod_id]->configured = 1;
fp->ofdm_offset_divisor = RC.gNB[Mod_id]->ofdm_offset_divisor;
init_symbol_rotation(fp);
init_timeshift_rotation(fp);
......
......@@ -762,7 +762,7 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
for (i = 0; i < fp->ofdm_symbol_size/2; i++) {
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[0];
f = fd * i;
t0 = Ncp0 / 8;
t0 = Ncp0 / fp->ofdm_offset_divisor;
poff = 2 * M_PI * -t0 * Tc * f;
exp_re = cos(poff);
exp_im = sin(-poff);
......@@ -770,7 +770,7 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
timeshift_symbol_rotation[i*2+1] = (int16_t)floor(exp_im * 32767);
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[1];
t0 = Ncp1 / 8;
t0 = Ncp1 / fp->ofdm_offset_divisor;
poff = 2 * M_PI * -t0 * Tc * f;
exp_re = cos(poff);
exp_im = sin(-poff);
......@@ -779,8 +779,8 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
if (i < 10)
LOG_I(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",i,
fp->timeshift_symbol_rotation[1][i*2],
fp->timeshift_symbol_rotation[1][i*2+1],
fp->timeshift_symbol_rotation[0][i*2],
fp->timeshift_symbol_rotation[0][i*2+1],
poff);
}
......@@ -789,25 +789,25 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
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 / 8;
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)floor(exp_re * 32767);
timeshift_symbol_rotation[j*2+1] = (int16_t)floor(exp_im * 32767);
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 / 8;
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)floor(exp_re * 32767);
timeshift_symbol_rotation[j*2+1] = (int16_t)floor(exp_im * 32767);
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[1][j*2],
fp->timeshift_symbol_rotation[1][j*2+1],
fp->timeshift_symbol_rotation[0][j*2],
fp->timeshift_symbol_rotation[0][j*2+1],
poff);
i++;
}
......
......@@ -107,7 +107,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
rx_offset += frame_parms->ofdm_symbol_size * symbol;
// use OFDM symbol from within 1/8th of the CP to avoid ISI
rx_offset -= nb_prefix_samples / 8;
rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
#ifdef DEBUG_FEP
// if (ue->frame <100)
......@@ -158,11 +158,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
frame_parms->ofdm_symbol_size,
15);
int16_t *shift_rot;
if (symb_offset+symbol == (7 * (1 << frame_parms->numerology_index)))
shift_rot = frame_parms->timeshift_symbol_rotation[0];
else
shift_rot = frame_parms->timeshift_symbol_rotation[1];
int16_t *shift_rot = frame_parms->timeshift_symbol_rotation[0];
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,
......@@ -309,7 +305,7 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
// 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;
rxdata_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
int16_t *rxdata_ptr;
......@@ -370,11 +366,7 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
length,
15);
int16_t *shift_rot;
if (symb_offset+symbol == (7 * (1 << frame_parms->numerology_index)))
shift_rot = frame_parms->timeshift_symbol_rotation[0];
else
shift_rot = frame_parms->timeshift_symbol_rotation[1];
int16_t *shift_rot = frame_parms->timeshift_symbol_rotation[0];
multadd_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
shift_rot,
......
......@@ -45,7 +45,7 @@ int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id)
NR_gNB_PUSCH *gNB_pusch_vars = gNB->pusch_vars[UE_id];
int32_t **ul_ch_estimates_time = gNB_pusch_vars->ul_ch_estimates_time;
int sync_pos = frame_parms->nb_prefix_samples / 8;
int sync_pos = frame_parms->nb_prefix_samples / frame_parms->ofdm_offset_divisor;
for (i = 0; i < frame_parms->ofdm_symbol_size; i++) {
int temp = 0;
......
......@@ -82,7 +82,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
// do not filter to have proactive timing adjustment
//max_pos_fil = max_pos;
diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3);
diff = max_pos_fil - (frame_parms->nb_prefix_samples / frame_parms->ofdm_offset_divisor);
if (frame_parms->freq_range==nr_FR2)
sync_offset = 2;
......
......@@ -776,6 +776,8 @@ typedef struct PHY_VARS_gNB_s {
uint32_t max_peak_val;
/// OFDM symbol offset divisor for UL
uint32_t ofdm_offset_divisor;
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
/// first index: ? [0..N_RB_DL*12[
double *sinr_dB;
......
......@@ -365,6 +365,8 @@ struct NR_DL_FRAME_PARMS {
uint8_t ssb_index;
/// PBCH polar encoder params
t_nrPolar_params pbch_polar_params;
/// OFDM symbol offset divisor for UL
uint32_t ofdm_offset_divisor;
};
......
......@@ -619,6 +619,7 @@ int main(int argc, char **argv)
memset(RC.gNB[0],0,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
gNB->ofdm_offset_divisor = UINT_MAX;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx;
......
......@@ -109,7 +109,9 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
fp->ofdm_offset_divisor = UINT_MAX;
nr_init_frame_parms(gNB_config, fp);
init_timeshift_rotation(fp);
init_symbol_rotation(fp);
......@@ -405,6 +407,7 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
gNB->ofdm_offset_divisor = UINT_MAX;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx;
......
......@@ -616,6 +616,7 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
gNB->ofdm_offset_divisor = UINT_MAX;
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
char tp_param[] = "n";
......
......@@ -47,6 +47,7 @@
#define CONFIG_STRING_L1_REMOTE_N_PORTD "remote_n_portd"
#define CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE "tr_n_preference"
#define CONFIG_STRING_L1_PUSCH_PROC_THREADS "pusch_proc_threads"
#define CONFIG_STRING_L1_OFDM_OFFSET_DIVISOR "ofdm_offset_divisor"
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/* L1 configuration parameters */
......@@ -62,7 +63,8 @@
{CONFIG_STRING_L1_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:3, TYPE_UINT, 0} \
{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:3, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_OFDM_OFFSET_DIVISOR, NULL, 0, uptr:NULL, defuintval:UINT_MAX, TYPE_UINT, 0} \
}
#define L1_CC_IDX 0
#define L1_TRANSPORT_N_PREFERENCE_IDX 1
......@@ -74,6 +76,7 @@
#define L1_LOCAL_N_PORTD_IDX 7
#define L1_REMOTE_N_PORTD_IDX 8
#define L1_PUSCH_PROC_THREADS 9
#define L1_OFDM_OFFSET_DIVISOR 10
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
#endif
......@@ -591,6 +591,7 @@ void RCconfig_NR_L1(void) {
}
RC.gNB[j]->pusch_proc_threads = *(L1_ParamList.paramarray[j][L1_PUSCH_PROC_THREADS].uptr);
RC.gNB[j]->ofdm_offset_divisor = *(L1_ParamList.paramarray[j][L1_OFDM_OFFSET_DIVISOR].uptr);
if(strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
//sf_ahead = 2; // Need 4 subframe gap between RX and TX
......
......@@ -235,6 +235,7 @@ L1s = (
num_cc = 1;
tr_n_preference = "local_mac";
pusch_proc_threads = 8;
ofdm_offset_divisor = 8;
}
);
......
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