check if the slot selected is valid for DL/UL in dlsim/ulsim
This commit is contained in:
@@ -537,8 +537,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
run_initial_sync=1;
|
||||
//target_error_rate=0.1;
|
||||
run_initial_sync = 1;
|
||||
slot = 0;
|
||||
break;
|
||||
|
||||
@@ -552,6 +551,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
AssertFatal(run_initial_sync == 0, "Cannot use Y and H options at the same time\n");
|
||||
slot = atoi(optarg);
|
||||
break;
|
||||
|
||||
@@ -653,6 +653,11 @@ int main(int argc, char **argv)
|
||||
fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu);
|
||||
fix_scc(scc, ssb_bitmap);
|
||||
|
||||
frame_structure_t frame_structure = {0};
|
||||
frame_type_t frame_type = TDD;
|
||||
config_frame_structure(mu, scc, get_tdd_period_idx(scc->tdd_UL_DL_ConfigurationCommon), frame_type, &frame_structure);
|
||||
AssertFatal(is_dl_slot(slot, &frame_structure), "The slot selected is not DL. Can't run DLSIM\n");
|
||||
|
||||
// TODO do a UECAP for phy-sim
|
||||
nr_pdsch_AntennaPorts_t pdsch_AntennaPorts = {0};
|
||||
pdsch_AntennaPorts.N1 = n_tx > 1 ? n_tx >> 1 : 1;
|
||||
|
||||
@@ -626,6 +626,11 @@ int main(int argc, char *argv[])
|
||||
fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu);
|
||||
fix_scc(scc,ssb_bitmap);
|
||||
|
||||
frame_structure_t frame_structure = {0};
|
||||
frame_type_t frame_type = TDD;
|
||||
config_frame_structure(mu, scc, get_tdd_period_idx(scc->tdd_UL_DL_ConfigurationCommon), frame_type, &frame_structure);
|
||||
AssertFatal(is_ul_slot(slot, &frame_structure), "The slot selected is not UL. Can't run ULSIM\n");
|
||||
|
||||
// TODO do a UECAP for phy-sim
|
||||
const nr_mac_config_t conf = {.pdsch_AntennaPorts = {.N1 = 1, .N2 = 1, .XP = 1},
|
||||
.pusch_AntennaPorts = n_rx,
|
||||
|
||||
@@ -500,34 +500,28 @@ int get_ul_slot_offset(const frame_structure_t *fs, int idx, bool count_mixed)
|
||||
*
|
||||
* @param mu numerology
|
||||
* @param scc pointer to scc
|
||||
* @param cfg pointer to NFAPI config request
|
||||
* @param tdd_period TDD period
|
||||
* @param frame_type type of frame structure (FDD or TDD)
|
||||
* @param fs pointer to the frame structure to update
|
||||
*
|
||||
* @return Number of periods in frame
|
||||
*/
|
||||
static int config_frame_structure(int mu,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
nfapi_nr_config_request_scf_t *cfg,
|
||||
frame_structure_t *fs)
|
||||
void config_frame_structure(int mu,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
uint8_t tdd_period,
|
||||
uint8_t frame_type,
|
||||
frame_structure_t *fs)
|
||||
{
|
||||
fs->numb_slots_frame = nr_slots_per_frame[mu];
|
||||
if (cfg->cell_config.frame_duplex_type.value == TDD) {
|
||||
cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->tdd_table.tdd_period.value = get_tdd_period_idx(scc->tdd_UL_DL_ConfigurationCommon);
|
||||
LOG_D(NR_MAC, "Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period.value);
|
||||
fs->numb_period_frame = get_nb_periods_per_frame(cfg->tdd_table.tdd_period.value);
|
||||
if (frame_type == TDD) {
|
||||
fs->numb_period_frame = get_nb_periods_per_frame(tdd_period);
|
||||
fs->numb_slots_period = fs->numb_slots_frame / fs->numb_period_frame;
|
||||
fs->is_tdd = true;
|
||||
config_tdd_patterns(scc->tdd_UL_DL_ConfigurationCommon, fs);
|
||||
set_tdd_config_nr(cfg, fs);
|
||||
} else { // FDD
|
||||
fs->is_tdd = false;
|
||||
fs->numb_period_frame = 1;
|
||||
fs->numb_slots_period = nr_slots_per_frame[mu];
|
||||
}
|
||||
AssertFatal(fs->numb_period_frame > 0, "Frame configuration cannot be configured!\n");
|
||||
return fs->numb_period_frame;
|
||||
}
|
||||
|
||||
static void config_common(gNB_MAC_INST *nrmac,
|
||||
@@ -819,7 +813,16 @@ static void config_common(gNB_MAC_INST *nrmac,
|
||||
|
||||
// Frame structure configuration
|
||||
uint8_t mu = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
config_frame_structure(mu, scc, cfg, &nrmac->frame_structure);
|
||||
if (cfg->cell_config.frame_duplex_type.value == TDD) {
|
||||
cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->tdd_table.tdd_period.value = get_tdd_period_idx(scc->tdd_UL_DL_ConfigurationCommon);
|
||||
LOG_D(NR_MAC, "Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period.value);
|
||||
}
|
||||
frame_structure_t *fs = &nrmac->frame_structure;
|
||||
config_frame_structure(mu, scc, cfg->tdd_table.tdd_period.value, cfg->cell_config.frame_duplex_type.value, fs);
|
||||
if (cfg->cell_config.frame_duplex_type.value == TDD)
|
||||
set_tdd_config_nr(cfg, fs);
|
||||
|
||||
int nb_tx = config->nb_bfw[0]; // number of tx antennas
|
||||
int nb_beams = config->nb_bfw[1]; // number of beams
|
||||
|
||||
@@ -39,6 +39,11 @@ void set_cset_offset(uint16_t);
|
||||
void get_K1_K2(int N1, int N2, int *K1, int *K2, int layers);
|
||||
int get_NTN_Koffset(const NR_ServingCellConfigCommon_t *scc);
|
||||
|
||||
void config_frame_structure(int mu,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
uint8_t tdd_period,
|
||||
uint8_t frame_type,
|
||||
frame_structure_t *fs);
|
||||
int get_first_ul_slot(const frame_structure_t *fs, bool mixed);
|
||||
int get_ul_slots_per_period(const frame_structure_t *fs);
|
||||
int get_ul_slots_per_frame(const frame_structure_t *fs);
|
||||
|
||||
Reference in New Issue
Block a user