Commit 1e39dd77 authored by francescomani's avatar francescomani

fix physical simulators

parent 8e56e14d
...@@ -75,45 +75,45 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} ...@@ -75,45 +75,45 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char c; char c;
int i; //,j,l,aa; int i; //,j,l,aa;
double SNR, SNR_lin, snr0 = -2.0, snr1 = 2.0; double SNR, SNR_lin, snr0 = -2.0, snr1 = 2.0;
double snr_step = 0.1; double snr_step = 0.1;
uint8_t snr1set = 0; uint8_t snr1set = 0;
int **txdata; int **txdata;
double **s_re, **s_im, **r_re, **r_im; double **s_re, **s_im, **r_re, **r_im;
// int sync_pos, sync_pos_slot; // int sync_pos, sync_pos_slot;
// FILE *rx_frame_file; // FILE *rx_frame_file;
FILE *output_fd = NULL; FILE *output_fd = NULL;
//uint8_t write_output_file = 0; //uint8_t write_output_file = 0;
// int subframe_offset; // int subframe_offset;
// char fname[40], vname[40]; // char fname[40], vname[40];
int trial, n_trials = 1, n_errors = 0, n_false_positive = 0; int trial, n_trials = 1, n_errors = 0, n_false_positive = 0;
uint8_t n_tx = 1, n_rx = 1; uint8_t n_tx = 1, n_rx = 1;
//uint8_t transmission_mode = 1; //uint8_t transmission_mode = 1;
uint16_t Nid_cell = 0; uint16_t Nid_cell = 0;
channel_desc_t *gNB2UE; channel_desc_t *gNB2UE;
uint8_t extended_prefix_flag = 0; uint8_t extended_prefix_flag = 0;
//int8_t interf1 = -21, interf2 = -21; //int8_t interf1 = -21, interf2 = -21;
FILE *input_fd = NULL, *pbch_file_fd = NULL; FILE *input_fd = NULL, *pbch_file_fd = NULL;
//char input_val_str[50],input_val_str2[50]; //char input_val_str[50],input_val_str2[50];
//uint16_t NB_RB=25; //uint16_t NB_RB=25;
SCM_t channel_model = AWGN; //Rayleigh1_anticorr; SCM_t channel_model = AWGN; //Rayleigh1_anticorr;
uint16_t N_RB_DL = 106, mu = 1; uint16_t N_RB_DL = 106, mu = 1;
//unsigned char frame_type = 0; //unsigned char frame_type = 0;
unsigned char pbch_phase = 0; unsigned char pbch_phase = 0;
int frame = 0, slot = 0; int frame = 0, slot = 0;
int frame_length_complex_samples; int frame_length_complex_samples;
//int frame_length_complex_samples_no_prefix; //int frame_length_complex_samples_no_prefix;
NR_DL_FRAME_PARMS *frame_parms; NR_DL_FRAME_PARMS *frame_parms;
uint8_t Kmimo = 0; uint8_t Kmimo = 0;
uint32_t Nsoft = 0; uint32_t Nsoft = 0;
double sigma; double sigma;
unsigned char qbits = 8; unsigned char qbits = 8;
int ret; int ret;
//int run_initial_sync=0; //int run_initial_sync=0;
int loglvl = OAILOG_WARNING; int loglvl = OAILOG_WARNING;
uint8_t dlsch_threads = 0; uint8_t dlsch_threads = 0;
float target_error_rate = 0.01; float target_error_rate = 0.01;
uint64_t SSB_positions=0x01; uint64_t SSB_positions=0x01;
uint16_t nb_symb_sch = 12; uint16_t nb_symb_sch = 12;
...@@ -460,6 +460,7 @@ int main(int argc, char **argv) ...@@ -460,6 +460,7 @@ int main(int argc, char **argv)
rel15->mcsIndex[0] = Imcs; rel15->mcsIndex[0] = Imcs;
rel15->numDmrsCdmGrpsNoData = 1; rel15->numDmrsCdmGrpsNoData = 1;
rel15->maintenance_parms_v3.tbSizeLbrmBytes = Tbslbrm; rel15->maintenance_parms_v3.tbSizeLbrmBytes = Tbslbrm;
rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS, rate);
double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc
short channel_output_fixed[16 * 68 * 384]; short channel_output_fixed[16 * 68 * 384];
//unsigned char *estimated_output; //unsigned char *estimated_output;
......
...@@ -318,6 +318,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, ...@@ -318,6 +318,7 @@ void nr_dlsim_preprocessor(module_id_t module_id,
sched_pdsch->rbStart = g_rbStart; sched_pdsch->rbStart = g_rbStart;
sched_pdsch->rbSize = g_rbSize; sched_pdsch->rbSize = g_rbSize;
sched_pdsch->mcs = g_mcsIndex; sched_pdsch->mcs = g_mcsIndex;
sched_pdsch->nrOfLayers = g_nrOfLayers;
/* the following might override the table that is mandated by RRC /* the following might override the table that is mandated by RRC
* configuration */ * configuration */
current_BWP->mcsTableIdx = g_mcsTableIdx; current_BWP->mcsTableIdx = g_mcsTableIdx;
......
...@@ -466,6 +466,7 @@ int main(int argc, char **argv) ...@@ -466,6 +466,7 @@ int main(int argc, char **argv)
rel15_ul->nrOfLayers = Nl; rel15_ul->nrOfLayers = Nl;
rel15_ul->target_code_rate = code_rate; rel15_ul->target_code_rate = code_rate;
rel15_ul->pusch_data.tb_size = TBS>>3; rel15_ul->pusch_data.tb_size = TBS>>3;
rel15_ul->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS, code_rate);
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc
......
...@@ -1126,7 +1126,7 @@ int main(int argc, char **argv) ...@@ -1126,7 +1126,7 @@ int main(int argc, char **argv)
pusch_pdu->bwp_size = abwp_size; pusch_pdu->bwp_size = abwp_size;
} }
pusch_pdu->pusch_data.tb_size = TBS/8; pusch_pdu->pusch_data.tb_size = TBS>>3;
pusch_pdu->pdu_bit_map = pdu_bit_map; pusch_pdu->pdu_bit_map = pdu_bit_map;
pusch_pdu->rnti = n_rnti; pusch_pdu->rnti = n_rnti;
pusch_pdu->mcs_index = Imcs; pusch_pdu->mcs_index = Imcs;
...@@ -1158,6 +1158,7 @@ int main(int argc, char **argv) ...@@ -1158,6 +1158,7 @@ int main(int argc, char **argv)
pusch_pdu->pusch_ptrs.ptrs_freq_density = ptrs_freq_density; pusch_pdu->pusch_ptrs.ptrs_freq_density = ptrs_freq_density;
pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t));
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0;
pusch_pdu->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS, code_rate);
// if transform precoding is enabled // if transform precoding is enabled
if (transform_precoding == transformPrecoder_enabled) { if (transform_precoding == transformPrecoder_enabled) {
......
...@@ -3498,6 +3498,15 @@ void csi_period_offset(NR_CSI_ReportConfig_t *csirep, ...@@ -3498,6 +3498,15 @@ void csi_period_offset(NR_CSI_ReportConfig_t *csirep,
} }
} }
uint8_t get_BG(uint32_t A, uint16_t R) {
float code_rate = (float) R / 10240.0f;
if ((A <=292) || ((A<=3824) && (code_rate <= 0.6667)) || code_rate <= 0.25)
return 2;
else
return 1;
}
uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti) { uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti) {
if(ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common) if(ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common)
...@@ -4738,4 +4747,4 @@ uint16_t nr_get_csi_bitlen(nr_csi_report_t *csi_report_template, uint8_t csi_rep ...@@ -4738,4 +4747,4 @@ uint16_t nr_get_csi_bitlen(nr_csi_report_t *csi_report_template, uint8_t csi_rep
} }
return csi_bitlen; return csi_bitlen;
} }
\ No newline at end of file
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti); uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti);
uint8_t get_BG(uint32_t A, uint16_t R);
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw); uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
......
...@@ -212,6 +212,7 @@ uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx) ...@@ -212,6 +212,7 @@ uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx)
return 9; return 9;
} }
void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) {
//TODO first basic implementation of dmrs port selection //TODO first basic implementation of dmrs port selection
...@@ -248,15 +249,6 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { ...@@ -248,15 +249,6 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) {
} }
} }
uint8_t get_BG(uint32_t A, uint16_t R) {
float code_rate = (float) R / 10240.0f;
if ((A <=292) || ((A<=3824) && (code_rate <= 0.6667)) || code_rate <= 0.25)
return 2;
else
return 1;
}
NR_ControlResourceSet_t *get_coreset(gNB_MAC_INST *nrmac, NR_ControlResourceSet_t *get_coreset(gNB_MAC_INST *nrmac,
NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfigCommon_t *scc,
void *bwp, void *bwp,
......
...@@ -469,7 +469,6 @@ uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl, ...@@ -469,7 +469,6 @@ uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl,
int codebook_mode); int codebook_mode);
uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx); uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx);
uint8_t get_BG(uint32_t A, uint16_t R);
uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl); uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl);
const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot); const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot);
......
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