diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 1fdc3446d9..a8b8a2149a 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1105,7 +1105,8 @@ (Test20: Mapping type B, 4 DMRS Symbols), (Test21: 4x4 MIMO, 1 Layer), (Test22: 4x4 MIMO, 2 Layers), - (Test23: 25 PRBs, 15 kHz SCS) + (Test23: 25 PRBs, 15 kHz SCS) + (Test24: MCS 0, low SNR performance) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1134,8 +1135,9 @@ -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 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 + -n100 -m0 -e0 -R25 -b25 -i 2 1 0 + -n100 -e0 -t99 -S-1.0 -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 nr_dlsim.test24 PDSCH test OK segmentation fault|assertion|exiting|fatal 3 @@ -1314,7 +1316,8 @@ (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) + (Test21: 3GPP G-FR1-A4-13 8 RX Antennas Requirements Test), + (Test22: MCS 0, low SNR performance) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1341,9 +1344,9 @@ -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 + -m16 -r106 -s3.4 -S3.8 -z8 -n200 -U 4 1 1 1 2 -gI -b14 -t70 -I15 -i 2 1 0 + -n100 -m0 -S -0.8 -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 nr_ulsim.test22 PUSCH test OK segmentation fault|assertion|exiting|fatal 3 diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 6c5c610723..0310453ca0 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -209,6 +209,7 @@ extern int usrp_tx_thread; #define SOFTMODEM_NONBIOT_BIT (1<<2) #define SOFTMODEM_RFSIM_BIT (1<<10) #define SOFTMODEM_SIML1_BIT (1<<12) +#define SOFTMODEM_DLSIM_BIT (1<<13) #define SOFTMODEM_DOSCOPE_BIT (1<<15) #define SOFTMODEM_RECPLAY_BIT (1<<16) #define SOFTMODEM_TELNETCLT_BIT (1<<17) @@ -225,6 +226,7 @@ extern int usrp_tx_thread; #define IS_SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT) #define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT) #define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT) +#define IS_SOFTMODEM_DLSIM ( get_softmodem_optmask() & SOFTMODEM_DLSIM_BIT) #define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT) #define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT) #define IS_SOFTMODEM_TELNETCLT_BIT ( get_softmodem_optmask() & SOFTMODEM_TELNETCLT_BIT) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 45125c8db4..d32fd77b03 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -38,6 +38,7 @@ #include "PHY/NR_REFSIG/ptrs_nr.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/nr/nr_common.h" +#include "executables/softmodem-common.h" //#define DEBUG_DLSCH //#define DEBUG_DLSCH_MAPPING @@ -153,6 +154,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, printf("\n"); #endif + if (IS_SOFTMODEM_DLSIM) + memcpy(harq->f, output, encoded_length); + for (int q=0; qNrOfCodewords; q++) { /// scrambling start_meas(dlsch_scrambling_stats); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 548cc6dbd4..f0f9f4fe34 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -69,6 +69,10 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, free16(harq->b, a_segments * 1056); harq->b = NULL; } + if (harq->f) { + free16(harq->f, N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); + harq->f = NULL; + } for (int r = 0; r < a_segments; r++) { free(harq->c[r]); harq->c[r] = NULL; @@ -177,6 +181,10 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, bzero(harq->c[r], 8448); } + harq->f = malloc16(N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); + AssertFatal(harq->f, "cannot allocate harq->f\n"); + bzero(harq->f, N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); + return(dlsch); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c index ad41ebf3d6..f6eefe846a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c @@ -44,19 +44,19 @@ void nr_ulsch_qpsk_llr(int32_t *rxdataF_comp, uint32_t nb_re, uint8_t symbol) { - uint32_t *rxF = (uint32_t*)rxdataF_comp; - uint32_t *llr32 = (uint32_t*)ulsch_llr; + c16_t *rxF = (c16_t *)rxdataF_comp; + c16_t *llr32 = (c16_t *)ulsch_llr; if (!llr32) { LOG_E(PHY,"nr_ulsch_qpsk_llr: llr is null, symbol %d, llr32 = %p\n",symbol, llr32); } - /* - for (i = 0; i < nb_re; i++) { - *llr32 = *rxF; + for (int i = 0; i < nb_re; i++) { + //*llr32 = *rxF; + llr32->r = rxF->r >> 3; + llr32->i = rxF->i >> 3; rxF++; llr32++; - }*/ - memcpy1((void*)llr32,(void*)rxF,nb_re<<2); + } } //---------------------------------------------------------------------------------------------- diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c index 624894aeb9..6c9173c48f 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c +++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c @@ -93,7 +93,7 @@ short filt16a_m3_dc[16] = { -9831,-6554,-3277,0,3276,6553,9830,16384,12288,8192,4096,0,0,0,0,0}; short filt16a_1[16] = { -16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384}; +16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,0,0,0,0}; short filt16a_2l0[16] = { 16384,12288,8192,4096,-4096,0,0,0,0,0,0,0,0,0,0,0}; @@ -295,4 +295,4 @@ short filt24_end[24] = { short filt24_middle[24] = { 4096,4779,5461,6144,6827,7509,8192,8875,9557,10240,10923,11605, - 12288,11605,10923,10240,9557,8875,8192,7509,6827,6144,5461,4779}; \ No newline at end of file + 12288,11605,10923,10240,9557,8875,8192,7509,6827,6144,5461,4779}; 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 082370dff4..8936a69e70 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -34,6 +34,7 @@ //#define DEBUG_PDSCH //#define DEBUG_PDCCH +#define CH_INTERP 0 #define NO_INTERP 1 int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, @@ -477,7 +478,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, unsigned char aarx; unsigned short k; unsigned int pilot_cnt; - int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr; + int16_t ch[2],*pil,*rxF,*dl_ch; int ch_offset,symbol_offset; int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; @@ -492,9 +493,11 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, proc->thread_id, gNB_id,ch_offset,ue->frame_parms.ofdm_symbol_size,ue->frame_parms.Ncp,Ns,symbol); #endif - fl = filt16a_l1; - fm = filt16a_m1; - fr = filt16a_r1; +#if CH_INTERP + int16_t *fl = filt16a_l1; + int16_t *fm = filt16a_m1; + int16_t *fr = filt16a_r1; +#endif // checking if re-initialization of scrambling IDs is needed (should be done here but scrambling ID for PDCCH is not taken from RRC) if (scrambling_id != ue->scramblingID_pdcch){ @@ -523,6 +526,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, printf("dl_ch addr %p\n",dl_ch); #endif + #if CH_INTERP // if ((ue->frame_parms.N_RB_DL&1)==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); @@ -651,6 +655,33 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, rxF += 8; k += 4; } + #else //ELSE CH_INTERP + int ch_sum[2] = {0, 0}; + + for (pilot_cnt = 0; pilot_cnt < 3*nb_rb_coreset; pilot_cnt++) { + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } +#ifdef DEBUG_PDCCH + printf("pilot[%d] = (%d, %d)\trxF[%d] = (%d, %d)\n", pilot_cnt, pil[0], pil[1], k+1, rxF[0], rxF[1]); +#endif + ch_sum[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); + ch_sum[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); + pil += 2; + rxF += 8; + k += 4; + + if (pilot_cnt % 3 == 2) { + ch[0] = ch_sum[0] / 3; + ch[1] = ch_sum[1] / 3; + multadd_real_vector_complex_scalar(filt16a_1, ch, dl_ch, 16); + dl_ch += 24; + ch_sum[0] = 0; + ch_sum[1] = 0; + } + } + #endif //END CH_INTERP //} diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 45eadd2c95..68a0ec56d8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -918,7 +918,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length,*(unsigned long long*)dci_estimation); uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,L*108,n_rnti, NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L); ue->dci_thres = (ue->dci_thres + mb) / 2; - if (mb > (ue->dci_thres+20)) { + if (mb > (ue->dci_thres+30)) { LOG_W(PHY,"DCI false positive. Dropping DCI index %d. Mismatched bits: %d/%d. Current DCI threshold: %d\n",j,mb,L*108,ue->dci_thres); continue; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c index 7c75884fa6..ca15a5b5be 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c @@ -638,11 +638,10 @@ int nr_dlsch_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, uint8_t beamforming_mode) { - uint32_t *rxF = (uint32_t *)&rxdataF_comp[((int32_t)symbol*nb_rb*12)]; - uint32_t *llr32; + c16_t *rxF = (c16_t *)&rxdataF_comp[((int32_t)symbol*nb_rb*12)]; + c16_t *llr32 = (c16_t *)dlsch_llr; int i; - llr32 = (uint32_t*)dlsch_llr; if (!llr32) { LOG_E(PHY,"nr_dlsch_qpsk_llr: llr is null, symbol %d, llr32=%p\n",symbol, llr32); return(-1); @@ -656,8 +655,10 @@ int nr_dlsch_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, llr32); */ for (i=0; ir = rxF->r >> 3; + llr32->i = rxF->i >> 3; + //printf("dlsch_qpsk_llr %d : (%d,%d)\n", i, llr32->r, llr32->i); rxF++; llr32++; } diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index f805aec552..9ed6f50616 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -96,6 +96,8 @@ typedef struct { uint32_t subframe; /// MIMO mode for this DLSCH MIMO_mode_t mimo_mode; + /// Interleaver outputs + uint8_t *f; /// LDPC lifting size uint32_t Z; } NR_DL_gNB_HARQ_t; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 8ba87b7a67..bd6808c54d 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -773,8 +773,6 @@ typedef struct { uint32_t X_u[64][839]; - - uint32_t perfect_ce; // flag to activate PRB based averaging of channel estimates // when off, defaults to frequency domain interpolation int chest_freq; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index bab67e4426..1a526174f0 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -277,11 +277,17 @@ void nr_dlsim_preprocessor(module_id_t module_id, const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; sched_ctrl->search_space = get_searchspace(NULL, scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss); - uint8_t nr_of_candidates; - find_aggregation_candidates(&sched_ctrl->aggregation_level, - &nr_of_candidates, - sched_ctrl->search_space,4); - + uint8_t nr_of_candidates = 0; + if (g_mcsIndex < 4) { + find_aggregation_candidates(&sched_ctrl->aggregation_level, + &nr_of_candidates, + sched_ctrl->search_space,8); + } + if (nr_of_candidates == 0) { + find_aggregation_candidates(&sched_ctrl->aggregation_level, + &nr_of_candidates, + sched_ctrl->search_space,4); + } sched_ctrl->coreset = get_coreset(RC.nrmac[module_id], scc, sched_ctrl->active_bwp->bwp_Dedicated, sched_ctrl->search_space, target_ss); uint32_t Y = get_Y(sched_ctrl->search_space, slot, UE_info->rnti); int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id], @@ -367,10 +373,13 @@ int main(int argc, char **argv) int i,aa;//,l; double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0; uint8_t snr1set=0; - double roundStats[500] = {0}; - double blerStats[500] = {0}; - double berStats[500] = {0}; - double snrStats[500] = {0}; + uint32_t errors_scrambling[4][100] = {{0}}; + int n_errors[4][100] = {{0}}; + int round_trials[4][100] = {{0}}; + double roundStats[100] = {0}; + double blerStats[4][100] = {{0}}; + double berStats[4][100] = {{0}}; + double snrStats[100] = {0}; float effRate; //float psnr; float eff_tp_check = 0.7; @@ -388,7 +397,7 @@ int main(int argc, char **argv) //int freq_offset; // int subframe_offset; // char fname[40], vname[40]; - int trial, n_trials = 1, n_errors = 0, n_false_positive = 0; + int trial, n_trials = 1, n_false_positive = 0; //int n_errors2, n_alamouti; uint8_t n_tx=1,n_rx=1; uint8_t round; @@ -671,7 +680,7 @@ int main(int argc, char **argv) //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", @@ -725,6 +734,7 @@ int main(int argc, char **argv) get_softmodem_params()->phy_test = 1; get_softmodem_params()->do_ra = 0; + set_softmodem_optmask(SOFTMODEM_DLSIM_BIT); if (snr1set==0) snr1 = snr0+10; @@ -971,8 +981,6 @@ int main(int argc, char **argv) if (run_initial_sync==1) UE->is_synchronized = 0; else {UE->is_synchronized = 1; UE->UE_mode[0]=PUSCH;} - - UE->perfect_ce = 0; if (init_nr_ue_signal(UE, 1) != 0) { @@ -1011,7 +1019,6 @@ int main(int argc, char **argv) unsigned char *estimated_output_bit; unsigned char *test_input_bit; unsigned int errors_bit = 0; - uint32_t errors_scrambling = 0; initTpool("N", &(nrUE_params.Tpool), false); @@ -1052,6 +1059,7 @@ int main(int argc, char **argv) nr_ue_phy_config_request(&UE_mac->phy_config); //NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels; snrRun = 0; + int n_errs = 0; gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); initTpool(gNBthreads, gNB->threadPool, true); @@ -1085,11 +1093,9 @@ int main(int argc, char **argv) clear_pdsch_stats(gNB); - n_errors = 0; effRate = 0; //n_errors2 = 0; //n_alamouti = 0; - errors_scrambling=0; n_false_positive = 0; if (n_trials== 1) num_rounds = 1; @@ -1121,6 +1127,7 @@ int main(int argc, char **argv) UE_harq_process->first_rx = 1; while ((roundack==0)) { + round_trials[round][snrRun]++; clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot); UE_info->UE_sched_ctrl.harq_processes[harq_pid].ndi = !(trial&1); @@ -1288,49 +1295,45 @@ int main(int argc, char **argv) &phy_pdcch_config, NULL); + //---------------------------------------------------------- + //---------------------- count errors ---------------------- + //---------------------------------------------------------- + + if (UE->dlsch[UE_proc.thread_id][0][0]->last_iteration_cnt >= + UE->dlsch[UE_proc.thread_id][0][0]->max_ldpc_iterations+1) + n_errors[round][snrRun]++; + + NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars[UE_proc.thread_id]; + int16_t *UE_llr = pdsch_vars[0]->llr[0]; + + TBS = UE_harq_process->TBS;//rel15->TBSize[0]; + uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos); + uint16_t nb_rb = rel15->rbSize; + uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6*UE_harq_process->n_dmrs_cdm_groups : 4*UE_harq_process->n_dmrs_cdm_groups; + uint8_t mod_order = rel15->qamModOrder[0]; + uint8_t nb_symb_sch = rel15->NrOfSymbols; + + available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15->nrOfLayers); + if(pdu_bit_map & 0x1) { + available_bits-= (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2); + printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) ); + } + + for (i = 0; i < available_bits; i++) { + if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) || + ((gNB_dlsch->harq_process.f[i] == 1) && (UE_llr[i] >= 0))) + { + if(errors_scrambling[round][snrRun] == 0) { + LOG_D(PHY,"First bit in error in unscrambling = %d\n",i); + } + errors_scrambling[round][snrRun]++; + } + } + //printf("dlsim round %d ends\n",round); round++; } // round - //---------------------------------------------------------- - //---------------------- count errors ---------------------- - //---------------------------------------------------------- - - if (UE->dlsch[UE_proc.thread_id][0][0]->last_iteration_cnt >= - UE->dlsch[UE_proc.thread_id][0][0]->max_ldpc_iterations+1) - n_errors++; - - //NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars[UE_proc.thread_id]; - //int16_t *UE_llr = pdsch_vars[0]->llr[0]; - - TBS = UE_harq_process->TBS;//rel15->TBSize[0]; - uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos); - uint16_t nb_rb = rel15->rbSize; - uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6*UE_harq_process->n_dmrs_cdm_groups : 4*UE_harq_process->n_dmrs_cdm_groups; - uint8_t mod_order = rel15->qamModOrder[0]; - uint8_t nb_symb_sch = rel15->NrOfSymbols; - - available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15->nrOfLayers); - if(pdu_bit_map & 0x1) { - available_bits-= (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2); - LOG_D(PHY,"[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) ); - } - - /* - for (i = 0; i < available_bits; i++) { - - if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) || - ((gNB_dlsch->harq_process.f[i] == 1) && (UE_llr[i] >= 0))) - { - if(errors_scrambling == 0) { - LOG_D(PHY,"\n"); - LOG_D(PHY,"First bit in error in unscrambling = %d\n",i); - } - errors_scrambling++; - } - - } - */ for (i = 0; i < TBS; i++) { estimated_output_bit[i] = (UE_harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7); @@ -1338,19 +1341,14 @@ int main(int argc, char **argv) if (estimated_output_bit[i] != test_input_bit[i]) { if(errors_bit == 0) - LOG_D(PHY,"First bit in error in decoding = %d (errors scrambling %d)\n",i,errors_scrambling); + LOG_D(PHY,"First bit in error in decoding = %d\n",i); errors_bit++; } } //////////////////////////////////////////////////////////// - - if (errors_scrambling > 0) { - if (n_trials == 1) - printf("errors_scrambling = %u/%u (trial %d)\n", errors_scrambling, available_bits,trial); - } - + if (errors_bit > 0) { n_false_positive++; if (n_trials == 1) @@ -1360,18 +1358,48 @@ int main(int argc, char **argv) if (UE_harq_process->ack==1) effRate += ((float)TBS)/round; } // noise trials - blerStats[snrRun] = (float) n_errors / (float) n_trials; roundStats[snrRun]/=((float)n_trials); - berStats[snrRun] = (double)errors_scrambling/available_bits/n_trials; + + blerStats[0][snrRun] = (double)n_errors[0][snrRun]/round_trials[0][snrRun]; + blerStats[1][snrRun] = (double)n_errors[1][snrRun]/round_trials[1][snrRun]; + blerStats[2][snrRun] = (double)n_errors[2][snrRun]/round_trials[2][snrRun]; + blerStats[3][snrRun] = (double)n_errors[3][snrRun]/round_trials[3][snrRun]; + + berStats[0][snrRun] = (double)errors_scrambling[0][snrRun]/available_bits/round_trials[0][snrRun]; + berStats[1][snrRun] = (double)errors_scrambling[1][snrRun]/available_bits/round_trials[1][snrRun]; + berStats[2][snrRun] = (double)errors_scrambling[2][snrRun]/available_bits/round_trials[2][snrRun]; + berStats[3][snrRun] = (double)errors_scrambling[3][snrRun]/available_bits/round_trials[3][snrRun]; + effRate /= n_trials; printf("*****************************************\n"); - printf("SNR %f, (false positive %f)\n", SNR, - (float) n_errors / (float) n_trials); - printf("*****************************************\n"); + printf("SNR %f: n_errors (%d/%d,%d/%d,%d/%d,%d/%d) (negative CRC), false_positive %d/%d, errors_scrambling (%u/%u,%u/%u,%u/%u,%u/%u\n", + SNR, + n_errors[0][snrRun], round_trials[0][snrRun], + n_errors[1][snrRun], round_trials[1][snrRun], + n_errors[2][snrRun], round_trials[2][snrRun], + n_errors[3][snrRun], round_trials[3][snrRun], + n_false_positive, n_trials, + errors_scrambling[0][snrRun], available_bits*round_trials[0][snrRun], + errors_scrambling[1][snrRun], available_bits*round_trials[1][snrRun], + errors_scrambling[2][snrRun], available_bits*round_trials[2][snrRun], + errors_scrambling[3][snrRun], available_bits*round_trials[3][snrRun]); printf("\n"); dump_pdsch_stats(stdout,gNB); - printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", - SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS); + printf("SNR %f: Channel BLER (%e,%e,%e,%e), Channel BER (%e,%e,%e,%e) Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", + SNR, + blerStats[0][snrRun], + blerStats[1][snrRun], + blerStats[2][snrRun], + blerStats[3][snrRun], + berStats[0][snrRun], + berStats[1][snrRun], + berStats[2][snrRun], + berStats[3][snrRun], + roundStats[snrRun], + effRate, + effRate/TBS*100, + TBS); + printf("*****************************************\n"); printf("\n"); if (print_perf==1) { @@ -1431,6 +1459,7 @@ int main(int argc, char **argv) LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1); if (UE->frame_parms.nb_antennas_rx>1) LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1); + LOG_M("rxF0.m","rxF0", UE->common_vars.common_vars_rx_data_per_thread[UE_proc.thread_id].rxdataF[0], frame_parms->samples_per_slot_wCP, 1, 1); LOG_M("chestF0.m","chF0",&UE->pdsch_vars[0][0]->dl_ch_estimates_ext[0][0],g_rbSize*12*14,1,1); write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1); LOG_M("rxF_llr.m","rxFllr",UE->pdsch_vars[UE_proc.thread_id][0]->llr[0],available_bits,1,0); @@ -1444,6 +1473,7 @@ int main(int argc, char **argv) snrStats[snrRun] = SNR; snrRun++; + n_errs = n_errors[0][snrRun]; } // NSR LOG_M("dlsimStats.m","SNR",snrStats,snrRun,1,7); @@ -1487,8 +1517,8 @@ int main(int argc, char **argv) if (scg_fd) fclose(scg_fd); - return(n_errors); - + + return n_errs; } diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 62f6b21528..ca696d4f9c 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -561,8 +561,6 @@ int main(int argc, char **argv) if (run_initial_sync==1) UE->is_synchronized = 0; else UE->is_synchronized = 1; - UE->perfect_ce = 0; - if(eps!=0.0) UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 7cbdf9f7ba..63a24a7c13 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -476,7 +476,6 @@ int main(int argc, char **argv) UE = calloc(1,sizeof(PHY_VARS_NR_UE)); memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS)); UE->frame_parms.nb_antennas_rx=1; - UE->perfect_ce = 0; if(eps!=0.0) UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index fda89d5b30..43bef59df4 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -475,7 +475,7 @@ int main(int argc, char **argv) case 'q': mcs_table = atoi(optarg); break; - + case 'r': nb_rb = atoi(optarg); break; @@ -606,7 +606,7 @@ int main(int argc, char **argv) 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 -Z Enable SC-FDMA in Uplink \n", argv[0]); + printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -i Intefrence0 -j Interference1 -n n_frames -s snr0 -S snr1 -t Delayspread -x transmission_mode -y TXant -z RXant -A interpolation_file -C(alibration offset dB) -N CellId -Z Enable SC-FDMA in Uplink \n", argv[0]); //printf("-d Use TDD\n"); printf("-d Introduce delay in terms of number of samples\n"); printf("-f Number of frames to simulate\n"); @@ -629,7 +629,7 @@ 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"); @@ -746,6 +746,7 @@ int main(int argc, char **argv) gNB->UL_INFO.rx_ind.number_of_pdus = 0; gNB->UL_INFO.crc_ind.number_crcs = 0; gNB->max_ldpc_iterations = max_ldpc_iterations; + gNB->pusch_thres = -20; frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) frame_parms->N_RB_DL = N_RB_DL; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 140fde407f..ad6bf3cdc4 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -839,7 +839,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, mappingtype, add_pos, dmrslength, pusch_config_pdu->start_symbol_index, mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position); - if ((mac->ULbwp[ul_bwp_id-1] && pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled)) { + if (mac->ULbwp[ul_bwp_id-1] && pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled) { if (*dci_format != NR_UL_DCI_FORMAT_0_1) { pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1; } diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 0118778582..a6fef46c34 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -200,13 +200,16 @@ void fill_default_nsa_downlinkBWP(NR_BWP_Downlink_t *bwp, ss2->nrofCandidates=calloc(1,sizeof(*ss2->nrofCandidates)); ss2->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; ss2->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - if (curr_bwp < 48) + if (curr_bwp < 48) { ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; - else if (curr_bwp < 96) + ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + } else if (curr_bwp < 96) { ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2; - else + ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n1; + } else { ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4; - ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n2; + } ss2->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType)); ss2->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_ue_Specific;