diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 5a7bd8a020..494e8a7de0 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -80,16 +80,17 @@ char nr_dci_format_string[8][30] = { static void nr_pdcch_demapping_deinterleaving(uint32_t *llr, - uint32_t *e_rx, - uint8_t coreset_time_dur, - uint8_t start_symbol, - uint32_t coreset_nbr_rb, - uint8_t reg_bundle_size_L, - uint8_t coreset_interleaver_size_R, - uint8_t n_shift, - uint8_t number_of_candidates, - uint16_t *CCE, - uint8_t *L) { + uint32_t *e_rx, + uint8_t coreset_time_dur, + uint8_t start_symbol, + uint32_t coreset_nbr_rb, + uint8_t reg_bundle_size_L, + uint8_t coreset_interleaver_size_R, + uint8_t n_shift, + uint8_t number_of_candidates, + uint16_t *CCE, + uint8_t *L) +{ /* * This function will do demapping and deinterleaving from llr containing demodulated symbols * Demapping will regroup in REG and bundles @@ -130,7 +131,7 @@ static void nr_pdcch_demapping_deinterleaving(uint32_t *llr, uint32_t coreset_C = 0; uint16_t index_z, index_llr; int coreset_interleaved = 0; - int N_regs = coreset_nbr_rb*coreset_time_dur; + int N_regs = coreset_nbr_rb * coreset_time_dur; if (reg_bundle_size_L != 0) { // interleaving will be done only if reg_bundle_size_L != 0 coreset_interleaved = 1; @@ -139,12 +140,11 @@ static void nr_pdcch_demapping_deinterleaving(uint32_t *llr, reg_bundle_size_L = 6; } - int B_rb = reg_bundle_size_L/coreset_time_dur; // nb of RBs occupied by each REG bundle - int num_bundles_per_cce = 6/reg_bundle_size_L; - int n_cce = N_regs/6; - int max_bundles = n_cce*num_bundles_per_cce; + int B_rb = reg_bundle_size_L / coreset_time_dur; // nb of RBs occupied by each REG bundle + int num_bundles_per_cce = 6 / reg_bundle_size_L; + int n_cce = N_regs / 6; + int max_bundles = n_cce * num_bundles_per_cce; int f_bundle_j_list[max_bundles]; - // for each bundle for (int nb = 0; nb < max_bundles; nb++) { if (coreset_interleaved == 0) @@ -163,11 +163,11 @@ static void nr_pdcch_demapping_deinterleaving(uint32_t *llr, // Get cce_list indices by bundle index in ascending order int f_bundle_j_list_ord[number_of_candidates][max_bundles]; for (int c_id = 0; c_id < number_of_candidates; c_id++ ) { - int start_bund_cand = CCE[c_id]*num_bundles_per_cce; - int max_bund_per_cand = L[c_id]*num_bundles_per_cce; + int start_bund_cand = CCE[c_id] * num_bundles_per_cce; + int max_bund_per_cand = L[c_id] * num_bundles_per_cce; int f_bundle_j_list_id = 0; for(int nb = 0; nb < max_bundles; nb++) { - for(int bund_cand = start_bund_cand; bund_cand < start_bund_cand+max_bund_per_cand; bund_cand++){ + for(int bund_cand = start_bund_cand; bund_cand < start_bund_cand + max_bund_per_cand; bund_cand++){ if (f_bundle_j_list[bund_cand] == nb) { f_bundle_j_list_ord[c_id][f_bundle_j_list_id] = nb; f_bundle_j_list_id++; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 97b5fd388b..530b52fd41 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -1551,8 +1551,9 @@ int64_t *get_prach_config_info(frequency_range_t freq_range, void find_aggregation_candidates(uint8_t *aggregation_level, uint8_t *nr_of_candidates, const NR_SearchSpace_t *ss, - int L) { - AssertFatal(L>=1 && L<=16,"L %d not ok\n",L); + int L) +{ + AssertFatal(L>=1 && L<=16,"L %d not ok\n", L); *nr_of_candidates = 0; switch(L) { case 1: diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 5aa4438af0..be1ba6a199 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -51,34 +51,34 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, - int slot, int rnti) { - + int slot, int rnti) +{ LOG_D(NR_MAC,"Filling search candidates for DCI\n"); uint8_t aggregation; - uint8_t number_of_candidates=0; - rel15->number_of_candidates=0; - int i=0; + uint8_t number_of_candidates = 0; + rel15->number_of_candidates = 0; uint32_t Y = 0; + int i = 0; if (slot >= 0) Y = get_Y(ss, slot, rnti); - for (int maxL=16;maxL>0;maxL>>=1) { + for (int maxL = 16; maxL > 0; maxL >>= 1) { find_aggregation_candidates(&aggregation, &number_of_candidates, ss,maxL); if (number_of_candidates>0) { - LOG_D(NR_MAC,"L %d, number of candidates %d, aggregation %d\n",maxL,number_of_candidates,aggregation); + LOG_D(NR_MAC,"L %d, number of candidates %d, aggregation %d\n", maxL, number_of_candidates, aggregation); rel15->number_of_candidates += number_of_candidates; int N_cce_sym = 0; // nb of rbs of coreset per symbol - for (int i=0;i<6;i++) { - for (int t=0;t<8;t++) { - N_cce_sym+=((rel15->coreset.frequency_domain_resource[i]>>t)&1); + for (int f = 0; f < 6; f++) { + for (int t = 0; t < 8; t++) { + N_cce_sym += ((rel15->coreset.frequency_domain_resource[f] >> t) & 1); } } - int N_cces = N_cce_sym*rel15->coreset.duration; - for (int j=0; jcoreset.duration; + for (int j = 0; j < number_of_candidates; i++, j++) { + int first_cce = aggregation * ((Y + ((j * N_cces) / (aggregation * number_of_candidates)) + 0) % (N_cces / aggregation)); LOG_D(NR_MAC,"Candidate %d of %d first_cce %d (L %d N_cces %d Y %d)\n", j, number_of_candidates, first_cce, aggregation, N_cces, Y); rel15->CCE[i] = first_cce; rel15->L[i] = aggregation; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index faaf868346..c973eeac2f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -417,31 +417,31 @@ int find_pdcch_candidate(const gNB_MAC_INST *mac, int nr_of_candidates, const NR_sched_pdcch_t *pdcch, const NR_ControlResourceSet_t *coreset, - uint32_t Y){ - + uint32_t Y) +{ const uint16_t *vrb_map = mac->common_channels[cc_id].vrb_map; const int N_ci = 0; const int N_rb = pdcch->n_rb; // nb of rbs of coreset per symbol const int N_symb = coreset->duration; // nb of coreset symbols - const int N_regs = N_rb*N_symb; // nb of REGs per coreset + const int N_regs = N_rb * N_symb; // nb of REGs per coreset const int N_cces = N_regs / NR_NB_REG_PER_CCE; // nb of cces in coreset const int R = pdcch->InterleaverSize; const int L = pdcch->RegBundleSize; - const int C = R>0 ? N_regs/(L*R) : 0; - const int B_rb = L/N_symb; // nb of RBs occupied by each REG bundle + const int C = R > 0 ? N_regs / (L * R) : 0; + const int B_rb = L / N_symb; // nb of RBs occupied by each REG bundle // loop over all the available candidates // this implements TS 38.211 Sec. 7.3.2.2 - for(int m=0; mShiftIndex, C, L, N_regs); - for(int rb=0; rbBWPStart + f*B_rb + rb]&SL_to_bitmap(pdcch->StartSymbolIndex,N_symb)) { + for(int rb = 0; rb < B_rb; rb++) { // loop over the RBs of the bundle + if(vrb_map[pdcch->BWPStart + f * B_rb + rb] & SL_to_bitmap(pdcch->StartSymbolIndex,N_symb)) { taken = true; break; }