From 23c1ea021b63d774bf2f9df34ff0e4abc364b2f7 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 28 Sep 2023 18:08:02 +0200 Subject: [PATCH] fix for errors caught with sanitize in PUCCH2 --- openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c | 5 ++++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c index d59da8be97..94c9d23724 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c @@ -757,7 +757,10 @@ void nr_generate_pucch2(const PHY_VARS_NR_UE *ue, for (int l=0; lnr_of_symbols; l++) { // c_init calculation according to TS38.211 subclause - x2 = (((1<<17)*((14*nr_slot_tx) + (l+startingSymbolIndex) + 1)*((2*pucch_pdu->dmrs_scrambling_id) + 1)) + (2*pucch_pdu->dmrs_scrambling_id))%(1U<<31); + uint64_t temp_x2 = 1 << 17; + temp_x2 *= (14 * nr_slot_tx) + (l + startingSymbolIndex) + 1; + temp_x2 *= (2 * pucch_pdu->dmrs_scrambling_id) + 1; + x2 = (temp_x2 + (2 * pucch_pdu->dmrs_scrambling_id)) % (1U << 31); int reset = 1; for (int ii=0; ii<=(startingPRB>>2); ii++) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c5cef25784..2090140a6d 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1560,7 +1560,7 @@ int get_deltatf(uint16_t nb_of_prbs, { int DELTA_TF; int O_CRC = compute_pucch_crc_size(O_UCI); - int N_symb = nb_symbols_excluding_dmrs[N_symb_PUCCH-4][add_dmrs_flag][freq_hop_flag]; + int N_symb = N_symb_PUCCH < 4 ? N_symb_PUCCH : nb_symbols_excluding_dmrs[N_symb_PUCCH - 4][add_dmrs_flag][freq_hop_flag]; float N_RE = nb_of_prbs * N_sc_ctrl_RB * N_symb; float K1 = 6; if (O_UCI + O_CRC < 12)