diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h index 745b92f5fe5da7597977042e295f6cf27e41a6f8..205eae7f8e57e046d1bdec54e6870cc312559098 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h @@ -90,6 +90,10 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, @param nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs */ uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs,uint8_t Qm, uint8_t Nl); +void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); + +void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); + int nr_dlsch_encoding(unsigned char *a, uint8_t subframe, NR_gNB_DLSCH_t *dlsch, diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index f072532d27b129690edcef5be1b20462e9d04f77..cf419b0904e0b5c00bf60a5d46c66b6df9eed119 100755 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -1131,7 +1131,7 @@ void nr_dci_decoding_procedure0(int s, //Table 10.1-2: Maximum number of PDCCH candidates per slot and per serving cell as a function of the subcarrier spacing value 2^mu*15 KHz, mu {0,1,2,3} uint8_t m_max_slot_pdcch_Table10_1_2 [4] = {44,36,22,20}; //Table 10.1-3: Maximum number of non-overlapped CCEs per slot and per serving cell as a function of the subcarrier spacing value 2^mu*15 KHz, mu {0,1,2,3} - uint8_t cce_max_slot_pdcch_Table10_1_3 [4] = {56,56,48,32}; + //uint8_t cce_max_slot_pdcch_Table10_1_3 [4] = {56,56,48,32}; int coreset_nbr_cce_per_symbol=0; @@ -1264,9 +1264,10 @@ void nr_dci_decoding_procedure0(int s, for (m = 0; m < nb_candidates; m++) { int n_ci = 0; if (nCCE[p] < L2) return; + +#ifdef NR_PDCCH_DCI_DEBUG int debug1 = nCCE[p] / L2; int debug2 = L2*m_p_s_L_max; -#ifdef NR_PDCCH_DCI_DEBUG printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> debug1(%d)=nCCE[p]/L2 | nCCE[%d](%d) | L2(%d)\n",debug1,p,nCCE[p],L2); printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> debug2(%d)=L2*m_p_s_L_max | L2(%d) | m_p_s_L_max(%d)\n",debug2,L2,m_p_s_L_max); #endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 2e00c128b3c914dae4546a3f6f410eb5c50ea69c..a9f6b02567c171a59225472bcd6412f62a7056d0 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -131,10 +131,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, unsigned short nb_rb_pdsch = 50; int16_t *pllr_symbol_cw0; int16_t *pllr_symbol_cw1; - int16_t *pllr_symbol_cw0_deint; - int16_t *pllr_symbol_cw1_deint; + //int16_t *pllr_symbol_cw0_deint; + //int16_t *pllr_symbol_cw1_deint; uint32_t llr_offset_symbol; - uint16_t bundle_L = 2; + //uint16_t bundle_L = 2; uint8_t l0 =2; switch (type) { @@ -2001,7 +2001,7 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, unsigned short k,rb; - unsigned char i,aarx,l; //,nsymb,sss_symb,pss_symb=0; + unsigned char i,aarx; //,nsymb,sss_symb,pss_symb=0,l; int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; @@ -2010,7 +2010,7 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, //symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; pilots = (symbol==2) ? 1 : 0; //to updated from config - l=symbol; + //l=symbol; //nsymb = (frame_parms->Ncp==NORMAL) ? 14:12; k = frame_parms->first_carrier_offset + 516; //0 diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 50a283f465e815ca8a0306139af4df7b267866cb..4a6e6423f61698c7d7375a0385ae2b8a645ddb44 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -140,7 +140,7 @@ char prefix_string[2][9] = {"NORMAL","EXTENDED"}; int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) { - int32_t sync_pos, sync_pos2, sync_pos_slot; // k_ssb, N_ssb_crb, + int32_t sync_pos, sync_pos_slot; // k_ssb, N_ssb_crb, sync_pos2, int32_t metric_tdd_ncp=0; uint8_t phase_tdd_ncp; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 0a662304dd84d57f6961b2ecd4d4a656dba02dfa..ff846d1e9b768d42c44c5160cfc297789508ecf7 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -574,7 +574,7 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, uint8_t restricted_set = ue->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag; //uint8_t n_ra_prboffset = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset; uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex; - uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index; + //uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index; int16_t *prachF = ue->prach_vars[eNB_id]->prachF; static int16_t prach_tmp[45600*2] __attribute__((aligned(32))); int16_t *prach = prach_tmp; diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c index e2accc340b56d8c9dba75e8fa4c98e24a2a6ce13..432798a1bdde1cf3d1fb039407ade2b914a861e0 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c @@ -181,9 +181,9 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, // alpha is cyclic shift double alpha; // lnormal is the OFDM symbol number in the PUCCH transmission where l=0 corresponds to the first OFDM symbol of the PUCCH transmission - uint8_t lnormal; + //uint8_t lnormal; // lprime is the index of the OFDM symbol in the slot that corresponds to the first OFDM symbol of the PUCCH transmission in the slot given by [5, TS 38.213] - uint8_t lprime; + //uint8_t lprime; // mcs is provided by TC 38.213 subclauses 9.2.3, 9.2.4, 9.2.5 FIXME! //uint8_t mcs; @@ -198,7 +198,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, * x(l*12+n) = r_u_v_alpha_delta(n) */ // the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1 - uint8_t u=0,v=0,delta=0; + uint8_t u=0,v=0;//,delta=0; // if frequency hopping is disabled by the higher-layer parameter PUCCH-frequency-hopping // n_hop = 0 // if frequency hopping is enabled by the higher-layer parameter PUCCH-frequency-hopping @@ -332,7 +332,7 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue, // alpha is cyclic shift double alpha; // lnormal is the OFDM symbol number in the PUCCH transmission where l=0 corresponds to the first OFDM symbol of the PUCCH transmission - uint8_t lnormal = 0 ; + //uint8_t lnormal = 0 ; // lprime is the index of the OFDM symbol in the slot that corresponds to the first OFDM symbol of the PUCCH transmission in the slot given by [5, TS 38.213] uint8_t lprime = startingSymbolIndex; // mcs = 0 except for PUCCH format 0 @@ -350,7 +350,7 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue, * the complex-valued symbol d_0 shall be multiplied with a sequence r_u_v_alpha_delta(n): y(n) = d_0 * r_u_v_alpha_delta(n) */ // the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1 - uint8_t u=0,v=0,delta=0; + uint8_t u=0,v=0;//,delta=0; // if frequency hopping is disabled, intraSlotFrequencyHopping is not provided // n_hop = 0 // if frequency hopping is enabled, intraSlotFrequencyHopping is provided @@ -1286,7 +1286,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, {0, 0, 0,-1,-1,-1, 0, 0, 0, 1, 1, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 0, 0, 0,-1,-1,-1}}; - uint8_t occ_Length = occ_length_format4; // higher layer parameter occ-Length + //uint8_t occ_Length = occ_length_format4; // higher layer parameter occ-Length uint8_t occ_Index = occ_index_format4; // higher layer parameter occ-Index //occ_Index = 1; //only for testing purposes; to be removed FIXME!!! if (fmt == pucch_format3_nr){ // no block-wise spreading for format 3 @@ -1377,7 +1377,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, * Implementing TS 38.211 Subclauses 6.3.2.5.3 and 6.3.2.6.5 Mapping to physical resources */ // the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1 - uint8_t u=0,v=0,delta=0; + uint8_t u=0,v=0;//,delta=0; // if frequency hopping is disabled, intraSlotFrequencyHopping is not provided // n_hop = 0 // if frequency hopping is enabled, intraSlotFrequencyHopping is provided @@ -1385,9 +1385,9 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, // n_hop = 1 for second hop uint8_t n_hop = 0; // lnormal is the OFDM symbol number in the PUCCH transmission where l=0 corresponds to the first OFDM symbol of the PUCCH transmission - uint8_t lnormal = 0 ; + //uint8_t lnormal = 0 ; // lprime is the index of the OFDM symbol in the slot that corresponds to the first OFDM symbol of the PUCCH transmission in the slot given by [5, TS 38.213] - uint8_t lprime = startingSymbolIndex; + //uint8_t lprime = startingSymbolIndex; // m0 is the cyclic shift index calculated depending on the Orthogonal sequence index n, according to table 6.4.1.3.3.1-1 from TS 38.211 subclause 6.4.1.3.3.1 uint8_t m0; uint8_t mcs=0; @@ -1404,13 +1404,13 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, uint8_t N_ZC = 12*nrofPRB; int16_t *r_u_v_base_re = malloc(sizeof(int16_t)*12*nrofPRB); int16_t *r_u_v_base_im = malloc(sizeof(int16_t)*12*nrofPRB); - int16_t *r_u_v_alpha_delta_re = malloc(sizeof(int16_t)*12*nrofPRB); - int16_t *r_u_v_alpha_delta_im = malloc(sizeof(int16_t)*12*nrofPRB); + //int16_t *r_u_v_alpha_delta_re = malloc(sizeof(int16_t)*12*nrofPRB); + //int16_t *r_u_v_alpha_delta_im = malloc(sizeof(int16_t)*12*nrofPRB); // Next we proceed to mapping to physical resources according to TS 38.211, subclause 6.3.2.6.5 dor PUCCH formats 3 and 4 and subclause 6.4.1.3.3.2 for DM-RS int32_t *txptr; uint32_t re_offset; - uint32_t x1, x2, s=0; + //uint32_t x1, x2, s=0; // intraSlotFrequencyHopping // uint8_t intraSlotFrequencyHopping = 0; uint8_t table_6_4_1_3_3_2_1_dmrs_positions[11][14] ={ diff --git a/openair1/SCHED_NR/phy_procedures_nr_common.c b/openair1/SCHED_NR/phy_procedures_nr_common.c index e127e64e3ee0c8214cece2418b8123ca4661bee1..1a0a02f22df0aad6c9e001e43bc03d62ab4ce093 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_common.c +++ b/openair1/SCHED_NR/phy_procedures_nr_common.c @@ -32,15 +32,8 @@ #include "sched_nr.h" - - - - nr_subframe_t nr_slot_select(nfapi_nr_config_request_t *cfg,unsigned char slot) { if (cfg->subframe_config.duplex_mode.value == FDD) return(SF_DL); } - - - diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 2bb80148f2beca04d94e4aa93470a4e35f6ef2c0..fc1162c319f3b28429d29893942a2408261777c2 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -138,7 +138,7 @@ int main(int argc, char **argv) { uint8_t extended_prefix_flag=0; int8_t interf1=-21,interf2=-21; 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; SCM_t channel_model=AWGN;//Rayleigh1_anticorr; uint8_t N_RB_DL=106,mu=1; @@ -149,12 +149,12 @@ int main(int argc, char **argv) { //int frame_length_complex_samples_no_prefix; NR_DL_FRAME_PARMS *frame_parms; //nfapi_nr_config_request_t *gNB_config; - uint8_t Kmimo; - uint32_t Nsoft; + uint8_t Kmimo=0; + uint32_t Nsoft=0; double sigma; unsigned char qbits=8; int ret; - int run_initial_sync=0; + //int run_initial_sync=0; int loglvl=OAILOG_WARNING; float target_error_rate = 0.01; @@ -308,18 +308,22 @@ int main(int argc, char **argv) { break; - case 'm': - Imcs = atoi(optarg); - break; + case 'm': + Imcs = atoi(optarg); + break; - case 'l': - nb_symb_sch = atoi(optarg); - break; + case 'l': + nb_symb_sch = atoi(optarg); + break; - case 'r': - nb_rb = atoi(optarg); - break; - + case 'r': + nb_rb = atoi(optarg); + break; + + case 'x': + transmission_mode = atoi(optarg); + break; + default: case 'h': printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", @@ -451,11 +455,8 @@ int main(int argc, char **argv) { unsigned char harq_pid = 0; //dlsch->harq_ids[subframe]; NR_gNB_DLSCH_t *dlsch = gNB->dlsch[0][0]; nfapi_nr_dl_config_dlsch_pdu_rel15_t *rel15 = &dlsch->harq_processes[harq_pid]->dlsch_pdu.dlsch_pdu_rel15; - time_stats_t *rm_stats; - time_stats_t *te_stats; - time_stats_t *i_stats; - uint8_t is_crnti; - uint8_t llr8_flag; + //time_stats_t *rm_stats, *te_stats, *i_stats; + uint8_t is_crnti=0, llr8_flag=0; unsigned int TBS = 8424; unsigned int available_bits; uint8_t nb_re_dmrs = 6; diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 9a9f882531c7c2dd3816798a3a261e9c6a3c7c11..f05aa41e8c8f9c70c6c8a308e3d5576af64b2e39 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -85,39 +85,41 @@ int main(int argc, char **argv) char c; - int i,l,aa; + int i,aa;//,l; double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0; uint8_t snr1set=0; int **txdata; double **s_re,**s_im,**r_re,**r_im; - double iqim = 0.0; - unsigned char pbch_pdu[6]; + //double iqim = 0.0; + //unsigned char pbch_pdu[6]; // int sync_pos, sync_pos_slot; // FILE *rx_frame_file; FILE *output_fd = NULL; uint8_t write_output_file=0; //int result; - int freq_offset; + //int freq_offset; // int subframe_offset; // char fname[40], vname[40]; - int trial,n_trials=1,n_errors,n_errors_payload; + int trial,n_trials=1,n_errors=0,n_errors_payload=0; uint8_t transmission_mode = 1,n_tx=1,n_rx=1; uint16_t Nid_cell=0; channel_desc_t *gNB2UE; - uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0; + uint8_t extended_prefix_flag=0; int8_t interf1=-21,interf2=-21; FILE *input_fd=NULL,*pbch_file_fd=NULL; - char input_val_str[50],input_val_str2[50]; - uint8_t frame_mod4,num_pdcch_symbols = 0; + //uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0; + //char input_val_str[50],input_val_str2[50]; + //uint8_t frame_mod4,num_pdcch_symbols = 0; + //double pbch_sinr; + //int pbch_tx_ant; SCM_t channel_model=AWGN;//Rayleigh1_anticorr; - double pbch_sinr; - int pbch_tx_ant; + int N_RB_DL=273,mu=1; unsigned char frame_type = 0;