diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 9fa6bf918d..77ea3963b4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2367,6 +2367,7 @@ add_executable(nr-softmodem ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${GTPU_need_ITTI} ${XFORMS_SOURCE_NR} ${T_SOURCE} @@ -2404,6 +2405,7 @@ add_executable(nr-softmodem-nos1 ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${GTPU_need_ITTI} ${XFORMS_SOURCE_NR} ${T_SOURCE} @@ -2440,6 +2442,7 @@ add_executable(nr-uesoftmodem ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${XFORMS_SOURCE_NR} ${T_SOURCE} ${CONFIG_SOURCES} @@ -2471,6 +2474,7 @@ add_executable(nr-uesoftmodem-nos1 ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${XFORMS_SOURCE_NR} ${T_SOURCE} ${CONFIG_SOURCES} @@ -2533,24 +2537,28 @@ target_link_libraries (dlsim_tm4 add_executable(polartest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c - ${OPENAIR_DIR}/common/utils/backtrace.c) + ${OPENAIR_DIR}/common/utils/backtrace.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c) target_link_libraries(polartest SIMU PHY PHY_NR PHY_COMMON PHY_NR_COMMON m ${ATLAS_LIBRARIES}) add_executable(smallblocktest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/smallblocktest.c - ${OPENAIR_DIR}/common/utils/backtrace.c) + ${OPENAIR_DIR}/common/utils/backtrace.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c) target_link_libraries(smallblocktest SIMU PHY PHY_NR PHY_COMMON PHY_NR_COMMON m ${ATLAS_LIBRARIES}) add_executable(ldpctest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c - ${OPENAIR_DIR}/common/utils/backtrace.c) + ${OPENAIR_DIR}/common/utils/backtrace.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c) target_link_libraries(ldpctest SIMU PHY PHY_NR m ${ATLAS_LIBRARIES}) add_executable(nr_dlschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${T_SOURCE}) target_link_libraries(nr_dlschsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) @@ -2558,6 +2566,7 @@ add_executable(nr_pbchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${T_SOURCE}) target_link_libraries(nr_pbchsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) @@ -2565,6 +2574,7 @@ target_link_libraries(nr_pbchsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_ add_executable(nr_pucchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pucchsim.c ${OPENAIR_DIR}/common/utils/backtrace.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${T_SOURCE}) target_link_libraries(nr_pucchsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) #PUCCH ---> Prashanth @@ -2573,6 +2583,7 @@ add_executable(nr_dlsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${T_SOURCE}) target_link_libraries(nr_dlsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON MAC_NR RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) @@ -2580,12 +2591,15 @@ add_executable(nr_prachsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/prachsim.c ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c + ${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c ${T_SOURCE}) target_link_libraries(nr_prachsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) add_executable(nr_ulschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c ${OPENAIR_DIR}/common/utils/backtrace.c + ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${T_SOURCE}) target_link_libraries(nr_ulschsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 842d2f8bf0..93166ef5ff 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -309,7 +309,7 @@ static inline void fh_if4p5_south_out(RU_t *ru,int frame,int slot, uint64_t time LOG_D(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.tti_tx); - if (nr_slot_select(&ru->gNB_list[0]->gNB_config,ru->proc.tti_tx)!=SF_UL) + if ((nr_slot_select(ru->nr_frame_parms,ru->proc.frame_tx,ru->proc.tti_tx)&NR_DOWNLINK_SLOT) > 0) send_IF4p5(ru,frame, slot, IF4p5_PDLFFT); } @@ -519,10 +519,10 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) { do { recv_IF4p5(ru, &frame_tx, &slot_tx, &packet_type, &symbol_number); - if ((nr_slot_select(cfg,slot_tx) == SF_DL) && (symbol_number == 0)) start_meas(&ru->rx_fhaul); + if (((nr_slot_select(ru->nr_frame_parms,frame_tx,slot_tx) & NR_DOWNLINK_SLOT) > 0) && (symbol_number == 0)) start_meas(&ru->rx_fhaul); LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n", - *slot,nr_slot_select(cfg,*slot),frame_tx,slot_tx,symbol_number); + *slot,nr_slot_select(ru->nr_frame_parms,frame_tx,*slot),frame_tx,slot_tx,symbol_number); if (proc->first_tx != 0) { *frame = frame_tx; @@ -541,7 +541,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) { } else AssertFatal(1==0,"Illegal IF4p5 packet type (should only be IF4p5_PDLFFT%d\n",packet_type); } while (symbol_mask != symbol_mask_full); - if (nr_slot_select(cfg,slot_tx) == SF_DL) stop_meas(&ru->rx_fhaul); + if ((nr_slot_select(ru->nr_frame_parms,frame_tx,slot_tx) & NR_DOWNLINK_SLOT)>0) stop_meas(&ru->rx_fhaul); proc->tti_tx = slot_tx; proc->frame_tx = frame_tx; @@ -709,11 +709,11 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { int i; T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(frame), T_INT(slot), T_INT(0), T_BUFFER(&ru->common.txdata[0][slot * fp->samples_per_slot], fp->samples_per_slot * 4)); - nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame); + int slot_type = nr_slot_select(ru->nr_frame_parms,frame,slot%fp->slots_per_frame); int sf_extension = 0; - if ((SF_type == SF_DL) || - (SF_type == SF_S)) { + if ((slot_type & NR_UPLINK_SLOT) == 0) { + int siglen=fp->samples_per_slot,flags=1; /* if (SF_type == SF_S) { @@ -768,7 +768,7 @@ static void *ru_thread_asynch_rxtx( void *param ) { static int ru_thread_asynch_rxtx_status; RU_t *ru = (RU_t *)param; RU_proc_t *proc = &ru->proc; - int subframe=0, frame=0; + int slot=0, frame=0; // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe wait_sync("ru_thread_asynch_rxtx"); // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe @@ -779,20 +779,20 @@ static void *ru_thread_asynch_rxtx( void *param ) { while (!oai_exit) { if (oai_exit) break; - if (subframe==9) { - subframe=0; + if (slot==ru->nr_frame_parms->slots_per_frame) { + slot=0; frame++; frame&=1023; } else { - subframe++; + slot++; } LOG_D(PHY,"ru_thread_asynch_rxtx: Waiting on incoming fronthaul\n"); // asynchronous receive from north (RRU IF4/IF5) if (ru->fh_north_asynch_in) { - if (nr_slot_select(&ru->gNB_list[0]->gNB_config,subframe)!=SF_UL) - ru->fh_north_asynch_in(ru,&frame,&subframe); + if ((nr_slot_select(ru->nr_frame_parms,frame,slot) & NR_DOWNLINK_SLOT)>0) + ru->fh_north_asynch_in(ru,&frame,&slot); } else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n"); } diff --git a/executables/nr-ue.c b/executables/nr-ue.c index d6946f1ac7..ab3b6cd7e0 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -377,7 +377,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL ); #else uint64_t a=rdtsc(); - phy_procedures_nrUE_RX( UE, proc, 0, 1, UE->mode, UE_mac->phy_config.config_req.pbch_config); + phy_procedures_nrUE_RX( UE, proc, 0, 1, UE->mode, UE_mac->scheduled_response.dl_config); LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_tti_rx, (rdtsc()-a)/3500); //printf(">>> nr_ue_pdcch_procedures ended\n"); #endif diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index a4453eebaf..88444cc95a 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -488,7 +488,6 @@ int main(int argc, char **argv) { rel15->nb_symbols = nb_symb_sch; rel15->modulation_order = mod_order; rel15->nb_layers = Nl; - rel15->nb_re_dmrs = nb_re_dmrs; rel15->transport_block_size = TBS; double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384); diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 736a98ebec..c891f34c5e 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -382,10 +382,9 @@ int main(int argc, char **argv) { exit(-1); } - RC.gNB = (PHY_VARS_gNB ** *) malloc(sizeof(PHY_VARS_gNB **)); - RC.gNB[0] = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *)); - RC.gNB[0][0] = malloc(sizeof(PHY_VARS_gNB)); - gNB = RC.gNB[0][0]; + RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *)); + RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB)); + gNB = RC.gNB[0]; //gNB_config = &gNB->gNB_config; frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 56f488e5b5..4fc48d3999 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -35,6 +35,9 @@ #include "NR_MAC-CellGroupConfig.h" + + + void config_common_ue(NR_UE_MAC_INST_t *mac) { fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index a2bed1e178..f05e277ac6 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1312,7 +1312,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fa * 49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space * 50 SUL_IND_0_0: */ - ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; + ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_ULSCH_PDU_TYPE; ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti; fapi_nr_ul_config_ulsch_pdu_rel15_t *ulsch_config_pdu_0_0 = &ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15; /* IDENTIFIER_DCI_FORMATS */ @@ -1385,7 +1385,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fa * 48 UL_SCH_IND * 49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space */ - ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; + ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_ULSCH_PDU_TYPE; ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti; fapi_nr_ul_config_ulsch_pdu_rel15_t *ulsch_config_pdu_0_1 = &ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15; /* IDENTIFIER_DCI_FORMATS */ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index a42210cf81..a69b95b402 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -463,56 +463,8 @@ int get_symbolsperslot(nfapi_nr_config_request_t *cfg) { } -/// Target code rate tables indexed by Imcs -uint16_t nr_target_code_rate_table1[29] = {120, 157, 193, 251, 308, 379, 449, 526, 602, 679, 340, 378, 434, 490, 553, \ - 616, 658, 438, 466, 517, 567, 616, 666, 719, 772, 822, 873, 910, 948}; - // Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point -uint16_t nr_target_code_rate_table2[28] = {120, 193, 308, 449, 602, 378, 434, 490, 553, 616, 658, 466, 517, 567, \ - 616, 666, 719, 772, 822, 873, 1365, 711, 754, 797, 841, 885, 1833, 948}; -uint16_t nr_target_code_rate_table3[29] = {30, 40, 50, 64, 78, 99, 120, 157, 193, 251, 308, 379, 449, 526, 602, 340, \ - 378, 434, 490, 553, 616, 438, 466, 517, 567, 616, 666, 719, 772}; -uint16_t nr_tbs_table[93] = {24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 208, 224, 240, 256, 272, 288, 304, 320, \ - 336, 352, 368, 384, 408, 432, 456, 480, 504, 528, 552, 576, 608, 640, 672, 704, 736, 768, 808, 848, 888, 928, 984, 1032, 1064, 1128, 1160, 1192, 1224, 1256, \ - 1288, 1320, 1352, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 2024, 2088, 2152, 2216, 2280, 2408, 2472, 2536, 2600, 2664, 2728, 2792, 2856, 2976, \ - 3104, 3240, 3368, 3496, 3624, 3752, 3824}; -uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx) { - switch(table_idx) { - case 1: - return (((Imcs<10)||(Imcs==29))?2:((Imcs<17)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1); - break; - - case 2: - return (((Imcs<5)||(Imcs==28))?2:((Imcs<11)||(Imcs==29))?4:((Imcs<20)||(Imcs==30))?6:((Imcs<28)||(Imcs==31))?8:-1); - break; - - case 3: - return (((Imcs<15)||(Imcs==29))?2:((Imcs<21)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1); - break; - - default: - AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx); - } -} - -uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx) { - switch(table_idx) { - case 1: - return (nr_target_code_rate_table1[Imcs]); - break; - - case 2: - return (nr_target_code_rate_table2[Imcs]); - break; - - case 3: - return (nr_target_code_rate_table3[Imcs]); - break; - - default: - AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx); - } -} +extern uint16_t nr_tbs_table[93]; void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu, nfapi_nr_dl_config_dci_dl_pdu dci_pdu) { @@ -581,23 +533,6 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu, TBS, N_RE, N_PRB_DMRS, N_sh_symb, N_PRB_oh, Ninfo, Ninfo_prime, R, Qm, table_idx, scale, dlsch_rel15->nb_mod_symbols); } -int NRRIV2BW(int locationAndBandwidth,int N_RB) { - int tmp = locationAndBandwidth/N_RB; - int tmp2 = locationAndBandwidth%N_RB; - - if (tmp <= (N_RB-tmp2+1)) return(tmp); - else return(N_RB-tmp); - -} - -int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) { - int tmp = locationAndBandwidth/N_RB; - int tmp2 = locationAndBandwidth%N_RB; - - if (tmp <= (N_RB-tmp2+1)) return(tmp2); - else return(N_RB-tmp2); -} - int extract_startSymbol(int startSymbolAndLength) { int tmp = startSymbolAndLength/14; int tmp2 = startSymbolAndLength%14;