diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index a2c68e9ef6..1fdc3446d9 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1134,7 +1134,7 @@ -n100 -s2 -U 2 1 3 -n10 -s20 -U 3 0 0 2 -gR -x1 -y4 -z4 -n10 -s20 -U 3 0 0 2 -gR -x2 -y4 -z4 - -n100 -m0 -e0 -R25 -b25 -i + -n100 -m0 -e0 -R25 -b25 -i 2 1 0 nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18 nr_dlsim.test19 nr_dlsim.test20 nr_dlsim.test21 nr_dlsim.test22 nr_dlsim.test23 PDSCH test OK segmentation fault|assertion|exiting|fatal @@ -1311,7 +1311,10 @@ (Test15: MCS 19 50 PRBs 2 RX_Antenna), (Test16: MCS 9 106 PRBs MIMO 2 layers), (Test17: MCS 9 106 PRBs MIMO 4 layers), - (Test18: 25 PRBs, 15 kHz SCS) + (Test18: 25 PRBs, 15 kHz SCS), + (Test19: 3GPP G-FR1-A4-13 2 RX Antennas Requirements Test), + (Test20: 3GPP G-FR1-A4-13 4 RX Antennas Requirements Test), + (Test21: 3GPP G-FR1-A4-13 8 RX Antennas Requirements Test) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1323,20 +1326,24 @@ -n100 -m28 -s20 -n100 -m9 -R217 -r217 -s5 -n100 -m9 -R273 -r273 -s5 - -n100 -s5 -U 2 0 1 - -n100 -s5 -T 2 1 2 -U 2 0 2 - -n100 -s5 -T 2 2 2 -U 2 1 2 - -n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3 - -n100 -Z -s5 + -n100 -s5 -U 4 0 1 1 1 + -n100 -s5 -T 2 1 2 -U 4 0 2 1 1 + -n100 -s5 -T 2 2 2 -U 4 1 2 1 1 + -n100 -s5 -a4 -b8 -T 2 1 2 -U 4 1 3 1 1 + -n100 -s5 -Z -n100 -s5 -Z -r75 -n50 -s5 -Z -r216 -R217 -n50 -s5 -Z -r270 -R273 - -n100 -s5 -Z -U 2 0 2 + -n100 -s5 -Z -U 4 0 2 1 2 -n100 -m19 -s10 -S15 -z2 -n100 -m9 -r106 -s10 -W2 -y2 -z2 -n100 -m9 -r106 -s20 -W4 -y4 -z4 - -n100 -u0 -m0 -R25 -r25 -i - nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14 nr_ulsim.test15 nr_ulsim.test16 nr_ulsim.test17 nr_ulsim.test18 + -n100 -u0 -m0 -R25 -r25 -i 2 1 0 + -m16 -r106 -s8.8 -S9.4 -z2 -n200 -U 4 1 1 1 2 -gI -b14 -t70 -I15 -i 2 1 0 + -m16 -r106 -s5.4 -S6 -z4 -n200 -U 4 1 1 1 2 -gI -b14 -t70 -I15 -i 2 1 0 + -m16 -r106 -s3.4 -S3.8 -z8 -n200 -U 4 1 1 1 2 -gI -b14 -t70 -I15 -i 2 1 0 + + nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14 nr_ulsim.test15 nr_ulsim.test16 nr_ulsim.test17 nr_ulsim.test18 nr_ulsim.test19 nr_ulsim.test20 nr_ulsim.test21 PUSCH test OK segmentation fault|assertion|exiting|fatal 3 diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index e6c739dec3..327c01af6a 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -604,7 +604,8 @@ void init_gNB(int single_thread_flag,int wait_for_sync) { gNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = gNB->cqi_raw_pdu_list;*/ gNB->prach_energy_counter = 0; - gNB->prb_interpolation = get_softmodem_params()->prb_interpolation; + gNB->chest_time = get_softmodem_params()->chest_time; + gNB->chest_freq = get_softmodem_params()->chest_freq; } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 2347055402..de3c108841 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -259,13 +259,11 @@ 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_get(cmdline_params,numparams,NULL); config_process_cmdline( cmdline_params,numparams,NULL); - - if (vcdflag > 0) ouput_vcd = 1; } @@ -317,8 +315,8 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ UE->rf_map.card = card_offset; UE->rf_map.chain = CC_id + chain_offset; - LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n, do_prb_interpolation %d\n", - UE->mode, UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction, UE->prb_interpolation); + LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n, chest-freq %d\n", + UE->mode, UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction, UE->chest_freq); // Set FP variables @@ -330,6 +328,7 @@ 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, ssb_start_subcarrier %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs, fp->ssb_start_subcarrier); fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor; + UE->max_ldpc_iterations = nrUE_params.max_ldpc_iterations; } diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 95914678e5..995d81f19c 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -7,10 +7,11 @@ -#define CONFIG_HLP_IF_FREQ "IF frequency for RF, if needed" -#define CONFIG_HLP_IF_FREQ_OFF "UL IF frequency offset for RF, if needed" +#define CONFIG_HLP_IF_FREQ "IF frequency for RF, if needed\n" +#define CONFIG_HLP_IF_FREQ_OFF "UL IF frequency offset for RF, if needed\n" #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/). Default value is 8. To set the sample offset to 0, set this value ~ 10e6\n" +#define CONFIG_HLP_MAX_LDPC_ITERATIONS "Maximum LDPC decoder iterations\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 */ @@ -30,8 +31,9 @@ #define CMDLINE_NRUEPARAMS_DESC { \ {"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}, \ + {"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, u8ptr:&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \ + {"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, uptr:&nrUE_params.ofdm_offset_divisor, defuintval:8, TYPE_UINT32, 0}, \ + {"max-ldpc-iterations", CONFIG_HLP_MAX_LDPC_ITERATIONS, 0, u8ptr:&nrUE_params.max_ldpc_iterations, defuintval:5, TYPE_UINT8, 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}, \ {"uecap_file", CONFIG_HLP_UECAP_FILE, 0, strptr:(char **)&uecap_file, defstrval:"./uecap.xml", TYPE_STRING, 0}, \ @@ -67,7 +69,8 @@ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ {"if_freq" , CONFIG_HLP_IF_FREQ, 0, u64ptr:&(UE->if_freq), defuintval:0, TYPE_UINT64,0}, \ {"if_freq_off" , CONFIG_HLP_IF_FREQ_OFF, 0, iptr:&(UE->if_freq_off), defuintval:0, TYPE_INT, 0}, \ - {"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&(UE->prb_interpolation), defintval:0, TYPE_INT, 0}, \ + {"chest-freq", CONFIG_HLP_CHESTFREQ, 0, iptr:&(UE->chest_freq), defintval:0, TYPE_INT, 0}, \ + {"chest-time", CONFIG_HLP_CHESTTIME, 0, iptr:&(UE->chest_time), defintval:0, TYPE_INT, 0}, \ {"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \ } @@ -76,6 +79,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 + uint8_t max_ldpc_iterations; // number of maximum LDPC iterations tpool_t Tpool; // thread pool } nrUE_params_t; extern uint64_t get_nrUE_optmask(void); diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 72a9491f27..6c5c610723 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -72,7 +72,8 @@ extern "C" #define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n" #define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n" #define CONFIG_HLP_256QAM "Use the 256 QAM mcs table for PDSCH\n" -#define CONFIG_HLP_PRBINTER "Do PRB based averaging of channel estimates. Frequency domain linear interpolation by default\n" +#define CONFIG_HLP_CHESTFREQ "Set channel estimation type in frequency domain. 0-Linear interpolation (default). 1-PRB based averaging of channel estimates in frequency. \n" +#define CONFIG_HLP_CHESTTIME "Set channel estimation type in time domain. 0-Symbols take estimates of the last preceding DMRS symbol (default). 1-Symbol based averaging of channel estimates in time. \n" #define CONFIG_HLP_NONSTOP "Go back to frame sync mode after 100 consecutive PBCH failures\n" //#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation" @@ -122,7 +123,8 @@ extern "C" #define TUNE_OFFSET softmodem_params.tune_offset #define SEND_DMRSSYNC softmodem_params.send_dmrs_sync #define USIM_TEST softmodem_params.usim_test -#define PRB_INTERPOLATION softmodem_params.prb_interpolation +#define CHEST_FREQ softmodem_params.chest_freq +#define CHEST_TIME softmodem_params.chest_time #define NFAPI softmodem_params.nfapi #define NSA softmodem_params.nsa #define NODE_NUMBER softmodem_params.node_number @@ -160,10 +162,11 @@ extern int usrp_tx_thread; {"rfsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&rfsim, defintval:0, TYPE_INT, 0}, \ {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \ {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \ + {"chest-freq", CONFIG_HLP_CHESTFREQ, 0, iptr:&CHEST_FREQ, defintval:0, TYPE_INT, 0}, \ + {"chest-time", CONFIG_HLP_CHESTTIME, 0, iptr:&CHEST_TIME, defintval:0, TYPE_INT, 0}, \ {"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \ {"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:0, TYPE_UINT16, 0}, \ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ - {"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&PRB_INTERPOLATION, defintval:0, TYPE_INT, 0}, \ {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \ {"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0}, \ @@ -251,7 +254,9 @@ typedef struct { double tune_offset; int hw_timing_advance; uint32_t send_dmrs_sync; - int prb_interpolation; + int use_256qam_table; + int chest_time; + int chest_freq; uint8_t nfapi; int nsa; uint16_t node_number; diff --git a/openair1/PHY/CODING/coding_defs.h b/openair1/PHY/CODING/coding_defs.h index 9972a47ee7..1854f28fa7 100644 --- a/openair1/PHY/CODING/coding_defs.h +++ b/openair1/PHY/CODING/coding_defs.h @@ -38,7 +38,6 @@ #define MAX_TURBO_ITERATIONS_MBSFN 8 #define MAX_TURBO_ITERATIONS max_turbo_iterations -#define MAX_LDPC_ITERATIONS 5 #define MAX_LDPC_ITERATIONS_MBSFN 4 #define LTE_NULL 2 diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 9a700c4c66..e2139a9903 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -1050,7 +1050,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) { LOG_I(PHY,"Allocating Transport Channel Buffers for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max); - gNB->ulsch[i] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL); + gNB->ulsch[i] = new_gNB_ulsch(gNB->max_ldpc_iterations, fp->N_RB_UL); if (!gNB->ulsch[i]) { LOG_E(PHY,"Can't get gNB ulsch structures\n"); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 15a868fdd4..c6e6ecd463 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -577,7 +577,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue) { for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) { for (int j=0; jdlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n"); + AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,ue->max_ldpc_iterations,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n"); LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[k][i][j]); if (j==0) { AssertFatal((ue->ulsch[k][i] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES,&ue->frame_parms))!=NULL,"Can't get ue ulsch structures\n"); @@ -586,8 +586,8 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue) { } } - ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL); - ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL); + ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,ue->max_ldpc_iterations,ue->frame_parms.N_RB_DL); + ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,ue->max_ldpc_iterations,ue->frame_parms.N_RB_DL); ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_gNB==1 ? 1 : 2; } diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 7b526876da..cd3b535b3f 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -92,6 +92,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, int16_t *fl,*fm,*fr,*fml,*fmr,*fmm,*fdcl,*fdcr,*fdclh,*fdcrh; int ch_offset,symbol_offset ; int32_t **ul_ch_estimates_time = gNB->pusch_vars[ul_id]->ul_ch_estimates_time; + int chest_freq = gNB->chest_freq; __m128i *ul_ch_128; #ifdef DEBUG_CH @@ -225,8 +226,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, LOG_I(PHY, "In %s ul_ch addr %p nushift %d\n", __FUNCTION__, ul_ch, nushift); #endif - if (pusch_pdu->dmrs_config_type == pusch_dmrs_type1 && gNB->prb_interpolation == 0) { - + if (pusch_pdu->dmrs_config_type == pusch_dmrs_type1 && chest_freq == 0){ LOG_D(PHY,"PUSCH estimation DMRS type 1, Freq-domain interpolation"); // For configuration type 1: k = 4*n + 2*k' + delta, @@ -329,7 +329,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, } #endif } - else if (pusch_pdu->dmrs_config_type == pusch_dmrs_type2 && gNB->prb_interpolation == 0) { //pusch_dmrs_type2 |p_r,p_l,d,d,d,d,p_r,p_l,d,d,d,d| + else if (pusch_pdu->dmrs_config_type == pusch_dmrs_type2 && chest_freq == 0) { //pusch_dmrs_type2 |p_r,p_l,d,d,d,d,p_r,p_l,d,d,d,d| LOG_D(PHY,"PUSCH estimation DMRS type 2, Freq-domain interpolation"); // Treat first DMRS specially (left edge) diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.c b/openair1/PHY/NR_REFSIG/dmrs_nr.c index ca901e1452..1fd502a93e 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.c +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.c @@ -338,3 +338,81 @@ int8_t get_valid_dmrs_idx_for_channel_est(uint16_t dmrs_symb_pos, uint8_t count } return symbIdx; } + +/* perform averaging of channel estimates and store result in first symbol buffer */ +void nr_chest_time_domain_avg(NR_DL_FRAME_PARMS *frame_parms, + int **ch_est, + uint8_t num_symbols, + uint8_t start_symbol, + uint16_t dmrs_bitmap, + uint16_t num_rbs) +{ + __m128i *ul_ch128_0; + __m128i *ul_ch128_1; + int16_t *ul_ch16_0; + int total_symbols = start_symbol + num_symbols; + int num_dmrs_symb = get_dmrs_symbols_in_slot(dmrs_bitmap, total_symbols); + int first_dmrs_symb = get_next_dmrs_symbol_in_slot(dmrs_bitmap, start_symbol, total_symbols); + AssertFatal(first_dmrs_symb > -1, "No DMRS symbol present in this slot\n"); + for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { + for (int symb = first_dmrs_symb+1; symb < total_symbols; symb++) { + ul_ch128_0 = (__m128i *)&ch_est[aarx][first_dmrs_symb*frame_parms->ofdm_symbol_size]; + if ((dmrs_bitmap >> symb) & 0x01) { + ul_ch128_1 = (__m128i *)&ch_est[aarx][symb*frame_parms->ofdm_symbol_size]; + for (int rbIdx = 0; rbIdx < num_rbs; rbIdx++) { + ul_ch128_0[0] = _mm_adds_epi16(ul_ch128_0[0], ul_ch128_1[0]); + ul_ch128_0[1] = _mm_adds_epi16(ul_ch128_0[1], ul_ch128_1[1]); + ul_ch128_0[2] = _mm_adds_epi16(ul_ch128_0[2], ul_ch128_1[2]); + ul_ch128_0 += 3; + ul_ch128_1 += 3; + } + } + } + ul_ch128_0 = (__m128i *)&ch_est[aarx][first_dmrs_symb*frame_parms->ofdm_symbol_size]; + if (num_dmrs_symb == 2) { + for (int rbIdx = 0; rbIdx < num_rbs; rbIdx++) { + ul_ch128_0[0] = _mm_srai_epi16(ul_ch128_0[0], 1); + ul_ch128_0[1] = _mm_srai_epi16(ul_ch128_0[1], 1); + ul_ch128_0[2] = _mm_srai_epi16(ul_ch128_0[2], 1); + ul_ch128_0 += 3; + } + } else if (num_dmrs_symb == 4) { + for (int rbIdx = 0; rbIdx < num_rbs; rbIdx++) { + ul_ch128_0[0] = _mm_srai_epi16(ul_ch128_0[0], 2); + ul_ch128_0[1] = _mm_srai_epi16(ul_ch128_0[1], 2); + ul_ch128_0[2] = _mm_srai_epi16(ul_ch128_0[2], 2); + ul_ch128_0 += 3; + } + } else if (num_dmrs_symb == 3) { + ul_ch16_0 = (int16_t *)&ch_est[aarx][first_dmrs_symb*frame_parms->ofdm_symbol_size]; + for (int rbIdx = 0; rbIdx < num_rbs; rbIdx++) { + ul_ch16_0[0] /= 3; + ul_ch16_0[1] /= 3; + ul_ch16_0[2] /= 3; + ul_ch16_0[3] /= 3; + ul_ch16_0[4] /= 3; + ul_ch16_0[5] /= 3; + ul_ch16_0[6] /= 3; + ul_ch16_0[7] /= 3; + ul_ch16_0[8] /= 3; + ul_ch16_0[9] /= 3; + ul_ch16_0[10] /= 3; + ul_ch16_0[11] /= 3; + ul_ch16_0[12] /= 3; + ul_ch16_0[13] /= 3; + ul_ch16_0[14] /= 3; + ul_ch16_0[15] /= 3; + ul_ch16_0[16] /= 3; + ul_ch16_0[17] /= 3; + ul_ch16_0[18] /= 3; + ul_ch16_0[19] /= 3; + ul_ch16_0[20] /= 3; + ul_ch16_0[21] /= 3; + ul_ch16_0[22] /= 3; + ul_ch16_0[23] /= 3; + ul_ch16_0 += 24; + } + } else AssertFatal((num_dmrs_symb < 5) && (num_dmrs_symb > 0), "Illegal number of DMRS symbols in the slot\n"); + } +} + diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.h b/openair1/PHY/NR_REFSIG/dmrs_nr.h index 13a83be53f..1297a0cc2f 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.h +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.h @@ -65,6 +65,12 @@ void nr_gen_ref_conj_symbols(uint32_t *in, uint32_t length, int16_t *output, uin int8_t get_next_dmrs_symbol_in_slot(uint16_t ul_dmrs_symb_pos, uint8_t counter, uint8_t end_symbol); uint8_t get_dmrs_symbols_in_slot(uint16_t l_prime_mask, uint16_t nb_symb); int8_t get_valid_dmrs_idx_for_channel_est(uint16_t dmrs_symb_pos, uint8_t counter); +void nr_chest_time_domain_avg(NR_DL_FRAME_PARMS *frame_parms, + int **ch_est, + uint8_t num_symbols, + uint8_t start_symbol, + uint16_t dmrs_bitmap, + uint16_t num_rbs); static inline uint8_t is_dmrs_symbol(uint8_t l, uint16_t dmrsSymbMask ) { return ((dmrsSymbMask >> l) & 0x1); } #undef EXTERN diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 260bfbdfbc..4b8315e1ce 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -1963,6 +1963,17 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, } } } + + if (gNB->chest_time == 1) { // averaging time domain channel estimates + nr_chest_time_domain_avg(frame_parms, + gNB->pusch_vars[ulsch_id]->ul_ch_estimates, + rel15_ul->nr_of_symbols, + rel15_ul->start_symbol_index, + rel15_ul->ul_dmrs_symb_pos, + rel15_ul->rb_size); + + gNB->pusch_vars[ulsch_id]->dmrs_symbol = get_next_dmrs_symbol_in_slot(rel15_ul->ul_dmrs_symb_pos, rel15_ul->start_symbol_index, rel15_ul->nr_of_symbols); + } stop_meas(&gNB->ulsch_channel_estimation_stats); #ifdef __AVX2__ @@ -1978,7 +1989,8 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, if ((rel15_ul->ul_dmrs_symb_pos >> ((symbol + 1) % frame_parms->symbols_per_slot)) & 0x01) AssertFatal(1==0,"Double DMRS configuration is not yet supported\n"); - gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol; + if (gNB->chest_time == 0) // Non averaging time domain channel estimates + gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol; if (rel15_ul->dmrs_config_type == 0) { // if no data in dmrs cdm group is 1 only even REs have no data diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 1141ef8140..082370dff4 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -808,7 +808,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, printf("rxF addr %p p %d\n", rxF,p); printf("dl_ch addr %p nushift %d\n",dl_ch,nushift); #endif - if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->prb_interpolation == 0) { + if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->chest_freq == 0) { // Treat first 2 pilots specially (left edge) ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); @@ -985,7 +985,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, 8); } } - } else if (config_type == NFAPI_NR_DMRS_TYPE2 && ue->prb_interpolation == 0){ //pdsch_dmrs_type2 |dmrs_r,dmrs_l,0,0,0,0,dmrs_r,dmrs_l,0,0,0,0| + } else if (config_type == NFAPI_NR_DMRS_TYPE2 && ue->chest_freq == 0){ //pdsch_dmrs_type2 |dmrs_r,dmrs_l,0,0,0,0,dmrs_r,dmrs_l,0,0,0,0| // Treat first 4 pilots specially (left edge) ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index cd1bc9d3b2..eb43d80525 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -319,7 +319,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, dlsch0_harq->n_dmrs_cdm_groups, dlsch0_harq->Nl, frame_parms, - dlsch0_harq->dlDmrsSymbPos); + dlsch0_harq->dlDmrsSymbPos, + ue->chest_time); stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (cpumeas(CPUMEAS_GETSTATE)) LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n", @@ -1610,7 +1611,8 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, unsigned short nb_rb_pdsch, uint8_t n_dmrs_cdm_groups, NR_DL_FRAME_PARMS *frame_parms, - uint16_t dlDmrsSymbPos) + uint16_t dlDmrsSymbPos, + int chest_time_type) { if (config_type == NFAPI_NR_DMRS_TYPE1) { AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2, @@ -1621,7 +1623,12 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, } const unsigned short start_re = (frame_parms->first_carrier_offset + start_rb * NR_NB_SC_PER_RB) % frame_parms->ofdm_symbol_size; - const int8_t validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos, symbol); + int8_t validDmrsEst; + + if (chest_time_type == 0) + validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos,symbol); + else + validDmrsEst = get_next_dmrs_symbol_in_slot(dlDmrsSymbPos,0,14); // get first dmrs symbol index for (unsigned char aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { @@ -1708,7 +1715,8 @@ void nr_dlsch_extract_rbs(int **rxdataF, uint8_t n_dmrs_cdm_groups, uint8_t Nl, NR_DL_FRAME_PARMS *frame_parms, - uint16_t dlDmrsSymbPos) + uint16_t dlDmrsSymbPos, + int chest_time_type) { unsigned short k,rb; @@ -1726,7 +1734,10 @@ void nr_dlsch_extract_rbs(int **rxdataF, nushift = (n_dmrs_cdm_groups -1)<<1;//delta in Table 7.4.1.1.2-2 } - validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos,symbol); + if (chest_time_type == 0) + validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos,symbol); + else + validDmrsEst = get_next_dmrs_symbol_in_slot(dlDmrsSymbPos,0,14); // get first dmrs symbol index for (aarx=0; aarxnb_antennas_rx; aarx++) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index a342c93e7c..9e680bf227 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -709,7 +709,8 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, unsigned short nb_rb_pdsch, uint8_t n_dmrs_cdm_groups, NR_DL_FRAME_PARMS *frame_parms, - uint16_t dlDmrsSymbPos); + uint16_t dlDmrsSymbPos, + int chest_time_type); /** \fn dlsch_extract_rbs_multiple(int32_t **rxdataF, int32_t **dl_ch_estimates, @@ -747,7 +748,8 @@ void nr_dlsch_extract_rbs(int **rxdataF, uint8_t n_dmrs_cdm_groups, uint8_t Nl, NR_DL_FRAME_PARMS *frame_parms, - uint16_t dlDmrsSymbPos); + uint16_t dlDmrsSymbPos, + int chest_time_type); /** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, int32_t **dl_bf_ch_estimates, diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index ace4cf120b..f805aec552 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -826,7 +826,11 @@ typedef struct PHY_VARS_gNB_s { int **dl_precoder_SgNB[3]; char log2_maxp; /// holds the maximum channel/precoder coefficient - int prb_interpolation; + int max_ldpc_iterations; + /// indicate the channel estimation technique in time domain + int chest_time; + /// indicate the channel estimation technique in freq domain + int chest_freq; /// if ==0 enables phy only test mode int mac_enabled; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 259367a994..8ba87b7a67 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -777,7 +777,8 @@ typedef struct { uint32_t perfect_ce; // flag to activate PRB based averaging of channel estimates // when off, defaults to frequency domain interpolation - int prb_interpolation; + int chest_freq; + int chest_time; int generate_ul_signal[NUMBER_OF_CONNECTED_gNB_MAX]; UE_NR_SCAN_INFO_t scan_info[NB_BANDS_MAX]; @@ -865,6 +866,8 @@ typedef struct { /// N0 (used for abstraction) double N0; + uint8_t max_ldpc_iterations; + /// PDSCH Varaibles PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_CONNECTED_gNB_MAX]; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index e38668000f..d366ae9ec1 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -36,6 +36,7 @@ #include "assertions.h" #include "defs.h" #include "PHY/defs_nr_UE.h" +#include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/phy_extern_nr_ue.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" @@ -611,6 +612,15 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ } } + if (ue->chest_time == 1) { // averaging time domain channel estimates + nr_chest_time_domain_avg(&ue->frame_parms, + ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates, + dlsch0_harq->nb_symbols, + dlsch0_harq->start_symbol, + dlsch0_harq->dlDmrsSymbPos, + pdsch_nb_rb); + } + uint16_t first_symbol_with_data = s0; uint32_t dmrs_data_re; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 51499c0f36..bab67e4426 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -66,6 +66,7 @@ #include "NR_RRCReconfiguration.h" #define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" +#include "PHY/NR_REFSIG/dmrs_nr.h" #include #include @@ -443,7 +444,8 @@ int main(int argc, char **argv) uint16_t rbSize = 106; uint8_t mcsIndex = 9; uint8_t dlsch_threads = 0; - int prb_inter = 0; + int chest_type[2] = {0}; + uint8_t max_ldpc_iterations = 5; if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) { exit_fun("[NR_DLSIM] Error, configuration module init failed\n"); } @@ -454,7 +456,7 @@ int main(int argc, char **argv) FILE *scg_fd=NULL; - while ((c = getopt (argc, argv, "f:hA:pf:g:in:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:q:m:w:T:U:X:")) != -1) { + while ((c = getopt (argc, argv, "f:hA:pf:g:i:n:s:S:t:x:y:z:M:N:F:GR:dPI:L:Ea:b:d:e:m:w:T:U:q:X:Y")) != -1) { switch (c) { case 'f': scg_fd = fopen(optarg,"r"); @@ -511,7 +513,9 @@ int main(int argc, char **argv) break; case 'i': - prb_inter=1; + for(i=0; i < atoi(optarg); i++){ + chest_type[i] = atoi(argv[optind++]); + } break; case 'n': @@ -598,9 +602,7 @@ int main(int argc, char **argv) break; case 'I': - run_initial_sync=1; - //target_error_rate=0.1; - slot = 0; + max_ldpc_iterations = atoi(optarg); break; case 'L': @@ -664,6 +666,12 @@ int main(int argc, char **argv) gNBthreads[sizeof(gNBthreads)-1]=0; break; + case 'Y': + run_initial_sync=1; + //target_error_rate=0.1; + slot = 0; + 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 -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", @@ -679,7 +687,7 @@ int main(int argc, char **argv) printf("-g [A,B,C,D,E,F,G,R] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models or R for MIMO model (ignores delay spread and Ricean factor)\n"); printf("-y Number of TX antennas used in gNB\n"); printf("-z Number of RX antennas used in UE\n"); - printf("-i Activate PRB based averaging for channel estimation. Frequncy domain interpolation by default.\n"); + printf("-i Change channel estimation technique. Arguments list: Frequency domain {0:Linear interpolation, 1:PRB based averaging}, Time domain {0:Estimates of last DMRS symbol, 1:Average of DMRS symbols}\n"); //printf("-j Relative strength of second intefering gNB (in dB) - cell_id mod 3 = 2\n"); printf("-R N_RB_DL\n"); printf("-O oversampling factor (1,2,4,8,16)\n"); @@ -696,12 +704,14 @@ int main(int argc, char **argv) printf("-e MSC index\n"); printf("-q MCS Table index\n"); printf("-t Acceptable effective throughput (in percentage)\n"); + printf("-I Maximum LDPC decoder iterations\n"); printf("-T Enable PTRS, arguments list L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n"); printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2} DMRS ConfType{1:2}, e.g. -U 3 0 2 1 \n"); printf("-P Print DLSCH performances\n"); printf("-w Write txdata to binary file (one frame)\n"); printf("-d number of dlsch threads, 0: no dlsch parallelization\n"); - printf("-X gNB thread pool configuration, n => no threads"); + printf("-X gNB thread pool configuration, n => no threads\n"); + printf("-Y Run initial sync in UE\n"); exit (-1); break; } @@ -957,6 +967,7 @@ int main(int argc, char **argv) PHY_vars_UE_g[0][0] = UE; memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS)); UE->frame_parms.nb_antennas_rx = n_rx; + UE->max_ldpc_iterations = max_ldpc_iterations; if (run_initial_sync==1) UE->is_synchronized = 0; else {UE->is_synchronized = 1; UE->UE_mode[0]=PUSCH;} @@ -991,8 +1002,8 @@ int main(int argc, char **argv) UE->if_inst->phy_config_request = nr_ue_phy_config_request; UE->if_inst->dl_indication = nr_ue_dl_indication; UE->if_inst->ul_indication = dummy_nr_ue_ul_indication; - UE->prb_interpolation = prb_inter; - + UE->chest_freq = chest_type[0]; + UE->chest_time = chest_type[1]; UE_mac->if_module = nr_ue_if_module_init(0); diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 8a0a2d5144..5392424285 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -141,6 +141,7 @@ int main(int argc, char **argv) uint16_t nb_rb = 50; uint8_t Imcs = 9; uint8_t Nl = 1; + uint8_t max_ldpc_iterations = 5; double DS_TDL = .03; @@ -395,6 +396,8 @@ int main(int argc, char **argv) frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_UL = N_RB_UL; frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL; + gNB->max_ldpc_iterations = max_ldpc_iterations; + crcTableInit(); memcpy(&gNB->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS)); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 9a3b29a637..2a3730c1d4 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -312,16 +312,15 @@ int main(int argc, char **argv) float roundStats[100]; double effRate[100]; double effTP[100]; - float eff_tp_check = 0.7; + float eff_tp_check = 100; uint8_t snrRun; - int prb_inter = 0; + int chest_type[2] = {0}; int enable_ptrs = 0; int modify_dmrs = 0; /* L_PTRS = ptrs_arg[0], K_PTRS = ptrs_arg[1] */ int ptrs_arg[2] = {-1,-1};// Invalid values - /* mapping type = dmrs_arg[0], Add Pos = dmrs_arg[1], dmrs config type = dmrs_arg[2] */ - int dmrs_arg[3] = {-1,-1,-1};// Invalid values + int dmrs_arg[4] = {-1,-1,-1,-1};// Invalid values uint16_t ptrsSymPos = 0; uint16_t ptrsSymbPerSlot = 0; uint16_t ptrsRePerSymb = 0; @@ -338,6 +337,7 @@ int main(int argc, char **argv) int ibwps=24; int ibwp_rboffset=41; int params_from_file = 0; + int max_ldpc_iterations = 5; if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0 ) { exit_fun("[NR_ULSIM] Error, configuration module init failed\n"); } @@ -348,7 +348,7 @@ int main(int argc, char **argv) /* initialize the sin-cos table */ InitSinLUT(); - while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:p:r:s:t:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z:W:")) != -1) { + while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:kl:m:n:p:q:r:s:t:u:w:y:z:F:G:H:I:M:N:PR:S:T:U:L:ZW:")) != -1) { printf("handling optarg %c\n",c); switch (c) { @@ -441,7 +441,9 @@ int main(int argc, char **argv) break; case 'i': - prb_inter=1; + for(i=0; i < atoi(optarg); i++){ + chest_type[i] = atoi(argv[optind++]); + } break; case 'k': @@ -468,6 +470,10 @@ int main(int argc, char **argv) case 'p': extended_prefix_flag = 1; break; + + case 'q': + mcs_table = atoi(optarg); + break; case 'r': nb_rb = atoi(optarg); @@ -487,7 +493,7 @@ int main(int argc, char **argv) break; case 't': - eff_tp_check = (float)atoi(optarg)/100; + eff_tp_check = (float)atoi(optarg); break; /* @@ -519,7 +525,7 @@ int main(int argc, char **argv) exit(-1); } break; - + case 'F': input_fd = fopen(optarg, "r"); if (input_fd == NULL) { @@ -536,6 +542,10 @@ int main(int argc, char **argv) slot = atoi(optarg); break; + case 'I': + max_ldpc_iterations = atoi(optarg); + break; + case 'M': // SSB_positions = atoi(optarg); break; @@ -597,13 +607,14 @@ int main(int argc, char **argv) printf("-f Number of frames to simulate\n"); printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n"); printf("-h This message\n"); - printf("-i Activate PRB based averaging for channel estimation. Frequncy domain interpolation by default.\n"); + printf("-i Change channel estimation technique. Arguments list: Number of arguments=2, Frequency domain {0:Linear interpolation, 1:PRB based averaging}, Time domain {0:Estimates of last DMRS symbol, 1:Average of DMRS symbols}. e.g. -i 2 1 0\n"); //printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n"); printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if ending SNR isn't given\n"); printf("-m MCS value\n"); printf("-n Number of trials to simulate\n"); printf("-p Use extended prefix mode\n"); - //printf("-t Delay spread for multipath channel\n"); + printf("-q MCS table\n"); + printf("-t Delay spread for multipath channel\n"); printf("-u Set the numerology\n"); printf("-w Start PRB for PUSCH\n"); //printf("-x Transmission mode (1,2,6 for the moment)\n"); @@ -613,7 +624,8 @@ int main(int argc, char **argv) //printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n"); printf("-F Input filename (.txt format) for RX conformance testing\n"); printf("-G Offset of samples to read from file (0 default)\n"); - printf("-L \n"); + printf("-L \n"); + printf("-I Maximum LDPC decoder iterations\n"); printf("-M Multiple SSB positions in burst\n"); printf("-N Nid_cell\n"); printf("-O oversampling factor (1,2,4,8,16)\n"); @@ -621,8 +633,8 @@ int main(int argc, char **argv) printf("-t Acceptable effective throughput (in percentage)\n"); printf("-S Ending SNR, runs from SNR0 to SNR1\n"); printf("-P Print ULSCH performances\n"); - printf("-T Enable PTRS, arguments list L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n"); - printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:3}, e.g. -U 2 0 2 \n"); + printf("-T Enable PTRS, arguments list: Number of arguments=2 L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n"); + printf("-U Change DMRS Config, arguments list: Number of arguments=4, DMRS Mapping Type{0=A,1=B}, DMRS AddPos{0:3}, DMRS Config Type{1,2}, Number of CDM groups without data{1,2,3} e.g. -U 4 0 2 0 1 \n"); printf("-Q If -F used, read parameters from file\n"); printf("-Z If -Z is used, SC-FDMA or transform precoding is enabled in Uplink \n"); printf("-W Num of layer for PUSCH\n"); @@ -717,7 +729,7 @@ int main(int argc, char **argv) gNB->UL_INFO.crc_ind.crc_list = (nfapi_nr_crc_t *)malloc(NB_UE_INST*sizeof(nfapi_nr_crc_t)); gNB->UL_INFO.rx_ind.number_of_pdus = 0; gNB->UL_INFO.crc_ind.number_crcs = 0; - gNB->prb_interpolation = prb_inter; + gNB->max_ldpc_iterations = max_ldpc_iterations; frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) frame_parms->N_RB_DL = N_RB_DL; @@ -781,6 +793,8 @@ int main(int argc, char **argv) cfg->carrier_config.num_tx_ant.value = 1; cfg->carrier_config.num_rx_ant.value = n_rx; // nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,0,0x01); + gNB->chest_freq = chest_type[0]; + gNB->chest_time = chest_type[1]; phy_init_nr_gNB(gNB,0,1); N_RB_DL = gNB->frame_parms.N_RB_DL; @@ -796,7 +810,7 @@ int main(int argc, char **argv) PHY_vars_UE_g[0][0] = UE; memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS)); UE->frame_parms.nb_antennas_tx = n_tx; - UE->frame_parms.nb_antennas_rx = 1; + UE->frame_parms.nb_antennas_rx = 0; if (init_nr_ue_signal(UE, 1) != 0) { printf("Error at UE NR initialisation\n"); @@ -895,6 +909,7 @@ int main(int argc, char **argv) dmrs_config_type = pusch_dmrs_type1; else if(dmrs_arg[2] == 2) dmrs_config_type = pusch_dmrs_type2; + num_dmrs_cdm_grps_no_data = dmrs_arg[3]; } uint8_t length_dmrs = pusch_len1; @@ -983,7 +998,6 @@ int main(int argc, char **argv) int slot_length = slot_offset - frame_parms->get_samples_slot_timestamp(slot-1,frame_parms,0); if (input_fd != NULL) { - AssertFatal(frame_parms->nb_antennas_rx == 1, "nb_ant != 1\n"); // 800 samples is N_TA_OFFSET for FR1 @ 30.72 Ms/s, AssertFatal(frame_parms->subcarrier_spacing==30000,"only 30 kHz for file input for now (%d)\n",frame_parms->subcarrier_spacing); @@ -1011,18 +1025,21 @@ int main(int argc, char **argv) printf("harq_pid %d\n",harq_pid); } fseek(input_fd,file_offset*sizeof(int16_t)*2,SEEK_SET); - read_errors+=fread((void*)&gNB->common_vars.rxdata[0][slot_offset-delay], - sizeof(int16_t), - slot_length<<1, - input_fd); - if (read_errors==0) { - printf("error reading file\n"); - exit(1); + for (int irx=0; irxnb_antennas_rx; irx++) { + fseek(input_fd,irx*(slot_length+15)*sizeof(int16_t)*2,SEEK_SET); // matlab adds samlples to the end to emulate channel delay + read_errors+=fread((void*)&gNB->common_vars.rxdata[irx][slot_offset-delay], + sizeof(int16_t), + slot_length<<1, + input_fd); + if (read_errors==0) { + printf("error reading file\n"); + exit(1); + } + for (int i=0;i<16;i+=2) printf("slot_offset %d : %d,%d\n", + slot_offset, + ((int16_t*)&gNB->common_vars.rxdata[irx][slot_offset])[i], + ((int16_t*)&gNB->common_vars.rxdata[irx][slot_offset])[1+i]); } - for (int i=0;i<16;i+=2) printf("slot_offset %d : %d,%d\n", - slot_offset, - ((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[i], - ((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]); mod_order = nr_get_Qm_ul(Imcs, mcs_table); code_rate = nr_get_code_rate_ul(Imcs, mcs_table); @@ -1389,11 +1406,11 @@ int main(int argc, char **argv) &gNB->pusch_vars[0]->llr_layers[0][0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0); if (precod_nbr_layers==2) { - LOG_M("rxsigF1_ext.m","rxsF1_ext", - &gNB->pusch_vars[0]->rxdataF_ext[1][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1); + LOG_M("rxsigF1_ext.m","rxsF1_ext", + &gNB->pusch_vars[0]->rxdataF_ext[1][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1); LOG_M("chestF3.m","chF3", - &gNB->pusch_vars[0]->ul_ch_estimates[3][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1); + &gNB->pusch_vars[0]->ul_ch_estimates[3][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1); LOG_M("chestF3_ext.m","chF3_ext", &gNB->pusch_vars[0]->ul_ch_estimates_ext[3][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))], @@ -1553,7 +1570,12 @@ int main(int argc, char **argv) roundStats[snrRun],effRate[snrRun],effTP[snrRun],TBS); FILE *fd=fopen("nr_ulsim.log","w"); + if (fd == NULL) { + printf("Problem with filename %s\n", "nr_ulsim.log"); + exit(-1); + } dump_pusch_stats(fd,gNB); + fclose(fd); printf("*****************************************\n"); printf("\n"); @@ -1583,7 +1605,7 @@ int main(int argc, char **argv) if(n_trials==1) break; - if (effRate[snrRun] > (eff_tp_check*TBS)) { + if ((float)effTP[snrRun] >= eff_tp_check) { printf("*************\n"); printf("PUSCH test OK\n"); printf("*************\n"); @@ -1613,17 +1635,19 @@ int main(int argc, char **argv) length_dmrs, num_dmrs_cdm_grps_no_data); - LOG_M("ulsimStats.m","SNR",snrStats,snrRun,1,7); - LOG_MM("ulsimStats.m","BLER_round0",blerStats[0],snrRun,1,7); - LOG_MM("ulsimStats.m","BLER_round1",blerStats[1],snrRun,1,7); - LOG_MM("ulsimStats.m","BLER_round2",blerStats[2],snrRun,1,7); - LOG_MM("ulsimStats.m","BLER_round3",blerStats[3],snrRun,1,7); - LOG_MM("ulsimStats.m","BER_round0",berStats[0],snrRun,1,7); - LOG_MM("ulsimStats.m","BER_round1",berStats[1],snrRun,1,7); - LOG_MM("ulsimStats.m","BER_round2",berStats[2],snrRun,1,7); - LOG_MM("ulsimStats.m","BER_round3",berStats[3],snrRun,1,7); - LOG_MM("ulsimStats.m","EffRate",effRate,snrRun,1,7); - LOG_MM("ulsimStats.m","EffTP",effTP,snrRun,1,7); + char opStatsFile[50]; + sprintf(opStatsFile, "ulsimStats_z%d.m", n_rx); + LOG_M(opStatsFile,"SNR",snrStats,snrRun,1,7); + LOG_MM(opStatsFile,"BLER_round0",blerStats[0],snrRun,1,7); + LOG_MM(opStatsFile,"BLER_round1",blerStats[1],snrRun,1,7); + LOG_MM(opStatsFile,"BLER_round2",blerStats[2],snrRun,1,7); + LOG_MM(opStatsFile,"BLER_round3",blerStats[3],snrRun,1,7); + LOG_MM(opStatsFile,"BER_round0",berStats[0],snrRun,1,7); + LOG_MM(opStatsFile,"BER_round1",berStats[1],snrRun,1,7); + LOG_MM(opStatsFile,"BER_round2",berStats[2],snrRun,1,7); + LOG_MM(opStatsFile,"BER_round3",berStats[3],snrRun,1,7); + LOG_MM(opStatsFile,"EffRate",effRate,snrRun,1,7); + LOG_MM(opStatsFile,"EffTP",effTP,snrRun,1,7); free(test_input_bit); free(estimated_output_bit); diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index 90cd9aae29..1e5122956e 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -51,6 +51,7 @@ #define CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD "pucch0_dtx_threshold" #define CONFIG_STRING_L1_PRACH_DTX_THRESHOLD "prach_dtx_threshold" #define CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD "pusch_dtx_threshold" +#define CONFIG_STRING_L1_MAX_LDPC_ITERATIONS "max_ldpc_iterations" /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* L1 configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -69,7 +70,8 @@ {CONFIG_STRING_L1_OFDM_OFFSET_DIVISOR, NULL, 0, uptr:NULL, defuintval:8, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:100, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:150, TYPE_UINT, 0}, \ -{CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0} \ +{CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_MAX_LDPC_ITERATIONS, NULL, 0, uptr:NULL, defintval:5, TYPE_UINT, 0}, \ } #define L1_CC_IDX 0 #define L1_TRANSPORT_N_PREFERENCE_IDX 1 @@ -85,6 +87,7 @@ #define L1_PUCCH0_DTX_THRESHOLD 11 #define L1_PRACH_DTX_THRESHOLD 12 #define L1_PUSCH_DTX_THRESHOLD 13 +#define L1_MAX_LDPC_ITERATIONS 14 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 6ceab3b97d..21655a74d5 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -727,6 +727,7 @@ void RCconfig_NR_L1(void) { RC.gNB[j]->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr); RC.gNB[j]->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr); RC.gNB[j]->pusch_thres = *(L1_ParamList.paramarray[j][L1_PUSCH_DTX_THRESHOLD].uptr); + RC.gNB[j]->max_ldpc_iterations = *(L1_ParamList.paramarray[j][L1_MAX_LDPC_ITERATIONS].uptr); RC.gNB[j]->num_ulprbbl = num_prbbl; RC.gNB[j]->ap_N1 = N1; RC.gNB[j]->ap_N2 = N2; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index 1773e1fb79..909c54b858 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -182,11 +182,11 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } ); L1s = ( @@ -194,6 +194,7 @@ L1s = ( num_cc = 1; tr_n_preference = "local_mac"; thread_pool_size = 8; + max_ldpc_iterations = 5; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 } );