diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index 3a7dd8d523da6c5783fa090052a639b8a860b3b1..5f64d0f006a6fce0cf0fdce76e38e995aeed1950 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -40,7 +40,7 @@ typedef struct { uint16_t length; union { uint32_t *ptr; - uint32_t direct[16384]; + uint32_t direct[38016]; } value; } nfapi_nr_tx_data_request_tlv_t; diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 979a31c50462f3aa51790f11097c1f85938b483f..2522e146e29279d548670b50801531c9c47f670d 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -251,7 +251,7 @@ void nr_modulation(uint32_t *in, void nr_layer_mapping(int16_t **mod_symbs, uint8_t n_layers, - uint16_t n_symbs, + uint32_t n_symbs, int16_t **tx_layers) { LOG_D(PHY,"Doing layer mapping for %d layers, %d symbols\n",n_layers,n_symbs); @@ -323,7 +323,7 @@ void nr_layer_mapping(int16_t **mod_symbs, void nr_ue_layer_mapping(int16_t *mod_symbs, uint8_t n_layers, - uint16_t n_symbs, + uint32_t n_symbs, int16_t **tx_layers) { for (int i=0; i<n_symbs/n_layers; i++) { diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index 65f147fffa2716cd4317b072ac31de34399d55e0..88a4cfefedcb6639650454f2b036212241e797be 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -56,7 +56,7 @@ void nr_modulation(uint32_t *in, void nr_layer_mapping(int16_t **mod_symbs, uint8_t n_layers, - uint16_t n_symbs, + uint32_t n_symbs, int16_t **tx_layers); /*! \brief Perform NR layer mapping. TS 38.211 V15.4.0 subclause 7.3.1.3 @@ -68,7 +68,7 @@ void nr_layer_mapping(int16_t **mod_symbs, void nr_ue_layer_mapping(int16_t *mod_symbs, uint8_t n_layers, - uint16_t n_symbs, + uint32_t n_symbs, int16_t **tx_layers); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 30dbc39185c125587c105963d263108dce39965a..f095fec9651ea4b8aa78c12fad0ee29e6764a7d0 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -103,7 +103,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, uint32_t ***pdsch_dmrs = gNB->nr_gold_pdsch_dmrs[slot]; uint16_t dmrs_symbol_map = rel15->dlDmrsSymbPos;//single DMRS: 010000100 Double DMRS 110001100 uint8_t dmrs_len = get_num_dmrs(rel15->dlDmrsSymbPos); - uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers; + uint32_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers; uint8_t Qm = rel15->qamModOrder[0]; uint32_t encoded_length = nb_re*Qm; int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16))); @@ -254,7 +254,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, 1+dmrs_Type,nl, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol); #endif - uint16_t m=0, dmrs_idx=0; + uint32_t m=0, dmrs_idx=0; // Loop Over OFDM symbols: for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) { diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c index 1acf23197c73509102f5450adffefe45ccc5eece..4d7335713ab741ff0b53a4629d4c27b1a86cd5b5 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c @@ -46,18 +46,18 @@ uint32_t nr_compute_tbs(uint16_t Qm, uint8_t Nl) { - uint16_t nbp_re, nb_re; - uint32_t nr_tbs=0; - uint32_t Ninfo, Np_info, C; - uint8_t n; - LOG_D(NR_MAC, "In %s: nb_symb_sch %d, nb_dmrs_prb %d, nb_rb %d, nb_rb_oh %d, tb_scaling %d Nl %d\n", __FUNCTION__, nb_symb_sch, nb_dmrs_prb, nb_rb, nb_rb_oh, tb_scaling, Nl); - nbp_re = NR_NB_SC_PER_RB * nb_symb_sch - nb_dmrs_prb - nb_rb_oh; - nb_re = min(156, nbp_re) * nb_rb; + const uint32_t nbp_re = NR_NB_SC_PER_RB * nb_symb_sch - nb_dmrs_prb - nb_rb_oh; + const uint32_t nb_re = min(156, nbp_re) * nb_rb; // Intermediate number of information bits - // R is tabulated as 10 times the actual code rate - Ninfo = ((nb_re * R * Qm * Nl / 10)>>10)>>tb_scaling; + // Rx1024 is tabulated as 10 times the actual code rate + const uint32_t R_5 = R/5; // R can be fractional so we can't divide by 10 + // So we ned to right shift by 11 (10 for x1024 and 1 additional as above) + const uint32_t Ninfo = ((nb_re * R_5 * Qm * Nl)>>11)>>tb_scaling; + + uint32_t nr_tbs=0; + uint32_t Np_info, C, n; if (Ninfo <=3824) { n = max(3, floor(log2(Ninfo)) - 6); @@ -85,7 +85,7 @@ uint32_t nr_compute_tbs(uint16_t Qm, } } - LOG_D(NR_MAC, "In %s: Ninfo %d nbp_re %d nb_re %d Qm %d, R %d, tbs %d bits\n", __FUNCTION__, Ninfo, nbp_re, nb_re, Qm, R, nr_tbs); + LOG_D(NR_MAC, "In %s: Ninfo %u nbp_re %d nb_re %d Qm %d, R %d, tbs %d bits\n", __FUNCTION__, Ninfo, nbp_re, nb_re, Qm, R, nr_tbs); return nr_tbs; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index a531a1c71c6438f2eba6bb62848c7e31bba758eb..90d0af946a46e0b63d33ea2ff6bee3fbb787f60e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -610,8 +610,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; // Data to be transmitted - bzero(tx_req->TLVs[0].value.direct,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*1056); - memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); + memcpy(tx_req->TLVs[0].value.direct, sib1_payload, TBS); tx_req->PDU_length = TBS; tx_req->PDU_index = pdu_index; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 09f3193790b01c2564f723453ac2f1372abeeac0..0543b09e9e393adbdb543218dbef0f5b4163e543 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -475,7 +475,7 @@ typedef struct NR_UE_harq { /* Transport block to be sent using this HARQ process, its size is in * sched_pdsch */ - uint32_t transportBlock[16384]; + uint32_t transportBlock[38016]; // valid up to 4 layers uint32_t tb_size; /// sched_pdsch keeps information on MCS etc used for the initial transmission