From 5e7d52d279c8b78fe8880882d1caa5048d918b1d Mon Sep 17 00:00:00 2001 From: adk Date: Tue, 17 Mar 2020 19:48:16 +0100 Subject: [PATCH 01/26] fix indentation --- openair1/PHY/NR_REFSIG/ptrs_nr.c | 171 +++++++++++++------------------ 1 file changed, 72 insertions(+), 99 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 12f76b950f..1a79a7da33 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -38,18 +38,18 @@ /***********************************************************************/ - //#define max(a,b) (((a) > (b)) ? (a) : (b)) +//#define max(a,b) (((a) > (b)) ? (a) : (b)) // TS 38.211 Table 6.4.1.2.2.1-1: The parameter kRE_ref. // The first 4 colomns are DM-RS Configuration type 1 and the last 4 colomns are DM-RS Configuration type 2. int16_t table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref [6][8] = { -{ 0, 2, 6, 8, 0, 1, 6, 7}, -{ 2, 4, 8, 10, 1, 6, 7, 0}, -{ 1, 3, 7, 9, 2, 3, 8, 9}, -{ 3, 5, 9, 11, 3, 8, 9, 2}, -{-1, -1, -1, -1, 4, 5, 10, 11}, -{-1, -1, -1, -1, 5, 10, 11, 4}, + { 0, 2, 6, 8, 0, 1, 6, 7}, + { 2, 4, 8, 10, 1, 6, 7, 0}, + { 1, 3, 7, 9, 2, 3, 8, 9}, + { 3, 5, 9, 11, 3, 8, 9, 2}, + {-1, -1, -1, -1, 4, 5, 10, 11}, + {-1, -1, -1, -1, 5, 10, 11, 4}, }; @@ -68,19 +68,15 @@ int16_t table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref [6][8] = { *********************************************************************/ int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset) { - uint8_t colomn; int16_t k_RE_ref; - colomn = resourceElementOffset; if (pusch_dmrs_type == 2) colomn += 4; k_RE_ref = table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref[dmrs_antenna_port][colomn]; - AssertFatal(k_RE_ref>=0,"invalid k_RE_ref < 0. Check PTRS Configuration\n"); - return k_RE_ref; } @@ -98,24 +94,21 @@ int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t * *********************************************************************/ -uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB){ +uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB) { + uint16_t nrb0, nrb1; + nrb0 = ptrs_UplinkConfig->frequencyDensity.n_rb0; + nrb1 = ptrs_UplinkConfig->frequencyDensity.n_rb1; - uint16_t nrb0, nrb1; + if (nrb0 == 0 || nrb0 == 0) + return 2; - nrb0 = ptrs_UplinkConfig->frequencyDensity.n_rb0; - nrb1 = ptrs_UplinkConfig->frequencyDensity.n_rb1; - - if (nrb0 == 0 || nrb0 == 0) - return 2; - - if (N_RB < nrb0){ - LOG_I(PHY,"PUSH PT-RS is not present.\n"); - return 0; - } - else if (N_RB >= nrb0 && N_RB < nrb1) - return 2; - else - return 4; + if (N_RB < nrb0) { + LOG_I(PHY,"PUSH PT-RS is not present.\n"); + return 0; + } else if (N_RB >= nrb0 && N_RB < nrb1) + return 2; + else + return 4; } /******************************************************************* @@ -141,10 +134,8 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t L_ptrs, uint8_t pusch_maxLength, uint16_t ofdm_symbol_size) { - uint8_t i, last_symbol, is_dmrs_symbol1, is_dmrs_symbol2; int16_t l_ref; - *ptrs_symbols = 0; i = 0; is_dmrs_symbol1 = 0; @@ -153,7 +144,6 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, last_symbol = start_symbol + duration_in_symbols - 1; while ( (l_ref + i*L_ptrs) <= last_symbol) { - is_dmrs_symbol1 = is_dmrs_symbol(max((l_ref + (i-1)*L_ptrs + 1), l_ref), 0, 0, @@ -163,7 +153,6 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, duration_in_symbols, dmrs_type, ofdm_symbol_size); - is_dmrs_symbol2 = is_dmrs_symbol(l_ref + i*L_ptrs, 0, 0, @@ -175,16 +164,13 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, ofdm_symbol_size); if ( is_dmrs_symbol1 + is_dmrs_symbol2 > 0 ) { - if (pusch_maxLength == 2) l_ref = l_ref + i*L_ptrs + 1; else l_ref = l_ref + i*L_ptrs; - i = 1; - - continue; - + i = 1; + continue; } *ptrs_symbols = *ptrs_symbols | (1<<(l_ref + i*L_ptrs)); @@ -206,26 +192,23 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, *********************************************************************/ uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs) { + uint8_t mcs1, mcs2, mcs3; + mcs1 = ptrs_UplinkConfig->timeDensity.ptrs_mcs1; + mcs2 = ptrs_UplinkConfig->timeDensity.ptrs_mcs2; + mcs3 = ptrs_UplinkConfig->timeDensity.ptrs_mcs3; - uint8_t mcs1, mcs2, mcs3; + if (mcs1 == 0 || mcs2 == 0 || mcs3 == 0) + return 1; - mcs1 = ptrs_UplinkConfig->timeDensity.ptrs_mcs1; - mcs2 = ptrs_UplinkConfig->timeDensity.ptrs_mcs2; - mcs3 = ptrs_UplinkConfig->timeDensity.ptrs_mcs3; - - if (mcs1 == 0 || mcs2 == 0 || mcs3 == 0) - return 1; - - if (I_mcs < mcs1){ - LOG_I(PHY,"PUSH PT-RS is not present.\n"); - return 0; - } - else if (I_mcs >= mcs1 && I_mcs < mcs2) - return 4; - else if (I_mcs >= mcs2 && I_mcs < mcs3) - return 2; - else - return 1; + if (I_mcs < mcs1) { + LOG_I(PHY,"PUSH PT-RS is not present.\n"); + return 0; + } else if (I_mcs >= mcs1 && I_mcs < mcs2) + return 4; + else if (I_mcs >= mcs2 && I_mcs < mcs3) + return 2; + else + return 1; } /******************************************************************* @@ -247,30 +230,25 @@ uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs) { *********************************************************************/ uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size) { + uint16_t k_RB_ref, i, sc; + i = 0; + sc = 0; + k_RB_ref = 0; - uint16_t k_RB_ref, i, sc; + if (N_RB % K_ptrs == 0) + k_RB_ref = n_rnti % K_ptrs; + else + k_RB_ref = n_rnti % (N_RB % K_ptrs); - i = 0; - sc = 0; - k_RB_ref = 0; - - if (N_RB % K_ptrs == 0) - k_RB_ref = n_rnti % K_ptrs; - else - k_RB_ref = n_rnti % (N_RB % K_ptrs); - - while (k > sc){ - - sc = (start_sc + k_RE_ref + (i*K_ptrs + k_RB_ref)*NR_NB_SC_PER_RB)%ofdm_symbol_size; - i++; - - } - - if (k == sc) - return 1; - else - return 0; + while (k > sc) { + sc = (start_sc + k_RE_ref + (i*K_ptrs + k_RB_ref)*NR_NB_SC_PER_RB)%ofdm_symbol_size; + i++; + } + if (k == sc) + return 1; + else + return 0; } /******************************************************************* @@ -308,15 +286,11 @@ uint8_t is_ptrs_symbol(uint8_t l, uint16_t ofdm_symbol_size, pusch_dmrs_type_t pusch_dmrs_type, uint8_t resourceElementOffset) { - uint8_t is_ptrs_freq, is_ptrs_time; int16_t k_RE_ref; - is_ptrs_freq = 0; is_ptrs_time = 0; - k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); - is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size); if (is_ptrs_freq == 0) @@ -329,24 +303,23 @@ uint8_t is_ptrs_symbol(uint8_t l, return 1; else return 0; - } /* int main(int argc, char const *argv[]) { - dmrs_UplinkConfig_t dmrs_Uplink_Config; - ptrs_UplinkConfig_t ptrs_Uplink_Config; - uint8_t resourceElementOffset; - uint8_t dmrs_antenna_port; - uint8_t L_ptrs, K_ptrs; - int16_t k_RE_ref; - uint16_t N_RB, ptrs_symbols, ofdm_symbol_size, k; - uint8_t duration_in_symbols, I_mcs; - uint8_t start_symbol, l; - uint8_t ptrs_symbol_flag; - uint16_t n_rnti; + dmrs_UplinkConfig_t dmrs_Uplink_Config; + ptrs_UplinkConfig_t ptrs_Uplink_Config; + uint8_t resourceElementOffset; + uint8_t dmrs_antenna_port; + uint8_t L_ptrs, K_ptrs; + int16_t k_RE_ref; + uint16_t N_RB, ptrs_symbols, ofdm_symbol_size, k; + uint8_t duration_in_symbols, I_mcs; + uint8_t start_symbol, l; + uint8_t ptrs_symbol_flag; + uint16_t n_rnti; dmrs_Uplink_Config.pusch_dmrs_type = pusch_dmrs_type1; dmrs_Uplink_Config.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos1; @@ -362,13 +335,13 @@ int main(int argc, char const *argv[]) n_rnti = 0x1234; resourceElementOffset = 0; ptrs_symbols = 0; - dmrs_antenna_port = 0; - N_RB = 50; - duration_in_symbols = 14; - ofdm_symbol_size = 2048; - I_mcs = 9; - start_symbol = 0; - ptrs_symbol_flag = 0; + dmrs_antenna_port = 0; + N_RB = 50; + duration_in_symbols = 14; + ofdm_symbol_size = 2048; + I_mcs = 9; + start_symbol = 0; + ptrs_symbol_flag = 0; k_RE_ref = get_kRE_ref(dmrs_antenna_port, dmrs_Uplink_Config.pusch_dmrs_type, resourceElementOffset); @@ -418,6 +391,6 @@ int main(int argc, char const *argv[]) printf("\n"); - return 0; + return 0; } */ From 5f194af9067fddd046ddb6e0f1d19c497a17326d Mon Sep 17 00:00:00 2001 From: adk Date: Tue, 17 Mar 2020 19:58:15 +0100 Subject: [PATCH 02/26] optimization and fixing PUSCH PTRS generation --- openair1/PHY/NR_REFSIG/ptrs_nr.c | 32 ++++++++-------------- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 2 +- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 1a79a7da33..a488ff5a87 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -240,15 +240,13 @@ uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t else k_RB_ref = n_rnti % (N_RB % K_ptrs); - while (k > sc) { - sc = (start_sc + k_RE_ref + (i*K_ptrs + k_RB_ref)*NR_NB_SC_PER_RB)%ofdm_symbol_size; - i++; - } - - if (k == sc) - return 1; - else + if (k < (k_RE_ref + k_RB_ref*NR_NB_SC_PER_RB + start_sc)) return 0; + + if ((k-k_RE_ref - k_RB_ref*NR_NB_SC_PER_RB - start_sc)%(K_ptrs*NR_NB_SC_PER_RB) == 0) + return 1; + + return 0; } /******************************************************************* @@ -285,24 +283,18 @@ uint8_t is_ptrs_symbol(uint8_t l, uint16_t start_sc, uint16_t ofdm_symbol_size, pusch_dmrs_type_t pusch_dmrs_type, - uint8_t resourceElementOffset) { - uint8_t is_ptrs_freq, is_ptrs_time; - int16_t k_RE_ref; - is_ptrs_freq = 0; - is_ptrs_time = 0; - k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); - is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size); + uint8_t resourceElementOffset) +{ + int16_t k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); + uint8_t is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size); if (is_ptrs_freq == 0) return 0; if (((ptrs_symbols>>l)&1) == 1) - is_ptrs_time = 1; - - if (is_ptrs_time && is_ptrs_freq) return 1; - else - return 0; + + return 0; } /* diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index f1d4a304f9..76beb9f351 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -446,7 +446,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } else if (is_ptrs == 1) { if (k == start_sc){ - nr_modulation(pusch_dmrs[l][0], harq_process_ul_ue->nb_rb/2, DMRS_MOD_ORDER, mod_ptrs); + nr_modulation(pusch_dmrs[l][0], harq_process_ul_ue->nb_rb, DMRS_MOD_ORDER, mod_ptrs); } ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15; From 9a857e4486ccb045fce53add8d50b2ddacc33a48 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Wed, 1 Apr 2020 16:28:44 +0200 Subject: [PATCH 03/26] Adopting the dynamic implementation of DMRS at the gNB side - Using the implemented DMRS functionalities at the MAC layer at the gNB side - Removing is_dmrs_symbol function - Temporary implemetation at the UE side considering DMRS symbol is at the 1st PUSCH symbol, until the nFAPI structs for DMRS is adopted at the UE side --- openair1/PHY/NR_REFSIG/dmrs_nr.c | 156 ------------------ openair1/PHY/NR_REFSIG/dmrs_nr.h | 13 -- openair1/PHY/NR_REFSIG/ptrs_nr.c | 27 +-- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 51 +++--- openair1/SIMULATION/NR_PHY/ulsim.c | 17 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 85 ++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 25 ++- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 + 8 files changed, 142 insertions(+), 234 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.c b/openair1/PHY/NR_REFSIG/dmrs_nr.c index ed37a79d0f..8718fc8610 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.c +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.c @@ -35,143 +35,6 @@ /***********************************************************************/ -// TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. -// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. -// When l' = l0, it is represented by 1 -// E.g. when symbol duration is 12 in colomn 7, value 1057 ('10000100001') which means l' = l0, 5, 10. - -int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { // Duration in symbols -{-1, -1, -1, -1, 1, 1, 1, 1}, //<4 // (DMRS l' position) -{1, 1, 1, 1, 1, 1, 1, 1}, //4 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //5 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //6 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //7 // (DMRS l' position) -{1, 129, 129, 129, 1, 65, 73, 73}, //8 // (DMRS l' position) -{1, 129, 129, 129, 1, 65, 73, 73}, //9 // (DMRS l' position) -{1, 513, 577, 577, 1, 257, 273, 585}, //10 // (DMRS l' position) -{1, 513, 577, 577, 1, 257, 273, 585}, //11 // (DMRS l' position) -{1, 513, 577, 2337, 1, 1025, 1057, 585}, //12 // (DMRS l' position) -{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //13 // (DMRS l' position) -{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //14 // (DMRS l' position) -}; - - -// TS 38.211 Table 6.4.1.1.3-4: PUSCH DMRS positions l' within a slot for double-symbol DMRS and intra-slot frequency hopping disabled. -// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. -// When l' = l0, it is represented by 1 - -int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { // Duration in symbols -{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position) -{1, 1, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //5 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //6 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //7 // (DMRS l' position) -{1, 1, -1, -1, 1, 33, -1, -1}, //8 // (DMRS l' position) -{1, 1, -1, -1, 1, 33, -1, -1}, //9 // (DMRS l' position) -{1, 257, -1, -1, 1, 129, -1, -1}, //10 // (DMRS l' position) -{1, 257, -1, -1, 1, 129, -1, -1}, //11 // (DMRS l' position) -{1, 257, -1, -1, 1, 513, -1, -1}, //12 // (DMRS l' position) -{1, 1025, -1, -1, 1, 513, -1, -1}, //13 // (DMRS l' position) -{1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position) -}; - -int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength) { - - uint8_t row, colomn; - int32_t l_prime; - - colomn = additional_pos; - - if (mapping_type == typeB) - colomn += 4; - - if (duration_in_symbols < 4) - row = 0; - else - row = duration_in_symbols - 3; - - if (pusch_maxLength == pusch_len1) - l_prime = table_6_4_1_1_3_3_pusch_dmrs_positions_l[row][colomn]; - else - l_prime = table_6_4_1_1_3_4_pusch_dmrs_positions_l[row][colomn]; - - AssertFatal(l_prime>0,"invalid l_prime < 0\n"); - - return l_prime; -} - -/******************************************************************* -* -* NAME : is_dmrs_symbol -* -* PARAMETERS : l ofdm symbol index within slot -* k subcarrier index -* start_sc first subcarrier index -* k_prime index alternating 0 and 1 -* n index starting 0,1,... -* delta see Table 6.4.1.1.3 -* duration_in_symbols number of scheduled PUSCH ofdm symbols -* dmrs_UplinkConfig DMRS uplink configuration -* mapping_type PUSCH mapping type (A or B) -* ofdm_symbol_size IFFT size -* -* RETURN : 0 if symbol(k,l) is data, or 1 if symbol(k,l) is dmrs -* -* DESCRIPTION : 3GPP TS 38.211 6.4.1.1 Demodulation reference signal for PUSCH -* -*********************************************************************/ - -uint8_t is_dmrs_symbol(uint8_t l, - uint16_t k, - uint16_t start_sc, - uint8_t k_prime, - uint16_t n, - uint8_t delta, - uint8_t duration_in_symbols, - uint8_t dmrs_type, - uint16_t ofdm_symbol_size) { - - uint8_t is_dmrs_freq, is_dmrs_time, l0; - int32_t l_prime_mask; - pusch_dmrs_AdditionalPosition_t additional_pos = pusch_dmrs_pos0; - pusch_maxLength_t pusch_maxLength = pusch_len1; - uint8_t mapping_type = typeB; - - is_dmrs_freq = 0; - is_dmrs_time = 0; - - - l0 = get_l0_ul(mapping_type, 2); - l_prime_mask = get_l_prime(duration_in_symbols, mapping_type, additional_pos, pusch_maxLength); - - if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%ofdm_symbol_size)) - is_dmrs_freq = 1; - - - if (l_prime_mask == 1){ - - if (l == l0) - is_dmrs_time = 1; - - } else if ( (l==l0) || (((l_prime_mask>>l)&1) == 1 && l!=0) ) - is_dmrs_time = 1; - - if (pusch_maxLength == pusch_len2){ - - if (((l_prime_mask>>(l-1))&1) == 1 && l!=0 && l!=1) - is_dmrs_time = 1; - - if (l-1 == l0) - is_dmrs_time = 1; - - } - - if (is_dmrs_time && is_dmrs_freq) - return 1; - else - return 0; - -} /******************************************************************* * @@ -364,25 +227,6 @@ void lte_gold_new(LTE_DL_FRAME_PARMS *frame_parms, uint32_t lte_gold_table[20][2 #endif } -/******************************************************************* -* -* NAME : get_l0_ul -* -* PARAMETERS : mapping_type : PUSCH mapping type -* dmrs_typeA_position : higher layer parameter -* -* RETURN : demodulation reference signal for PUSCH -* -* DESCRIPTION : see TS 38.211 V15.4.0 Demodulation reference signals for PUSCH -* -*********************************************************************/ - -uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position) { - - return ((mapping_type==typeA)?dmrs_typeA_position:0); - -} - /******************************************************************* * * NAME : get_dmrs_freq_idx_ul diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.h b/openair1/PHY/NR_REFSIG/dmrs_nr.h index f1dfffff8b..6badf71745 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.h +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.h @@ -54,21 +54,8 @@ int pseudo_random_sequence(int M_PN, uint32_t *c, uint32_t cinit); void lte_gold_new(LTE_DL_FRAME_PARMS *frame_parms, uint32_t lte_gold_table[20][2][14], uint16_t Nid_cell); void generate_dmrs_pbch(uint32_t dmrs_pbch_bitmap[DMRS_PBCH_I_SSB][DMRS_PBCH_N_HF][DMRS_BITMAP_SIZE], uint16_t Nid_cell); -uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position); uint16_t get_dmrs_freq_idx_ul(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_t dmrs_type); -int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength); - -uint8_t is_dmrs_symbol(uint8_t l, - uint16_t k, - uint16_t start_sc, - uint8_t k_prime, - uint16_t n, - uint8_t delta, - uint8_t duration_in_symbols, - uint8_t dmrs_type, - uint16_t ofdm_symbol_size); - #undef EXTERN #endif /* DMRS_NR_H */ diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index a488ff5a87..fbd0f1e62e 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -144,24 +144,15 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, last_symbol = start_symbol + duration_in_symbols - 1; while ( (l_ref + i*L_ptrs) <= last_symbol) { - is_dmrs_symbol1 = is_dmrs_symbol(max((l_ref + (i-1)*L_ptrs + 1), l_ref), - 0, - 0, - 0, - 0, - 0, - duration_in_symbols, - dmrs_type, - ofdm_symbol_size); - is_dmrs_symbol2 = is_dmrs_symbol(l_ref + i*L_ptrs, - 0, - 0, - 0, - 0, - 0, - duration_in_symbols, - dmrs_type, - ofdm_symbol_size); + + // [hna] Temporary implementation until nFAPI structs are adopted at UE side + // -------------------------- + if(max((l_ref + (i-1)*L_ptrs + 1), l_ref) == start_symbol) + is_dmrs_symbol1 = 1; + + if(l_ref + i*L_ptrs == start_symbol) + is_dmrs_symbol2 = 0; + // -------------------------- if ( is_dmrs_symbol1 + is_dmrs_symbol2 > 0 ) { if (pusch_maxLength == 2) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 76beb9f351..d9cab95ca9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -136,16 +136,15 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, start_symbol = harq_process_ul_ue->start_symbol; - for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) - number_dmrs_symbols += is_dmrs_symbol((mapping_type)?i-start_symbol:i, - 0, - 0, - 0, - 0, - 0, - harq_process_ul_ue->number_of_symbols, - UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, - frame_parms->ofdm_symbol_size); + for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) { + + // [hna] Temporary implementation until nFAPI structs are adopted at UE side + // -------------------------- + if((mapping_type ? (i - start_symbol) : i) == start_symbol) + number_dmrs_symbols += 1; + // -------------------------- + + } ulsch_ue->length_dmrs = number_dmrs_symbols; // pusch.MaxLenght is redundant here as number_dmrs_symbols // contains all dmrs symbols even for double symbol dmrs @@ -329,15 +328,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, for (l = start_symbol; l < start_symbol + harq_process_ul_ue->number_of_symbols; l++) { - is_dmrs = is_dmrs_symbol((mapping_type)?l-start_symbol:l, - 0, - 0, - 0, - 0, - 0, - harq_process_ul_ue->number_of_symbols, - dmrs_type, - frame_parms->ofdm_symbol_size); + // [hna] Temporary implementation until nFAPI structs are adopted at UE side + // -------------------------- + if(((mapping_type)?l-start_symbol:l) == start_symbol) + is_dmrs = 1; + else + is_dmrs = 0; + // -------------------------- if (is_dmrs == 1) nb_re_dmrs_per_rb = ulsch_ue->nb_re_dmrs; @@ -397,15 +394,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, is_dmrs = 0; is_ptrs = 0; - is_dmrs = is_dmrs_symbol(l_ref, - k, - start_sc, - k_prime, - n, - delta, - harq_process_ul_ue->number_of_symbols, - dmrs_type, - frame_parms->ofdm_symbol_size); + // [hna] Temporary implementation until nFAPI structs are adopted at UE side + // -------------------------- + if(l_ref == start_symbol) { + if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size)) + is_dmrs = 1; + } + // -------------------------- if (UE->ptrs_configured == 1){ is_ptrs = is_ptrs_symbol(l, diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 2adc67501a..3120f1d144 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -503,16 +503,11 @@ int main(int argc, char **argv) unsigned char mod_order; uint16_t code_rate; - for (i = start_symbol; i < nb_symb_sch; i++) - number_dmrs_symbols += is_dmrs_symbol(i, - 0, - 0, - 0, - 0, - 0, - nb_symb_sch, - UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, - frame_parms->ofdm_symbol_size); + uint16_t l_prime_mask = get_l_prime(nb_symb_sch, UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, pusch_dmrs_pos0, length_dmrs); + + for (i = 0; i < nb_symb_sch; i++) { + number_dmrs_symbols += (l_prime_mask >> i) & 0x01; + } mod_order = nr_get_Qm_ul(Imcs, 0); nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1) ? 6 : 4) * number_dmrs_symbols; @@ -560,7 +555,7 @@ int main(int argc, char **argv) pusch_pdu->transform_precoding = 0; pusch_pdu->data_scrambling_id = 0; pusch_pdu->nrOfLayers = 1; - pusch_pdu->ul_dmrs_symb_pos = 1; + pusch_pdu->ul_dmrs_symb_pos = l_prime_mask; pusch_pdu->dmrs_config_type = 0; pusch_pdu->ul_dmrs_scrambling_id = 0; pusch_pdu->scid = 0; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index ae23164194..26a08e9afb 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -79,6 +79,47 @@ nr_bandentry_t nr_bandtable[] = { {261,27500000,28350000,27500000,28350000, 2,2070833, 120} }; + +// TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. +// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. +// When l' = l0, it is represented by 1 +// E.g. when symbol duration is 12 in colomn 7, value 1057 ('10000100001') which means l' = l0, 5, 10. + +int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { // Duration in symbols +{-1, -1, -1, -1, 1, 1, 1, 1}, //<4 // (DMRS l' position) +{1, 1, 1, 1, 1, 1, 1, 1}, //4 // (DMRS l' position) +{1, 1, 1, 1, 1, 5, 5, 5}, //5 // (DMRS l' position) +{1, 1, 1, 1, 1, 5, 5, 5}, //6 // (DMRS l' position) +{1, 1, 1, 1, 1, 5, 5, 5}, //7 // (DMRS l' position) +{1, 129, 129, 129, 1, 65, 73, 73}, //8 // (DMRS l' position) +{1, 129, 129, 129, 1, 65, 73, 73}, //9 // (DMRS l' position) +{1, 513, 577, 577, 1, 257, 273, 585}, //10 // (DMRS l' position) +{1, 513, 577, 577, 1, 257, 273, 585}, //11 // (DMRS l' position) +{1, 513, 577, 2337, 1, 1025, 1057, 585}, //12 // (DMRS l' position) +{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //13 // (DMRS l' position) +{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //14 // (DMRS l' position) +}; + + +// TS 38.211 Table 6.4.1.1.3-4: PUSCH DMRS positions l' within a slot for double-symbol DMRS and intra-slot frequency hopping disabled. +// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. +// When l' = l0, it is represented by 1 + +int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { // Duration in symbols +{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position) +{1, 1, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position) +{1, 1, -1, -1, 1, 1, -1, -1}, //5 // (DMRS l' position) +{1, 1, -1, -1, 1, 1, -1, -1}, //6 // (DMRS l' position) +{1, 1, -1, -1, 1, 1, -1, -1}, //7 // (DMRS l' position) +{1, 1, -1, -1, 1, 33, -1, -1}, //8 // (DMRS l' position) +{1, 1, -1, -1, 1, 33, -1, -1}, //9 // (DMRS l' position) +{1, 257, -1, -1, 1, 129, -1, -1}, //10 // (DMRS l' position) +{1, 257, -1, -1, 1, 129, -1, -1}, //11 // (DMRS l' position) +{1, 257, -1, -1, 1, 513, -1, -1}, //12 // (DMRS l' position) +{1, 1025, -1, -1, 1, 513, -1, -1}, //13 // (DMRS l' position) +{1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position) +}; + #define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t)) void get_band(uint64_t downlink_frequency, @@ -517,6 +558,50 @@ int get_num_dmrs(uint16_t dmrs_mask ) { return(num_dmrs); } +/******************************************************************* +* +* NAME : get_l0_ul +* +* PARAMETERS : mapping_type : PUSCH mapping type +* dmrs_typeA_position : higher layer parameter +* +* RETURN : demodulation reference signal for PUSCH +* +* DESCRIPTION : see TS 38.211 V15.4.0 Demodulation reference signals for PUSCH +* +*********************************************************************/ + +uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position) { + + return ((mapping_type==typeA)?dmrs_typeA_position:0); + +} + +int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength) { + + uint8_t row, colomn; + int32_t l_prime; + + colomn = additional_pos; + + if (mapping_type == typeB) + colomn += 4; + + if (duration_in_symbols < 4) + row = 0; + else + row = duration_in_symbols - 3; + + if (pusch_maxLength == pusch_len1) + l_prime = table_6_4_1_1_3_3_pusch_dmrs_positions_l[row][colomn]; + else + l_prime = table_6_4_1_1_3_4_pusch_dmrs_positions_l[row][colomn]; + + AssertFatal(l_prime>0,"invalid l_prime < 0\n"); + + return l_prime; +} + uint16_t nr_dci_size(nr_dci_format_t format, nr_rnti_type_t rnti_type, uint16_t N_RB) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 1e0fd8d9a2..196bd3805b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -758,14 +758,6 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, pusch_pdu->transform_precoding = 0; pusch_pdu->data_scrambling_id = 0; //It equals the higher-layer parameter Data-scrambling-Identity if configured and the RNTI equals the C-RNTI, otherwise L2 needs to set it to physical cell id.; pusch_pdu->nrOfLayers = 1; - //DMRS - pusch_pdu->ul_dmrs_symb_pos = 1<<2; //for now the gnb assumes dmrs in the first symbol of the scheduled pusch resource - pusch_pdu->dmrs_config_type = 0; //dmrs-type 1 (the one with a single DMRS symbol in the beginning) - pusch_pdu->ul_dmrs_scrambling_id = 0; //If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id. - pusch_pdu->scid = 0; //DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]. Should match what is sent in DCI 0_1, otherwise set to 0. - //pusch_pdu->num_dmrs_cdm_grps_no_data; - //pusch_pdu->dmrs_ports; //DMRS ports. [TS38.212 7.3.1.1.2] provides description between DCI 0-1 content and DMRS ports. Bitmap occupying the 11 LSBs with: bit 0: antenna port 1000 bit 11: antenna port 1011 and for each bit 0: DMRS port not used 1: DMRS port used - //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] pusch_pdu->resource_alloc = 1; //type 1 //pusch_pdu->rb_bitmap;// for ressource alloc type 0 pusch_pdu->rb_start = 0; @@ -777,6 +769,23 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, //Resource Allocation in time domain pusch_pdu->start_symbol_index = 2; pusch_pdu->nr_of_symbols = 12; + + // -------------------- + // ------- DMRS ------- + // -------------------- + uint16_t l_prime_mask = get_l_prime(pusch_pdu->nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); + pusch_pdu->ul_dmrs_symb_pos = l_prime_mask; + pusch_pdu->dmrs_config_type = 0; // dmrs-type 1 (the one with a single DMRS symbol in the beginning) + pusch_pdu->ul_dmrs_scrambling_id = 0; // If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id + pusch_pdu->scid = 0; // DMRS sequence initialization [TS38.211, sec 6.4.1.1.1] + // Should match what is sent in DCI 0_1, otherwise set to 0 + //pusch_pdu->num_dmrs_cdm_grps_no_data; + //pusch_pdu->dmrs_ports; // DMRS ports. [TS38.212 7.3.1.1.2] provides description between DCI 0-1 content and DMRS ports + // Bitmap occupying the 11 LSBs with: bit 0: antenna port 1000 bit 11: antenna port 1011, + // and for each bit 0: DMRS port not used 1: DMRS port used + // -------------------------------------------------------------------------------------------------------------------------------------------- + + //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] //Optional Data only included if indicated in pduBitmap pusch_pdu->pusch_data.rv_index = 0; pusch_pdu->pusch_data.harq_process_id = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index d55a188817..6179335277 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -162,6 +162,8 @@ int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP); int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP); int get_num_dmrs(uint16_t dmrs_mask ); +uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position); +int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength); uint16_t nr_dci_size(nr_dci_format_t format, nr_rnti_type_t rnti_type, From 1104cf0414ae1a27dafe2685971cb52d9db25b47 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Mon, 6 Apr 2020 08:51:35 +0200 Subject: [PATCH 04/26] Removing DMRS parameters from "nr_ulsch_encoding" --- .../PHY/NR_TRANSPORT/nr_transport_proto_common.h | 4 ---- .../PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h | 3 ++- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c | 15 ++++----------- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 8 ++++---- openair1/SIMULATION/NR_PHY/ulschsim.c | 3 ++- 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h index dd37455e26..f1fd319ba4 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h @@ -1051,10 +1051,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, uint8_t is_crnti, uint8_t llr8_flag); -int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, - NR_DL_FRAME_PARMS* frame_parms, - uint8_t harq_pid); - /*! \brief Perform PUSCH scrambling. TS 38.211 V15.4.0 subclause 6.3.1.1 @param[in] in Pointer to input bits @param[in] size of input bits 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 35fe8bc899..4aae9ef7b4 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1053,7 +1053,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, NR_DL_FRAME_PARMS* frame_parms, - uint8_t harq_pid); + uint8_t harq_pid, + unsigned int G); /*! \brief Perform PUSCH scrambling. TS 38.211 V15.4.0 subclause 6.3.1.1 @param[in] in, Pointer to input bits diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 55bac90520..b909bffd64 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -217,12 +217,13 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, NR_DL_FRAME_PARMS* frame_parms, - uint8_t harq_pid) + uint8_t harq_pid, + unsigned int G) { /////////////////////////parameters and variables declaration///////////////////////// /////////// - unsigned int G,crc; + unsigned int crc; NR_UL_UE_HARQ_t *harq_process; uint16_t nb_rb ; uint8_t nb_symb_sch ; @@ -235,8 +236,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, uint32_t E,Kb; uint8_t Ilbrm; uint32_t Tbslbrm; - uint8_t nb_re_dmrs; - uint16_t length_dmrs; uint16_t R; float Coderate; @@ -250,7 +249,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, crc = 1; harq_process = ulsch->harq_processes[harq_pid]; nb_rb = harq_process->nb_rb; - nb_symb_sch = harq_process->number_of_symbols; A = harq_process->TBS; pz = &Z; mod_order = nr_get_Qm_ul(harq_process->mcs,0); @@ -261,8 +259,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, F=0; Ilbrm = 0; Tbslbrm = 950984; //max tbs - nb_re_dmrs = ulsch->nb_re_dmrs; - length_dmrs = ulsch->length_dmrs; Coderate = 0.0; /////////// @@ -271,10 +267,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); - LOG_D(PHY,"ulsch coding nb_rb %d nb_symb_sch %d nb_re_dmrs %d, length_dmrs %d, harq_process->Nl = %d\n", nb_rb,nb_symb_sch, nb_re_dmrs,length_dmrs, harq_process->Nl); - - - G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,harq_process->Nl); + LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->Nl); LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order); // if (harq_process->Ndi == 1) { // this is a new packet diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index d9cab95ca9..3f35d244a1 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -152,7 +152,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ulsch_ue->Nid_cell = Nid_cell; ulsch_ue->nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4); - N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs*number_dmrs_symbols - N_PRB_oh; + N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs*ulsch_ue->length_dmrs - N_PRB_oh; harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*harq_process_ul_ue->nb_rb*num_of_codewords; @@ -217,8 +217,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////ULSCH coding///////////////////////// /////////// + unsigned int G = nr_get_G(harq_process_ul_ue->nb_rb, harq_process_ul_ue->number_of_symbols, + ulsch_ue->nb_re_dmrs, ulsch_ue->length_dmrs, mod_order, harq_process_ul_ue->Nl); - nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid); + nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G); /////////// //////////////////////////////////////////////////////////////////// @@ -226,8 +228,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////ULSCH scrambling///////////////////////// /////////// - mod_order = nr_get_Qm_ul(harq_process_ul_ue->mcs, 0); - available_bits = nr_get_G(harq_process_ul_ue->nb_rb, harq_process_ul_ue->number_of_symbols, ulsch_ue->nb_re_dmrs, diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 48ea26da8f..1e5e3eef64 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -461,9 +461,10 @@ int main(int argc, char **argv) /////////////////////////ULSCH coding///////////////////////// /////////// + unsigned int G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, Nl); if (input_fd == NULL) { - nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid); + nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G); } printf("\n"); From 76f937d8f2776c77e2a9db928038cabf4f1a8027 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Mon, 6 Apr 2020 09:12:33 +0200 Subject: [PATCH 05/26] Removing nb_re_dmrs and length_dmrs from NR_UE_ULSCH_t --- .../PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 4 ---- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 22 +++++++++---------- openair1/SIMULATION/NR_PHY/ulschsim.c | 3 --- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index fb560f229d..1d306102ff 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -161,10 +161,6 @@ typedef struct { } NR_UL_UE_HARQ_t; typedef struct { - /// number of DMRS resource elements - uint8_t nb_re_dmrs; - /// DMRS length - uint8_t length_dmrs; /// SRS active flag uint8_t srs_active; //#if defined(UPGRADE_RAT_NR) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 3f35d244a1..55b4fb73e2 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -107,7 +107,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint16_t start_sc, start_rb; int8_t Wf[2], Wt[2], l_prime[2], delta; uint16_t n_dmrs, code_rate, number_dmrs_symbols, k; - uint8_t dmrs_type; + uint8_t dmrs_type, nb_dmrs_re_per_rb; int ap, start_symbol, Nid_cell, i; int sample_offsetF, N_RE_prime, N_PRB_oh; uint16_t n_rnti; @@ -146,13 +146,11 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } - ulsch_ue->length_dmrs = number_dmrs_symbols; // pusch.MaxLenght is redundant here as number_dmrs_symbols - // contains all dmrs symbols even for double symbol dmrs ulsch_ue->rnti = n_rnti; ulsch_ue->Nid_cell = Nid_cell; - ulsch_ue->nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4); + nb_dmrs_re_per_rb = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4); - N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs*ulsch_ue->length_dmrs - N_PRB_oh; + N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*harq_process_ul_ue->nb_rb*num_of_codewords; @@ -163,7 +161,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, code_rate, harq_process_ul_ue->nb_rb, harq_process_ul_ue->number_of_symbols, - ulsch_ue->nb_re_dmrs*ulsch_ue->length_dmrs, + nb_dmrs_re_per_rb*number_dmrs_symbols, 0, harq_process_ul_ue->Nl); @@ -218,7 +216,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////// unsigned int G = nr_get_G(harq_process_ul_ue->nb_rb, harq_process_ul_ue->number_of_symbols, - ulsch_ue->nb_re_dmrs, ulsch_ue->length_dmrs, mod_order, harq_process_ul_ue->Nl); + nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, harq_process_ul_ue->Nl); nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G); @@ -230,8 +228,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, available_bits = nr_get_G(harq_process_ul_ue->nb_rb, harq_process_ul_ue->number_of_symbols, - ulsch_ue->nb_re_dmrs, - ulsch_ue->length_dmrs, + nb_dmrs_re_per_rb, + number_dmrs_symbols, mod_order, 1); @@ -268,7 +266,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////DMRS Modulation///////////////////////// /////////// pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; - n_dmrs = (harq_process_ul_ue->nb_rb*ulsch_ue->nb_re_dmrs*ulsch_ue->length_dmrs); + n_dmrs = (harq_process_ul_ue->nb_rb*nb_dmrs_re_per_rb*number_dmrs_symbols); int16_t mod_dmrs[n_dmrs<<1]; dmrs_type = UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type; /////////// @@ -296,7 +294,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, start_symbol, dmrs_type, L_ptrs, - ulsch_ue->length_dmrs, + number_dmrs_symbols, frame_parms->ofdm_symbol_size); } @@ -337,7 +335,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, // -------------------------- if (is_dmrs == 1) - nb_re_dmrs_per_rb = ulsch_ue->nb_re_dmrs; + nb_re_dmrs_per_rb = nb_dmrs_re_per_rb; else nb_re_dmrs_per_rb = 0; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 1e5e3eef64..d2e91a6811 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -402,7 +402,6 @@ int main(int argc, char **argv) rel15_ul->mcs_index = Imcs; rel15_ul->pusch_data.rv_index = rvidx; rel15_ul->nrOfLayers = Nl; - //rel15_ul->length_dmrs = length_dmrs; rel15_ul->target_code_rate = code_rate; rel15_ul->pusch_data.tb_size = TBS>>3; /////////////////////////////////////////////////// @@ -427,8 +426,6 @@ int main(int argc, char **argv) /////////////////////////[adk] preparing NR_UE_ULSCH_t parameters///////////////////////// A HOT FIX until creating nfapi_nr_ul_config_ulsch_pdu_rel15_t /////////// - ulsch_ue->nb_re_dmrs = nb_re_dmrs; - ulsch_ue->length_dmrs = length_dmrs; ulsch_ue->rnti = n_rnti; /////////// //////////////////////////////////////////////////////////////////////////////////////////// From d3cbf146940aa205c7f6e75b668b4e4daa7dfbdf Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Mon, 6 Apr 2020 10:37:17 +0200 Subject: [PATCH 06/26] Using ul_dmrs_symb_pos at UE side instead of assuming that DMRS is only present at 1st symbol of PUSCH --- executables/nr-ue.c | 4 +++- .../nfapi/public_inc/fapi_nr_ue_interface.h | 2 ++ openair1/PHY/NR_REFSIG/ptrs_nr.c | 8 +++----- openair1/PHY/NR_REFSIG/ptrs_nr.h | 1 + .../PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 1 + .../PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 1 + openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 19 ++++++------------- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 1 + openair1/SIMULATION/NR_PHY/ulsim.c | 1 + 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 131710ee02..d25bf785f8 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -359,7 +359,7 @@ static void UE_synch(void *arg) { void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { uint32_t nb_rb, start_rb; uint8_t nb_symb_sch, start_symbol, mcs, precod_nbr_layers, harq_pid, rvidx; - uint16_t n_rnti; + uint16_t n_rnti, l_prime_mask; nr_dcireq_t dcireq; nr_scheduled_response_t scheduled_response; @@ -390,6 +390,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { mcs = 9; harq_pid = 0; rvidx = 0; + l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, pusch_len1); //------------------------------------------------------------------------------// scheduled_response.ul_config->slot = 8; @@ -400,6 +401,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_rb = start_rb; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_symbols = nb_symb_sch; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = start_symbol; + scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ul_dmrs_symb_pos = l_prime_mask; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs = mcs; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = rvidx; diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 576144e1df..9b9fb7acfb 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -276,6 +276,8 @@ typedef struct { int8_t absolute_delta_PUSCH; uint8_t n_layers; uint8_t tpmi; + //DMRS + uint16_t ul_dmrs_symb_pos; uint8_t n_dmrs_cdm_groups; uint8_t dmrs_ports[4]; uint8_t n_front_load_symb; diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index fbd0f1e62e..7ade1654d5 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -133,6 +133,7 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t dmrs_type, uint8_t L_ptrs, uint8_t pusch_maxLength, + uint16_t ul_dmrs_symb_pos, uint16_t ofdm_symbol_size) { uint8_t i, last_symbol, is_dmrs_symbol1, is_dmrs_symbol2; int16_t l_ref; @@ -145,14 +146,11 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, while ( (l_ref + i*L_ptrs) <= last_symbol) { - // [hna] Temporary implementation until nFAPI structs are adopted at UE side - // -------------------------- - if(max((l_ref + (i-1)*L_ptrs + 1), l_ref) == start_symbol) + if((ul_dmrs_symb_pos >> max((l_ref + (i-1)*L_ptrs + 1), l_ref)) & 0x01) is_dmrs_symbol1 = 1; - if(l_ref + i*L_ptrs == start_symbol) + if((ul_dmrs_symb_pos >> (l_ref + i*L_ptrs)) & 0x01) is_dmrs_symbol2 = 0; - // -------------------------- if ( is_dmrs_symbol1 + is_dmrs_symbol2 > 0 ) { if (pusch_maxLength == 2) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h index 291ff4a555..017fadf8e4 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.h +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h @@ -57,6 +57,7 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t dmrs_type, uint8_t L_ptrs, uint8_t pusch_maxLength, + uint16_t ul_dmrs_symb_pos, uint16_t ofdm_symbol_size); uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index bce8ddcc29..b87df84530 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -1055,6 +1055,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, rel15_ul->dmrs_config_type, L_ptrs, 1, // only dmrs of length 1 is currently supported + rel15_ul->ul_dmrs_symb_pos, frame_parms->ofdm_symbol_size); } } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index 1d306102ff..d84ca00166 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -156,6 +156,7 @@ typedef struct { uint8_t number_of_symbols; // This is "S" in TS 38.214 V15.4.0 subclause 6.1.2.1 uint8_t start_symbol; + uint16_t ul_dmrs_symb_pos; // decode phich uint8_t decode_phich; } NR_UL_UE_HARQ_t; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 55b4fb73e2..6daa4cdf67 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -110,7 +110,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t dmrs_type, nb_dmrs_re_per_rb; int ap, start_symbol, Nid_cell, i; int sample_offsetF, N_RE_prime, N_PRB_oh; - uint16_t n_rnti; + uint16_t n_rnti, ul_dmrs_symb_pos; uint8_t data_existing =0; uint8_t L_ptrs, K_ptrs; // PTRS parameters uint16_t beta_ptrs; // PTRS parameter related to power control @@ -135,14 +135,12 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; start_symbol = harq_process_ul_ue->start_symbol; + ul_dmrs_symb_pos = harq_process_ul_ue->ul_dmrs_symb_pos; for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) { - // [hna] Temporary implementation until nFAPI structs are adopted at UE side - // -------------------------- - if((mapping_type ? (i - start_symbol) : i) == start_symbol) + if((ul_dmrs_symb_pos >> (mapping_type ? (i - start_symbol) : i)) & 0x01) number_dmrs_symbols += 1; - // -------------------------- } @@ -295,6 +293,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, dmrs_type, L_ptrs, number_dmrs_symbols, + ul_dmrs_symb_pos, frame_parms->ofdm_symbol_size); } @@ -326,13 +325,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, for (l = start_symbol; l < start_symbol + harq_process_ul_ue->number_of_symbols; l++) { - // [hna] Temporary implementation until nFAPI structs are adopted at UE side - // -------------------------- - if(((mapping_type)?l-start_symbol:l) == start_symbol) + if((ul_dmrs_symb_pos >> ((mapping_type)?l-start_symbol:l)) & 0x01) is_dmrs = 1; else is_dmrs = 0; - // -------------------------- if (is_dmrs == 1) nb_re_dmrs_per_rb = nb_dmrs_re_per_rb; @@ -392,13 +388,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, is_dmrs = 0; is_ptrs = 0; - // [hna] Temporary implementation until nFAPI structs are adopted at UE side - // -------------------------- - if(l_ref == start_symbol) { + if((ul_dmrs_symb_pos >> l_ref) & 0x01) { if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size)) is_dmrs = 1; } - // -------------------------- if (UE->ptrs_configured == 1){ is_ptrs = is_ptrs_symbol(l, diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 69876159d6..9a07f9ffea 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -122,6 +122,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response) ulsch0->harq_processes[current_harq_pid]->first_rb = pusch_config_pdu->start_rb; ulsch0->harq_processes[current_harq_pid]->number_of_symbols = pusch_config_pdu->number_symbols; ulsch0->harq_processes[current_harq_pid]->start_symbol = pusch_config_pdu->start_symbol; + ulsch0->harq_processes[current_harq_pid]->ul_dmrs_symb_pos = pusch_config_pdu->ul_dmrs_symb_pos; ulsch0->harq_processes[current_harq_pid]->mcs = pusch_config_pdu->mcs; ulsch0->harq_processes[current_harq_pid]->DCINdi = pusch_config_pdu->ndi; ulsch0->harq_processes[current_harq_pid]->rvidx = pusch_config_pdu->rv; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 3120f1d144..a748aada4f 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -592,6 +592,7 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_rb = start_rb; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_symbols = nb_symb_sch; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = start_symbol; + ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ul_dmrs_symb_pos = l_prime_mask; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs = Imcs; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = 0; From b9148d636f64fd0c12d4158af504f797912389ba Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Tue, 7 Apr 2020 15:02:04 +0200 Subject: [PATCH 07/26] Migrating members from NR_UL_UE_HARQ_t to the new added NFAPI structs --- executables/nr-ue.c | 2 + .../nfapi/public_inc/fapi_nr_ue_interface.h | 127 +++++++++++++++++- .../PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 27 +--- .../PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c | 18 +-- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 97 ++++++------- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 24 ++-- openair1/SCHED_NR_UE/harq_nr.c | 8 +- openair1/SIMULATION/NR_PHY/ulschsim.c | 14 +- openair1/SIMULATION/NR_PHY/ulsim.c | 2 + 9 files changed, 218 insertions(+), 101 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index d25bf785f8..db039d5eb6 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -388,6 +388,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { start_symbol = 2; precod_nbr_layers = 1; mcs = 9; + mcs_table = 0; harq_pid = 0; rvidx = 0; l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, pusch_len1); @@ -403,6 +404,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = start_symbol; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ul_dmrs_symb_pos = l_prime_mask; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs = mcs; + scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs_table = mcs_table; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = rvidx; scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = precod_nbr_layers; diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 9b9fb7acfb..274611703d 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -22,6 +22,8 @@ #include "fapi_nr_ue_constants.h" #include "PHY/impl_defs_nr.h" +#define NFAPI_UE_MAX_NUM_CB 8 + /* typedef unsigned int uint32_t; typedef unsigned short uint16_t; @@ -260,7 +262,127 @@ typedef struct { typedef struct{ uint8_t aperiodicSRS_ResourceTrigger; } fapi_nr_ul_srs_config_t; - typedef struct { + +typedef struct +{ + uint8_t rv_index; + uint8_t harq_process_id; + uint8_t new_data_indicator; + uint32_t tb_size; + uint16_t num_cb; + uint8_t cb_present_and_position[(NFAPI_UE_MAX_NUM_CB+7) / 8]; + +} nfapi_nr_ue_pusch_data_t; + +typedef struct +{ + uint16_t harq_ack_bit_length; + uint16_t csi_part1_bit_length; + uint16_t csi_part2_bit_length; + uint8_t alpha_scaling; + uint8_t beta_offset_harq_ack; + uint8_t beta_offset_csi1; + uint8_t beta_offset_csi2; + +} nfapi_nr_ue_pusch_uci_t; + +typedef struct +{ + uint16_t ptrs_port_index;//PT-RS antenna ports [TS38.214, sec6.2.3.1 and 38.212, section 7.3.1.1.2] Bitmap occupying the 12 LSBs with: bit 0: antenna port 0 bit 11: antenna port 11 and for each bit 0: PTRS port not used 1: PTRS port used + uint8_t ptrs_dmrs_port;//DMRS port corresponding to PTRS. + uint8_t ptrs_re_offset;//PT-RS resource element offset value taken from 0~11 +} nfapi_nr_ue_ptrs_ports_t; + +typedef struct +{ + uint8_t num_ptrs_ports; + nfapi_nr_ue_ptrs_ports_t* ptrs_ports_list; + uint8_t ptrs_time_density; + uint8_t ptrs_freq_density; + uint8_t ul_ptrs_power; + +}nfapi_nr_ue_pusch_ptrs_t; + +typedef struct +{ + uint8_t low_papr_group_number;//Group number for Low PAPR sequence generation. + uint16_t low_papr_sequence_number;//[TS38.211, sec 5.2.2] For DFT-S-OFDM. + uint8_t ul_ptrs_sample_density;//Number of PTRS groups [But I suppose this sentence is misplaced, so as the next one. --Chenyu] + uint8_t ul_ptrs_time_density_transform_precoding;//Number of samples per PTRS group + +} nfapi_nr_ue_dfts_ofdm_t; + +typedef struct +{ + uint16_t beam_idx;//Index of the digital beam weight vector pre-stored at cell configuration. The vector maps this input port to output TXRUs. Value: 0->65535 + +}nfapi_nr_ue_dig_bf_interface_t; + +typedef struct +{ + nfapi_nr_ue_dig_bf_interface_t* dig_bf_interface_list; + +} nfapi_nr_ue_ul_beamforming_number_of_prgs_t; + +typedef struct +{ + uint16_t num_prgs; + uint16_t prg_size; + //watchout: dig_bf_interface here, in table 3-43 it's dig_bf_interfaces + uint8_t dig_bf_interface; + nfapi_nr_ue_ul_beamforming_number_of_prgs_t* prgs_list;// + +} nfapi_nr_ue_ul_beamforming_t; + +typedef struct +{ + uint16_t pdu_bit_map;//Bitmap indicating presence of optional PDUs (see above) + uint16_t rnti; + uint32_t handle;//An opaque handling returned in the RxData.indication and/or UCI.indication message + //BWP + uint16_t bwp_size; + uint16_t bwp_start; + uint8_t subcarrier_spacing; + uint8_t cyclic_prefix; + //pusch information always include + uint16_t target_code_rate; + uint8_t qam_mod_order; + uint8_t mcs_index; + uint8_t mcs_table; + uint8_t transform_precoding; + uint16_t data_scrambling_id; + uint8_t nrOfLayers; + //DMRS + uint16_t ul_dmrs_symb_pos; + uint8_t dmrs_config_type; + uint16_t ul_dmrs_scrambling_id; + uint8_t scid; + uint8_t num_dmrs_cdm_grps_no_data; + uint16_t dmrs_ports;//DMRS ports. [TS38.212 7.3.1.1.2] provides description between DCI 0-1 content and DMRS ports. Bitmap occupying the 11 LSBs with: bit 0: antenna port 1000 bit 11: antenna port 1011 and for each bit 0: DMRS port not used 1: DMRS port used + //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] + uint8_t resource_alloc; + uint8_t rb_bitmap[36];// + uint16_t rb_start; + uint16_t rb_size; + uint8_t vrb_to_prb_mapping; + uint8_t frequency_hopping; + uint16_t tx_direct_current_location;//The uplink Tx Direct Current location for the carrier. Only values in the value range of this field between 0 and 3299, which indicate the subcarrier index within the carrier corresponding 1o the numerology of the corresponding uplink BWP and value 3300, which indicates "Outside the carrier" and value 3301, which indicates "Undetermined position within the carrier" are used. [TS38.331, UplinkTxDirectCurrentBWP IE] + uint8_t uplink_frequency_shift_7p5khz; + //Resource Allocation in time domain + uint8_t start_symbol_index; + uint8_t nr_of_symbols; + //Optional Data only included if indicated in pduBitmap + nfapi_nr_ue_pusch_data_t pusch_data; + nfapi_nr_ue_pusch_uci_t pusch_uci; + nfapi_nr_ue_pusch_ptrs_t pusch_ptrs; + nfapi_nr_ue_dfts_ofdm_t dfts_ofdm; + //beamforming + nfapi_nr_ue_ul_beamforming_t beamforming; + +} nfapi_nr_ue_pusch_pdu_t; + +typedef struct { + uint32_t TBS; uint8_t bandwidth_part_ind; uint16_t number_rbs; uint16_t start_rb; @@ -269,6 +391,7 @@ typedef struct { uint16_t start_symbol; pusch_freq_hopping_t pusch_freq_hopping; uint8_t mcs; + uint8_t mcs_table; uint8_t ndi; uint8_t rv; uint8_t harq_process_nbr; @@ -286,7 +409,7 @@ typedef struct { uint8_t maxCodeBlockGroupsPerTransportBlock; uint8_t ptrs_dmrs_association_port; uint8_t beta_offset_ind; - } fapi_nr_ul_config_pusch_pdu_rel15_t; +} fapi_nr_ul_config_pusch_pdu_rel15_t; typedef struct { uint16_t rnti; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index d84ca00166..bb92508934 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -43,7 +43,7 @@ #endif #include "LAYER2/NR_MAC_gNB/mac_proto.h" - +#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h" //#include "../LTE_TRANSPORT/transport_common.h" // structures below implement 36-211 and 36-212 @@ -86,40 +86,26 @@ typedef struct { #endif typedef struct { + /// NDAPI struct for UE + nfapi_nr_ue_pusch_pdu_t pusch_pdu; /// Indicator of first transmission uint8_t first_tx; - /// Last Ndi received for this process on DCI (used for C-RNTI only) - uint8_t DCINdi; /// HARQ tx status harq_result_t tx_status; - /// Flag indicating that this ULSCH has a new packet (start of new round) - // uint8_t Ndi; /// Status Flag indicating for this ULSCH (idle,active,disabled) SCH_status_t status; /// Subframe scheduling indicator (i.e. Transmission opportunity indicator) uint8_t subframe_scheduling_flag; /// Subframe cba scheduling indicator (i.e. Transmission opportunity indicator) uint8_t subframe_cba_scheduling_flag; - /// First Allocated RB - uint16_t first_rb; - /// Current Number of RBs - uint16_t nb_rb; - /// number of layers - uint8_t Nl; /// Last TPC command uint8_t TPC; - /// Transport block size - uint32_t TBS; /// The payload + CRC size in bits, "B" from 36-212 uint32_t B; /// Length of ACK information (bits) uint8_t O_ACK; /// Index of current HARQ round for this ULSCH uint8_t round; - /// MCS format of this ULSCH - uint8_t mcs; - /// Redundancy-version of the current sub-frame - uint8_t rvidx; /// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8) unsigned char *a; /// Pointer to the payload + CRC @@ -152,11 +138,6 @@ typedef struct { uint32_t G; // Number of modulated symbols carrying data uint32_t num_of_mod_symbols; - // This is "L" in TS 38.214 V15.4.0 subclause 6.1.2.1 - uint8_t number_of_symbols; - // This is "S" in TS 38.214 V15.4.0 subclause 6.1.2.1 - uint8_t start_symbol; - uint16_t ul_dmrs_symb_pos; // decode phich uint8_t decode_phich; } NR_UL_UE_HARQ_t; @@ -223,8 +204,6 @@ typedef struct { uint8_t power_offset; // for cooperative communication uint8_t cooperation_flag; - /// RNTI attributed to this ULSCH - uint16_t rnti; /// RNTI type uint8_t rnti_type; /// Cell ID diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index b909bffd64..c673f57c4e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -248,11 +248,11 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, crc = 1; harq_process = ulsch->harq_processes[harq_pid]; - nb_rb = harq_process->nb_rb; - A = harq_process->TBS; + nb_rb = harq_process->pusch_pdu.rb_size; + A = harq_process->pusch_pdu.pusch_data.tb_size; pz = &Z; - mod_order = nr_get_Qm_ul(harq_process->mcs,0); - R = nr_get_code_rate_ul(harq_process->mcs, 0); + mod_order = nr_get_Qm_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); + R = nr_get_code_rate_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); Kr=0; r_offset=0; BG = 1; @@ -267,7 +267,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); - LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->Nl); + LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers); LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order); // if (harq_process->Ndi == 1) { // this is a new packet @@ -424,15 +424,15 @@ opp_enabled=0; //start_meas(rm_stats); #ifdef DEBUG_DLSCH_CODING - printf("rvidx in encoding = %d\n", harq_process->rvidx); + printf("rvidx in encoding = %d\n", harq_process->pusch_pdu.pusch_data.rv_index); #endif ///////////////////////// d---->| Rate matching bit selection |---->e ///////////////////////// /////////// - E = nr_get_E(G, harq_process->C, mod_order, harq_process->Nl, r); + E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r); - Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->Nl,harq_process->C); + Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers,harq_process->C); nr_rate_matching_ldpc(Ilbrm, Tbslbrm, @@ -443,7 +443,7 @@ opp_enabled=0; harq_process->C, F, Kr-F-2*(*pz), - harq_process->rvidx, + harq_process->pusch_pdu.pusch_data.rv_index, E); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 6daa4cdf67..319c3a2778 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -98,7 +98,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t thread_id, int gNB_id) { - uint32_t available_bits; + uint32_t available_bits, TBS; uint8_t mod_order, cwd_index, num_of_codewords, l; uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; uint32_t ***pusch_dmrs; @@ -106,8 +106,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int32_t **txdataF; uint16_t start_sc, start_rb; int8_t Wf[2], Wt[2], l_prime[2], delta; - uint16_t n_dmrs, code_rate, number_dmrs_symbols, k; - uint8_t dmrs_type, nb_dmrs_re_per_rb; + uint16_t rnti, n_dmrs, code_rate, number_dmrs_symbols, nb_rb, k; + uint8_t dmrs_type, nb_dmrs_re_per_rb, number_of_symbols, mcs, Nl; int ap, start_symbol, Nid_cell, i; int sample_offsetF, N_RE_prime, N_PRB_oh; uint16_t n_rnti, ul_dmrs_symb_pos; @@ -123,7 +123,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; num_of_codewords = 1; // tmp assumption - n_rnti = 0x1234; Nid_cell = 0; N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig number_dmrs_symbols = 0; @@ -134,35 +133,41 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index]; harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; - start_symbol = harq_process_ul_ue->start_symbol; - ul_dmrs_symb_pos = harq_process_ul_ue->ul_dmrs_symb_pos; + start_symbol = harq_process_ul_ue->pusch_pdu.start_symbol_index; + ul_dmrs_symb_pos = harq_process_ul_ue->pusch_pdu.ul_dmrs_symb_pos; + number_of_symbols = harq_process_ul_ue->pusch_pdu.nr_of_symbols; - for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) { + for (i = start_symbol; i < start_symbol + number_of_symbols; i++) { if((ul_dmrs_symb_pos >> (mapping_type ? (i - start_symbol) : i)) & 0x01) number_dmrs_symbols += 1; } - ulsch_ue->rnti = n_rnti; + rnti = harq_process_ul_ue->pusch_pdu.rnti; ulsch_ue->Nid_cell = Nid_cell; nb_dmrs_re_per_rb = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4); - N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; + N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; - harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*harq_process_ul_ue->nb_rb*num_of_codewords; + nb_rb = harq_process_ul_ue->pusch_pdu.rb_size; - mod_order = nr_get_Qm_ul(harq_process_ul_ue->mcs, 0); - code_rate = nr_get_code_rate_ul(harq_process_ul_ue->mcs, 0); + harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*num_of_codewords; - harq_process_ul_ue->TBS = nr_compute_tbs(mod_order, + mcs = harq_process_ul_ue->pusch_pdu.mcs_index; + Nl = harq_process_ul_ue->pusch_pdu.nrOfLayers; + mod_order = nr_get_Qm_ul(mcs, 0); + code_rate = nr_get_code_rate_ul(mcs, 0); + + harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = nr_compute_tbs(mod_order, code_rate, - harq_process_ul_ue->nb_rb, - harq_process_ul_ue->number_of_symbols, + nb_rb, + number_of_symbols, nb_dmrs_re_per_rb*number_dmrs_symbols, 0, - harq_process_ul_ue->Nl); + harq_process_ul_ue->pusch_pdu.nrOfLayers); + TBS = harq_process_ul_ue->pusch_pdu.pusch_data.tb_size; uint8_t access_mode = SCHEDULED_ACCESS; //-----------------------------------------------------// @@ -172,16 +177,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, data_existing = 0; if (IS_SOFTMODEM_NOS1){ - data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame, - slot, 0, ulsch_input_buffer, harq_process_ul_ue->TBS/8, &access_mode); + data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame, + slot, 0, ulsch_input_buffer, TBS/8, &access_mode); //IP traffic to be transmitted - if(data_existing){ - //harq_process_ul_ue->a = (unsigned char*)calloc(harq_process_ul_ue->TBS/8, sizeof(unsigned char)); - memcpy(harq_process_ul_ue->a, ulsch_input_buffer, harq_process_ul_ue->TBS/8); + if(data_existing){ + //harq_process_ul_ue->a = (unsigned char*)calloc(TBS/8, sizeof(unsigned char)); + memcpy(harq_process_ul_ue->a, ulsch_input_buffer, TBS/8); #ifdef DEBUG_MAC_PDU - LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", harq_process_ul_ue->TBS/8); - for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) { + LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", TBS/8); + for (i = 0; i < TBS / 8; i++) { printf("0x%02x",harq_process_ul_ue->a[i]); } printf("\n"); @@ -198,7 +203,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, for (i = 0; ia[i] = 0; - for (i = payload_offset; i < harq_process_ul_ue->TBS / 8; i++) { + for (i = payload_offset; i < TBS / 8; i++) { harq_process_ul_ue->a[i] = (unsigned char) rand(); //printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); } @@ -213,8 +218,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////ULSCH coding///////////////////////// /////////// - unsigned int G = nr_get_G(harq_process_ul_ue->nb_rb, harq_process_ul_ue->number_of_symbols, - nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, harq_process_ul_ue->Nl); + unsigned int G = nr_get_G(nb_rb, number_of_symbols, + nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G); @@ -224,8 +229,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////ULSCH scrambling///////////////////////// /////////// - available_bits = nr_get_G(harq_process_ul_ue->nb_rb, - harq_process_ul_ue->number_of_symbols, + available_bits = nr_get_G(nb_rb, + number_of_symbols, nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, @@ -236,7 +241,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, nr_pusch_codeword_scrambling(ulsch_ue->g, available_bits, ulsch_ue->Nid_cell, - ulsch_ue->rnti, + rnti, scrambled_output[cwd_index]); // assume one codeword for the moment @@ -264,7 +269,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////DMRS Modulation///////////////////////// /////////// pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; - n_dmrs = (harq_process_ul_ue->nb_rb*nb_dmrs_re_per_rb*number_dmrs_symbols); + n_dmrs = (nb_rb*nb_dmrs_re_per_rb*number_dmrs_symbols); int16_t mod_dmrs[n_dmrs<<1]; dmrs_type = UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type; /////////// @@ -274,21 +279,21 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////PTRS parameters' initialization///////////////////////// /////////// - int16_t mod_ptrs[(harq_process_ul_ue->nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation + int16_t mod_ptrs[(nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation K_ptrs = 0; // just to avoid a warning if (UE->ptrs_configured == 1) { - K_ptrs = get_K_ptrs(ptrs_Uplink_Config, harq_process_ul_ue->nb_rb); + K_ptrs = get_K_ptrs(ptrs_Uplink_Config, nb_rb); - L_ptrs = get_L_ptrs(ptrs_Uplink_Config, harq_process_ul_ue->mcs); + L_ptrs = get_L_ptrs(ptrs_Uplink_Config, mcs); beta_ptrs = 1; // temp value until power control is implemented ulsch_ue->ptrs_symbols = 0; set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols, - harq_process_ul_ue->number_of_symbols, + number_of_symbols, start_symbol, dmrs_type, L_ptrs, @@ -306,7 +311,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, tx_layers = (int16_t **)pusch_ue->txdataF_layers; nr_ue_layer_mapping(UE->ulsch[thread_id][gNB_id], - harq_process_ul_ue->Nl, + Nl, available_bits/mod_order, tx_layers); @@ -323,7 +328,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint32_t nb_re_pusch, nb_re_dmrs_per_rb; uint32_t y_offset = 0; - for (l = start_symbol; l < start_symbol + harq_process_ul_ue->number_of_symbols; l++) { + for (l = start_symbol; l < start_symbol + number_of_symbols; l++) { if((ul_dmrs_symb_pos >> ((mapping_type)?l-start_symbol:l)) & 0x01) is_dmrs = 1; @@ -335,7 +340,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, else nb_re_dmrs_per_rb = 0; - nb_re_pusch = harq_process_ul_ue->nb_rb * (NR_NB_SC_PER_RB - nb_re_dmrs_per_rb); + nb_re_pusch = nb_rb * (NR_NB_SC_PER_RB - nb_re_dmrs_per_rb); nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch); @@ -355,13 +360,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, txdataF = UE->common_vars.txdataF; - start_rb = harq_process_ul_ue->first_rb; + start_rb = harq_process_ul_ue->pusch_pdu.rb_start; start_sc = frame_parms->first_carrier_offset + start_rb*NR_NB_SC_PER_RB; if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; - for (ap=0; apNl; ap++) { + for (ap=0; ap< Nl; ap++) { // DMRS params for this ap get_Wt(Wt, ap, dmrs_type); @@ -374,14 +379,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t l_ref; uint16_t m=0, n=0, dmrs_idx=0, ptrs_idx = 0; - for (l=start_symbol; lnumber_of_symbols; l++) { + for (l=start_symbol; lnb_rb*NR_NB_SC_PER_RB; i++) { + for (i=0; i< nb_rb*NR_NB_SC_PER_RB; i++) { sample_offsetF = l*frame_parms->ofdm_symbol_size + k; @@ -396,9 +401,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (UE->ptrs_configured == 1){ is_ptrs = is_ptrs_symbol(l, k, - ulsch_ue->rnti, - harq_process_ul_ue->nb_rb, - harq_process_ul_ue->number_of_symbols, + rnti, + nb_rb, + number_of_symbols, ap, K_ptrs, ulsch_ue->ptrs_symbols, @@ -432,7 +437,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } else if (is_ptrs == 1) { if (k == start_sc){ - nr_modulation(pusch_dmrs[l][0], harq_process_ul_ue->nb_rb, DMRS_MOD_ORDER, mod_ptrs); + nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs); } ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15; @@ -480,7 +485,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, int32_t **txdata; int32_t **txdataF; int timing_advance; - uint8_t Nl = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]->Nl; // cw 0 + uint8_t Nl = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]->pusch_pdu.nrOfLayers; // cw 0 /////////////////////////IFFT/////////////////////// /////////// diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 9a07f9ffea..b867ea0606 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -118,15 +118,21 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response) // pusch config pdu fapi_nr_ul_config_pusch_pdu_rel15_t *pusch_config_pdu = &ul_config->ul_config_list[i].ulsch_config_pdu.ulsch_pdu_rel15; uint8_t current_harq_pid = pusch_config_pdu->harq_process_nbr; - ulsch0->harq_processes[current_harq_pid]->nb_rb = pusch_config_pdu->number_rbs; - ulsch0->harq_processes[current_harq_pid]->first_rb = pusch_config_pdu->start_rb; - ulsch0->harq_processes[current_harq_pid]->number_of_symbols = pusch_config_pdu->number_symbols; - ulsch0->harq_processes[current_harq_pid]->start_symbol = pusch_config_pdu->start_symbol; - ulsch0->harq_processes[current_harq_pid]->ul_dmrs_symb_pos = pusch_config_pdu->ul_dmrs_symb_pos; - ulsch0->harq_processes[current_harq_pid]->mcs = pusch_config_pdu->mcs; - ulsch0->harq_processes[current_harq_pid]->DCINdi = pusch_config_pdu->ndi; - ulsch0->harq_processes[current_harq_pid]->rvidx = pusch_config_pdu->rv; - ulsch0->harq_processes[current_harq_pid]->Nl = pusch_config_pdu->n_layers; + nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch0->harq_processes[current_harq_pid]->pusch_pdu; + + pusch_pdu->rnti = ul_config->ul_config_list[i].ulsch_config_pdu.rnti; + pusch_pdu->rb_size = pusch_config_pdu->number_rbs; + pusch_pdu->rb_start = pusch_config_pdu->start_rb; + pusch_pdu->nr_of_symbols = pusch_config_pdu->number_symbols; + pusch_pdu->start_symbol_index = pusch_config_pdu->start_symbol; + pusch_pdu->ul_dmrs_symb_pos = pusch_config_pdu->ul_dmrs_symb_pos; + pusch_pdu->mcs_index = pusch_config_pdu->mcs; + pusch_pdu->mcs_table = pusch_config_pdu->mcs_table; + pusch_pdu->nrOfLayers = pusch_config_pdu->n_layers; + pusch_pdu->pusch_data.new_data_indicator = pusch_config_pdu->ndi; + pusch_pdu->pusch_data.rv_index = pusch_config_pdu->rv; + pusch_pdu->pusch_data.tb_size = pusch_config_pdu->TBS; + ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH; } if(ul_config->ul_config_list[i].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUCCH){ diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index 31dcfcacbe..3c3017d658 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -296,7 +296,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u /* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */ if ((ulsch->harq_processes[harq_pid]->first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */ ulsch->harq_processes[harq_pid]->first_tx = 0; - ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* store first value of ndi */ + ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* store first value of ndi */ ulsch->harq_processes[harq_pid]->round = 0; ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; @@ -306,8 +306,8 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u } /* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */ /* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */ - else if ((ulsch->harq_processes[harq_pid]->DCINdi != ndi) && (rnti_type != _TC_RNTI_)) { /* is ndi toogled so this is a new grant ? */ - ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* store first value of ndi */ + else if ((ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator != ndi) && (rnti_type != _TC_RNTI_)) { /* is ndi toogled so this is a new grant ? */ + ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* store first value of ndi */ ulsch->harq_processes[harq_pid]->round = 0; ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; @@ -317,7 +317,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u } /* 38.321 5.4.2.1 2> else (i.e. retransmission): */ else { - ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* ndi has not toggled si this is a retransmission */ + ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* ndi has not toggled si this is a retransmission */ ulsch->harq_processes[harq_pid]->round++; /* increment number of retransmission */ result_harq = RETRANSMISSION_HARQ; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index d2e91a6811..b7f065a559 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -426,7 +426,7 @@ int main(int argc, char **argv) /////////////////////////[adk] preparing NR_UE_ULSCH_t parameters///////////////////////// A HOT FIX until creating nfapi_nr_ul_config_ulsch_pdu_rel15_t /////////// - ulsch_ue->rnti = n_rnti; + ulsch_ue->pusch_pdu.rnti = n_rnti; /////////// //////////////////////////////////////////////////////////////////////////////////////////// @@ -439,13 +439,13 @@ int main(int argc, char **argv) if (harq_process_ul_ue) { - harq_process_ul_ue->mcs = Imcs; - harq_process_ul_ue->Nl = Nl; - harq_process_ul_ue->nb_rb = nb_rb; - harq_process_ul_ue->number_of_symbols = nb_symb_sch; + harq_process_ul_ue->pusch_pdu.mcs_index = Imcs; + harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl; + harq_process_ul_ue->pusch_pdu.rb_size = nb_rb; + harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch; harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords; - harq_process_ul_ue->rvidx = rvidx; - harq_process_ul_ue->TBS = TBS; + harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx; + harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS; harq_process_ul_ue->a = &test_input[0]; } diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index a748aada4f..cee0adef47 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -594,9 +594,11 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = start_symbol; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ul_dmrs_symb_pos = l_prime_mask; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs = Imcs; + ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs_table = 0; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = 0; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = precod_nbr_layers; + ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.TBS = TBS; ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.harq_process_nbr = harq_pid; //there are plenty of other parameters that we don't seem to be using for now. e.g. //ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.absolute_delta_PUSCH = 0; From c128e82291e3cf9ef1e0bc98b23fd9d4c8941855 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 7 Apr 2020 21:18:28 +0200 Subject: [PATCH 08/26] use nfapi_nr_ue_pusch_pdu_t instead of fapi_nr_ul_config_pusch_pdu for pusch_config_pdu --- executables/nr-ue.c | 51 ++- .../nfapi/public_inc/fapi_nr_ue_interface.h | 46 +-- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 17 +- openair1/SIMULATION/NR_PHY/ulschsim.c | 8 +- openair1/SIMULATION/NR_PHY/ulsim.c | 28 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 337 +++++++++--------- 6 files changed, 211 insertions(+), 276 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index db039d5eb6..c63c7bf1db 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -357,9 +357,9 @@ static void UE_synch(void *arg) { } void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { - uint32_t nb_rb, start_rb; - uint8_t nb_symb_sch, start_symbol, mcs, precod_nbr_layers, harq_pid, rvidx; - uint16_t n_rnti, l_prime_mask; + uint32_t rb_size, rb_start; + uint8_t nr_of_symbols, start_symbol_index, mcs_index, mcs_table, nrOfLayers, harq_process_id, rv_index; + uint16_t rnti, l_prime_mask; nr_dcireq_t dcireq; nr_scheduled_response_t scheduled_response; @@ -381,34 +381,34 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.frame = proc->frame_rx; scheduled_response.slot = proc->nr_tti_rx; //--------------------------Temporary configuration-----------------------------// - n_rnti = 0x1234; - nb_rb = 50; - start_rb = 0; - nb_symb_sch = 12; - start_symbol = 2; - precod_nbr_layers = 1; - mcs = 9; + rnti = 0x1234; + rb_size = 50; + rb_start = 0; + nr_of_symbols = 12; + start_symbol_index = 2; + nrOfLayers = 1; + mcs_index = 9; mcs_table = 0; - harq_pid = 0; - rvidx = 0; - l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, pusch_len1); + harq_process_id = 0; + rv_index = 0; + l_prime_mask = get_l_prime(nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); //------------------------------------------------------------------------------// scheduled_response.ul_config->slot = 8; scheduled_response.ul_config->number_pdus = 1; scheduled_response.ul_config->ul_config_list[0].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.rnti = n_rnti; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_rbs = nb_rb; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_rb = start_rb; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_symbols = nb_symb_sch; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = start_symbol; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ul_dmrs_symb_pos = l_prime_mask; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs = mcs; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs_table = mcs_table; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = rvidx; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = precod_nbr_layers; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.harq_process_nbr = harq_pid; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rnti = rnti; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rb_size = rb_size; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rb_start = rb_start; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nr_of_symbols = nr_of_symbols; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol_index; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_index = mcs_index; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = rv_index; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nrOfLayers = nrOfLayers; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_process_id; nr_ue_scheduled_response(&scheduled_response); @@ -595,7 +595,6 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); - void *dummy_tx[UE->frame_parms.nb_antennas_tx]; *timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms); for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) { diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 274611703d..2c3809f5d4 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -258,11 +258,6 @@ typedef struct { } fapi_nr_ul_config_pucch_pdu; - typedef enum {pusch_freq_hopping_disabled = 0 , pusch_freq_hopping_enabled = 1}pusch_freq_hopping_t; - typedef struct{ - uint8_t aperiodicSRS_ResourceTrigger; - } fapi_nr_ul_srs_config_t; - typedef struct { uint8_t rv_index; @@ -378,44 +373,10 @@ typedef struct nfapi_nr_ue_dfts_ofdm_t dfts_ofdm; //beamforming nfapi_nr_ue_ul_beamforming_t beamforming; - + //OAI specific + int8_t absolute_delta_PUSCH; } nfapi_nr_ue_pusch_pdu_t; -typedef struct { - uint32_t TBS; - uint8_t bandwidth_part_ind; - uint16_t number_rbs; - uint16_t start_rb; - uint8_t frame_offset; - uint16_t number_symbols; - uint16_t start_symbol; - pusch_freq_hopping_t pusch_freq_hopping; - uint8_t mcs; - uint8_t mcs_table; - uint8_t ndi; - uint8_t rv; - uint8_t harq_process_nbr; - int8_t accumulated_delta_PUSCH; - int8_t absolute_delta_PUSCH; - uint8_t n_layers; - uint8_t tpmi; - //DMRS - uint16_t ul_dmrs_symb_pos; - uint8_t n_dmrs_cdm_groups; - uint8_t dmrs_ports[4]; - uint8_t n_front_load_symb; - fapi_nr_ul_srs_config_t srs_config; - uint8_t csi_reportTriggerSize; - uint8_t maxCodeBlockGroupsPerTransportBlock; - uint8_t ptrs_dmrs_association_port; - uint8_t beta_offset_ind; -} fapi_nr_ul_config_pusch_pdu_rel15_t; - -typedef struct { - uint16_t rnti; - fapi_nr_ul_config_pusch_pdu_rel15_t ulsch_pdu_rel15; -} fapi_nr_ul_config_pusch_pdu; - typedef struct { } fapi_nr_ul_config_srs_pdu; @@ -425,7 +386,7 @@ typedef struct { union { fapi_nr_ul_config_prach_pdu prach_config_pdu; fapi_nr_ul_config_pucch_pdu pucch_config_pdu; - fapi_nr_ul_config_pusch_pdu ulsch_config_pdu; + nfapi_nr_ue_pusch_pdu_t pusch_config_pdu; fapi_nr_ul_config_srs_pdu srs_config_pdu; }; } fapi_nr_ul_config_request_pdu_t; @@ -466,7 +427,6 @@ typedef struct { uint8_t SubcarrierSpacing; uint16_t number_rbs; uint16_t start_rb; - uint8_t frame_offset; uint16_t number_symbols; uint16_t start_symbol; uint16_t dlDmrsSymbPos; diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index b867ea0606..7439c26eb7 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -116,22 +116,11 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response) for(i=0; inumber_pdus; ++i){ if(ul_config->ul_config_list[i].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH){ // pusch config pdu - fapi_nr_ul_config_pusch_pdu_rel15_t *pusch_config_pdu = &ul_config->ul_config_list[i].ulsch_config_pdu.ulsch_pdu_rel15; - uint8_t current_harq_pid = pusch_config_pdu->harq_process_nbr; + nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu; + uint8_t current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id; nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch0->harq_processes[current_harq_pid]->pusch_pdu; - pusch_pdu->rnti = ul_config->ul_config_list[i].ulsch_config_pdu.rnti; - pusch_pdu->rb_size = pusch_config_pdu->number_rbs; - pusch_pdu->rb_start = pusch_config_pdu->start_rb; - pusch_pdu->nr_of_symbols = pusch_config_pdu->number_symbols; - pusch_pdu->start_symbol_index = pusch_config_pdu->start_symbol; - pusch_pdu->ul_dmrs_symb_pos = pusch_config_pdu->ul_dmrs_symb_pos; - pusch_pdu->mcs_index = pusch_config_pdu->mcs; - pusch_pdu->mcs_table = pusch_config_pdu->mcs_table; - pusch_pdu->nrOfLayers = pusch_config_pdu->n_layers; - pusch_pdu->pusch_data.new_data_indicator = pusch_config_pdu->ndi; - pusch_pdu->pusch_data.rv_index = pusch_config_pdu->rv; - pusch_pdu->pusch_data.tb_size = pusch_config_pdu->TBS; + memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t)); ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH; } diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index b7f065a559..5881b21b5f 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -423,13 +423,6 @@ int main(int argc, char **argv) for (i = 0; i < TBS / 8; i++) test_input[i] = (unsigned char) rand(); - - /////////////////////////[adk] preparing NR_UE_ULSCH_t parameters///////////////////////// A HOT FIX until creating nfapi_nr_ul_config_ulsch_pdu_rel15_t - /////////// - ulsch_ue->pusch_pdu.rnti = n_rnti; - /////////// - //////////////////////////////////////////////////////////////////////////////////////////// - /////////////////////////[adk] preparing UL harq_process parameters///////////////////////// /////////// NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; @@ -439,6 +432,7 @@ int main(int argc, char **argv) if (harq_process_ul_ue) { + harq_process_ul_ue->pusch_pdu.rnti = n_rnti; harq_process_ul_ue->pusch_pdu.mcs_index = Imcs; harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl; harq_process_ul_ue->pusch_pdu.rb_size = nb_rb; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index cee0adef47..667cb68dc9 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -587,21 +587,21 @@ int main(int argc, char **argv) ul_config.slot = slot; ul_config.number_pdus = 1; ul_config.ul_config_list[0].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; - ul_config.ul_config_list[0].ulsch_config_pdu.rnti = n_rnti; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_rbs = nb_rb; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_rb = start_rb; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_symbols = nb_symb_sch; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = start_symbol; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ul_dmrs_symb_pos = l_prime_mask; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs = Imcs; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs_table = 0; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = 0; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = precod_nbr_layers; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.TBS = TBS; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.harq_process_nbr = harq_pid; + ul_config.ul_config_list[0].pusch_config_pdu.rnti = n_rnti; + ul_config.ul_config_list[0].pusch_config_pdu.rb_size = nb_rb; + ul_config.ul_config_list[0].pusch_config_pdu.rb_start = start_rb; + ul_config.ul_config_list[0].pusch_config_pdu.nr_of_symbols = nb_symb_sch; + ul_config.ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol; + ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask; + ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs; + ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = 0; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = 0; + ul_config.ul_config_list[0].pusch_config_pdu.nrOfLayers = precod_nbr_layers; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.tb_size = TBS; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_pid; //there are plenty of other parameters that we don't seem to be using for now. e.g. - //ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.absolute_delta_PUSCH = 0; + ul_config.ul_config_list[0].pusch_config_pdu.absolute_delta_PUSCH = 0; // set FAPI parameters for UE, put them in the scheduled response and call nr_ue_scheduled_response(&scheduled_response); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 58b312038a..d6c90c7d15 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -118,7 +118,7 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, //fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; nr_phy_config_t *phy_config = &mac->phy_config; - //ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti; + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti; // First we need to verify if DCI ind contains a ul-sch to be perfomred. If it does, we will handle a PUSCH in the UL_CONFIG_REQ. ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUCCH; for (int i=0; i<10; i++) { @@ -128,29 +128,27 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, } if (ul_config->ul_config_list[ul_config->number_pdus].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) { // fill in the elements in config request inside P5 message - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.bandwidth_part_ind = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.number_rbs = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.start_rb = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.frame_offset = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.number_symbols = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.pusch_freq_hopping = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.mcs = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.rv = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.harq_process_nbr = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.accumulated_delta_PUSCH = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.absolute_delta_PUSCH = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.tpmi = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.n_dmrs_cdm_groups = 0; - for (int i=0;i<4;i++) ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.dmrs_ports[i]=0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.n_front_load_symb = 0; - //ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.srs_config = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.csi_reportTriggerSize = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.maxCodeBlockGroupsPerTransportBlock = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.ptrs_dmrs_association_port = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.beta_offset_ind = 0; + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.bandwidth_part_ind = 0; //FIXME + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rb_size = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rb_start = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.nr_of_symbols = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.start_symbol_index = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.frequency_hopping = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.mcs_index = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.pusch_data.new_data_indicator = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.pusch_data.rv_index = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.pusch_data.harq_process_id = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.absolute_delta_PUSCH = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.nrOfLayers = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.transform_precoding = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.dmrs_ports = 0; + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.n_front_load_symb = 0; //FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.srs_config = 0; //FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.csi_reportTriggerSize = 0; //FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.maxCodeBlockGroupsPerTransportBlock = 0; //FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.ptrs_dmrs_association_port = 0; FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.beta_offset_ind = 0; //FIXME } else { // If DCI ind is not format 0_0 or 0_1, we will handle a PUCCH in the UL_CONFIG_REQ ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUCCH; // If we handle PUCCH common @@ -1669,7 +1667,7 @@ uint8_t table_7_3_2_3_3_4_twoCodeword[6][10] = { {2,0,1,2,3,6,7,8,0,2}, {2,0,1,2,3,6,7,8,9,2} }; -int8_t nr_ue_process_dci_freq_dom_resource_assignment(fapi_nr_ul_config_pusch_pdu_rel15_t *ulsch_config_pdu, +int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu, uint16_t n_RB_ULBWP, uint16_t n_RB_DLBWP, @@ -1692,7 +1690,7 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(fapi_nr_ul_config_pusch_pd dlsch_config_pdu->start_rb = NRRIV2PRBOFFSET(riv,n_RB_DLBWP); } - if(ulsch_config_pdu != NULL){ + if(pusch_config_pdu != NULL){ /* * TS 38.214 subclause 6.1.2.2 Resource allocation in frequency domain (uplink) */ @@ -1703,14 +1701,14 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(fapi_nr_ul_config_pusch_pd * TS 38.214 subclause 6.1.2.2.2 Uplink resource allocation type 1 */ - ulsch_config_pdu->number_rbs = NRRIV2BW(riv,n_RB_ULBWP); - ulsch_config_pdu->start_rb = NRRIV2PRBOFFSET(riv,n_RB_ULBWP); + pusch_config_pdu->rb_size = NRRIV2BW(riv,n_RB_ULBWP); + pusch_config_pdu->rb_start = NRRIV2PRBOFFSET(riv,n_RB_ULBWP); } return 0; } int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, - fapi_nr_ul_config_pusch_pdu_rel15_t *ulsch_config_pdu, + nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu, uint8_t time_domain_ind ){ @@ -1849,9 +1847,6 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, SLIV2SL(startSymbolAndLength,&S,&L); dlsch_config_pdu->start_symbol=S; dlsch_config_pdu->number_symbols=L; - dlsch_config_pdu->frame_offset = pdsch_TimeDomainAllocationList->list.array[time_domain_ind]->k0!=NULL ? - *pdsch_TimeDomainAllocationList->list.array[time_domain_ind]->k0 : - 0; } else {// Default configuration from tables k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; @@ -1866,14 +1861,13 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, // k_offset = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][0]; // sliv_S = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][1]; // sliv_L = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][2]; - dlsch_config_pdu->frame_offset = k_offset; dlsch_config_pdu->number_symbols = sliv_L; dlsch_config_pdu->start_symbol = sliv_S; } } /* * TS 38.214 subclause 6.1.2.1 Resource allocation in time domain (uplink) */ - if(ulsch_config_pdu != NULL){ + if(pusch_config_pdu != NULL){ NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; if (mac->ULbwp[0]->bwp_Dedicated->pusch_Config) pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup; @@ -1885,12 +1879,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, int startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[time_domain_ind]->startSymbolAndLength; int S,L; SLIV2SL(startSymbolAndLength,&S,&L); - ulsch_config_pdu->start_symbol=S; - ulsch_config_pdu->number_symbols=L; - ulsch_config_pdu->frame_offset = pusch_TimeDomainAllocationList->list.array[time_domain_ind]->k2!=NULL ? - *pusch_TimeDomainAllocationList->list.array[time_domain_ind]->k2 : - mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing < NR_SubcarrierSpacing_kHz60 ? 1 : - mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing < NR_SubcarrierSpacing_kHz120 ? 2 : 3; + pusch_config_pdu->start_symbol_index=S; + pusch_config_pdu->nr_of_symbols=L; } else { k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; @@ -1899,9 +1889,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, // k_offset = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0]; // sliv_S = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1]; // sliv_L = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2]; - ulsch_config_pdu->frame_offset = k_offset; - ulsch_config_pdu->number_symbols = sliv_L; - ulsch_config_pdu->start_symbol = sliv_S; + pusch_config_pdu->nr_of_symbols = sliv_L; + pusch_config_pdu->start_symbol_index = sliv_S; } } return 0; @@ -1953,45 +1942,41 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, nr * 50 SUL_IND_0_0: */ ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti; - fapi_nr_ul_config_pusch_pdu_rel15_t *ulsch_config_pdu_0_0 = &ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti; + nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu_0_0 = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu; /* IDENTIFIER_DCI_FORMATS */ /* FREQ_DOM_RESOURCE_ASSIGNMENT_UL */ - nr_ue_process_dci_freq_dom_resource_assignment(ulsch_config_pdu_0_0,NULL,n_RB_ULBWP,0,dci->freq_dom_resource_assignment_UL); + nr_ue_process_dci_freq_dom_resource_assignment(pusch_config_pdu_0_0,NULL,n_RB_ULBWP,0,dci->freq_dom_resource_assignment_UL); /* TIME_DOM_RESOURCE_ASSIGNMENT */ nr_ue_process_dci_time_dom_resource_assignment(mac, - ulsch_config_pdu_0_0,NULL, + pusch_config_pdu_0_0,NULL, dci->time_dom_resource_assignment); /* FREQ_HOPPING_FLAG */ if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.resource_allocation != 0) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.frequency_hopping !=0)) - ulsch_config_pdu_0_0->pusch_freq_hopping = (dci->freq_hopping_flag == 0)? pusch_freq_hopping_disabled:pusch_freq_hopping_enabled; + pusch_config_pdu_0_0->frequency_hopping = dci->freq_hopping_flag; /* MCS */ - ulsch_config_pdu_0_0->mcs = dci->mcs; + pusch_config_pdu_0_0->mcs_index = dci->mcs; /* NDI */ - ulsch_config_pdu_0_0->ndi = dci->ndi; + pusch_config_pdu_0_0->pusch_data.new_data_indicator = dci->ndi; /* RV */ - ulsch_config_pdu_0_0->rv = dci->rv; + pusch_config_pdu_0_0->pusch_data.rv_index = dci->rv; /* HARQ_PROCESS_NUMBER */ - ulsch_config_pdu_0_0->harq_process_nbr = dci->harq_process_number; + pusch_config_pdu_0_0->pusch_data.harq_process_id = dci->harq_process_number; /* TPC_PUSCH */ // according to TS 38.213 Table Table 7.1.1-1 if (dci->tpc_pusch == 0) { - ulsch_config_pdu_0_0->accumulated_delta_PUSCH = -1; - ulsch_config_pdu_0_0->absolute_delta_PUSCH = -4; + pusch_config_pdu_0_0->absolute_delta_PUSCH = -4; } if (dci->tpc_pusch == 1) { - ulsch_config_pdu_0_0->accumulated_delta_PUSCH = 0; - ulsch_config_pdu_0_0->absolute_delta_PUSCH = -1; + pusch_config_pdu_0_0->absolute_delta_PUSCH = -1; } if (dci->tpc_pusch == 2) { - ulsch_config_pdu_0_0->accumulated_delta_PUSCH = 1; - ulsch_config_pdu_0_0->absolute_delta_PUSCH = 1; + pusch_config_pdu_0_0->absolute_delta_PUSCH = 1; } if (dci->tpc_pusch == 3) { - ulsch_config_pdu_0_0->accumulated_delta_PUSCH = 3; - ulsch_config_pdu_0_0->absolute_delta_PUSCH = 4; + pusch_config_pdu_0_0->absolute_delta_PUSCH = 4; } /* SUL_IND_0_0 */ // To be implemented, FIXME!!! @@ -2028,49 +2013,45 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, nr * 49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space */ ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti; - fapi_nr_ul_config_pusch_pdu_rel15_t *ulsch_config_pdu_0_1 = &ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti; + nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu_0_1 = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu; /* IDENTIFIER_DCI_FORMATS */ /* CARRIER_IND */ /* SUL_IND_0_1 */ /* BANDWIDTH_PART_IND */ - ulsch_config_pdu_0_1->bandwidth_part_ind = dci->bandwidth_part_ind; + //pusch_config_pdu_0_1->bandwidth_part_ind = dci->bandwidth_part_ind; //FIXME /* FREQ_DOM_RESOURCE_ASSIGNMENT_UL */ - nr_ue_process_dci_freq_dom_resource_assignment(ulsch_config_pdu_0_1,NULL,n_RB_ULBWP,0,dci->freq_dom_resource_assignment_UL); + nr_ue_process_dci_freq_dom_resource_assignment(pusch_config_pdu_0_1,NULL,n_RB_ULBWP,0,dci->freq_dom_resource_assignment_UL); /* TIME_DOM_RESOURCE_ASSIGNMENT */ - nr_ue_process_dci_time_dom_resource_assignment(mac,ulsch_config_pdu_0_1,NULL, + nr_ue_process_dci_time_dom_resource_assignment(mac,pusch_config_pdu_0_1,NULL, dci->time_dom_resource_assignment); /* FREQ_HOPPING_FLAG */ if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.resource_allocation != 0) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.frequency_hopping !=0)) - ulsch_config_pdu_0_1->pusch_freq_hopping = (dci->freq_hopping_flag == 0)? pusch_freq_hopping_disabled:pusch_freq_hopping_enabled; + pusch_config_pdu_0_1->frequency_hopping = dci->freq_hopping_flag; /* MCS */ - ulsch_config_pdu_0_1->mcs = dci->mcs; + pusch_config_pdu_0_1->mcs_index = dci->mcs; /* NDI */ - ulsch_config_pdu_0_1->ndi = dci->ndi; + pusch_config_pdu_0_1->pusch_data.new_data_indicator = dci->ndi; /* RV */ - ulsch_config_pdu_0_1->rv = dci->rv; + pusch_config_pdu_0_1->pusch_data.rv_index = dci->rv; /* HARQ_PROCESS_NUMBER */ - ulsch_config_pdu_0_1->harq_process_nbr = dci->harq_process_number; + pusch_config_pdu_0_1->pusch_data.harq_process_id = dci->harq_process_number; /* FIRST_DAI */ //To be implemented, FIXME!!! /* SECOND_DAI */ //To be implemented, FIXME!!! /* TPC_PUSCH */ // according to TS 38.213 Table Table 7.1.1-1 if (dci->tpc_pusch == 0) { - ulsch_config_pdu_0_1->accumulated_delta_PUSCH = -1; - ulsch_config_pdu_0_1->absolute_delta_PUSCH = -4; + pusch_config_pdu_0_1->absolute_delta_PUSCH = -4; } if (dci->tpc_pusch == 1) { - ulsch_config_pdu_0_1->accumulated_delta_PUSCH = 0; - ulsch_config_pdu_0_1->absolute_delta_PUSCH = -1; + pusch_config_pdu_0_1->absolute_delta_PUSCH = -1; } if (dci->tpc_pusch == 2) { - ulsch_config_pdu_0_1->accumulated_delta_PUSCH = 1; - ulsch_config_pdu_0_1->absolute_delta_PUSCH = 1; + pusch_config_pdu_0_1->absolute_delta_PUSCH = 1; } if (dci->tpc_pusch == 3) { - ulsch_config_pdu_0_1->accumulated_delta_PUSCH = 3; - ulsch_config_pdu_0_1->absolute_delta_PUSCH = 4; + pusch_config_pdu_0_1->absolute_delta_PUSCH = 4; } /* SRS_RESOURCE_IND */ //FIXME!! @@ -2087,16 +2068,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, nr (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 3) || (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 4))){ if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][0]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][1]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][0]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][1]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_partialAndNonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][2]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][3]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][2]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][3]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_nonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][4]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][5]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][4]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][5]; } } // Table 7.3.1.1.2-3: transformPrecoder= enabled, or transformPrecoder=disabled and maxRank = 1 @@ -2104,16 +2085,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, nr || (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled)) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 1)){ if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][6]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][7]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][6]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][7]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_partialAndNonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][8]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][9]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][8]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][9]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_nonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][10]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][11]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][10]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][11]; } } } @@ -2122,12 +2103,12 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, nr if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 2)){ if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][12]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][13]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][12]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][13]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_nonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][14]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][15]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][14]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][15]; } } // Table 7.3.1.1.2-5: transformPrecoder= enabled, or transformPrecoder= disabled and maxRank = 1 @@ -2135,12 +2116,12 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, nr || (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled)) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 1)){ if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][16]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][17]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][16]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][17]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_nonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][18]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][19]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][18]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precod_nbr_layers][19]; } } } @@ -2150,146 +2131,158 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, nr if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_enabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-6 - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = dci->antenna_ports; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = dci->antenna_ports; //TBC } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_enabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-7 - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports > 3)?(dci->antenna_ports-4):(dci->antenna_ports); - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 3)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = (dci->antenna_ports > 3)?(dci->antenna_ports-4):(dci->antenna_ports); //TBC + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 3)?2:1; //FIXME } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-8/9/10/11 if (rank == 1){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports > 1)?2:1; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports > 1)?(dci->antenna_ports-2):(dci->antenna_ports); + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports > 1)?2:1; //TBC + pusch_config_pdu_0_1->dmrs_ports = (dci->antenna_ports > 1)?(dci->antenna_ports-2):(dci->antenna_ports); //TBC } if (rank == 2){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports > 0)?2:1; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports > 1)?(dci->antenna_ports > 2 ?0:2):0; - ulsch_config_pdu_0_1->dmrs_ports[1] = (dci->antenna_ports > 1)?(dci->antenna_ports > 2 ?2:3):1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports > 0)?2:1; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports > 1)?(dci->antenna_ports > 2 ?0:2):0; + //pusch_config_pdu_0_1->dmrs_ports[1] = (dci->antenna_ports > 1)?(dci->antenna_ports > 2 ?2:3):1; } if (rank == 3){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = 0; - ulsch_config_pdu_0_1->dmrs_ports[1] = 1; - ulsch_config_pdu_0_1->dmrs_ports[2] = 2; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = 0; + //pusch_config_pdu_0_1->dmrs_ports[1] = 1; + //pusch_config_pdu_0_1->dmrs_ports[2] = 2; } if (rank == 4){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = 0; - ulsch_config_pdu_0_1->dmrs_ports[1] = 1; - ulsch_config_pdu_0_1->dmrs_ports[2] = 2; - ulsch_config_pdu_0_1->dmrs_ports[3] = 3; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = 0; + //pusch_config_pdu_0_1->dmrs_ports[1] = 1; + //pusch_config_pdu_0_1->dmrs_ports[2] = 2; + //pusch_config_pdu_0_1->dmrs_ports[3] = 3; } } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-12/13/14/15 if (rank == 1){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports > 1)?2:1; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports > 1)?(dci->antenna_ports > 5 ?(dci->antenna_ports-6):(dci->antenna_ports-2)):dci->antenna_ports; - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 6)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports > 1)?2:1; //TBC + pusch_config_pdu_0_1->dmrs_ports = (dci->antenna_ports > 1)?(dci->antenna_ports > 5 ?(dci->antenna_ports-6):(dci->antenna_ports-2)):dci->antenna_ports; //TBC + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 6)?2:1; //FIXME } if (rank == 2){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports > 0)?2:1; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_13[dci->antenna_ports][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_13[dci->antenna_ports][2]; - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 3)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports > 0)?2:1; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_13[dci->antenna_ports][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_13[dci->antenna_ports][2]; + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 3)?2:1; // FIXME } if (rank == 3){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_14[dci->antenna_ports][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_14[dci->antenna_ports][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_14[dci->antenna_ports][3]; - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 1)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_14[dci->antenna_ports][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_14[dci->antenna_ports][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_14[dci->antenna_ports][3]; + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 1)?2:1; //FIXME } if (rank == 4){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_15[dci->antenna_ports][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_15[dci->antenna_ports][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_15[dci->antenna_ports][3]; - ulsch_config_pdu_0_1->dmrs_ports[3] = table_7_3_1_1_2_15[dci->antenna_ports][4]; - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 1)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_15[dci->antenna_ports][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_15[dci->antenna_ports][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_15[dci->antenna_ports][3]; + //pusch_config_pdu_0_1->dmrs_ports[3] = table_7_3_1_1_2_15[dci->antenna_ports][4]; + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 1)?2:1; //FIXME } } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 2) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-16/17/18/19 if (rank == 1){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports > 1)?((dci->antenna_ports > 5)?3:2):1; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports > 1)?(dci->antenna_ports > 5 ?(dci->antenna_ports-6):(dci->antenna_ports-2)):dci->antenna_ports; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports > 1)?((dci->antenna_ports > 5)?3:2):1; //TBC + pusch_config_pdu_0_1->dmrs_ports = (dci->antenna_ports > 1)?(dci->antenna_ports > 5 ?(dci->antenna_ports-6):(dci->antenna_ports-2)):dci->antenna_ports; //TBC } if (rank == 2){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports > 0)?((dci->antenna_ports > 2)?3:2):1; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_17[dci->antenna_ports][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_17[dci->antenna_ports][2]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports > 0)?((dci->antenna_ports > 2)?3:2):1; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_17[dci->antenna_ports][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_17[dci->antenna_ports][2]; } if (rank == 3){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports > 0)?3:2; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_18[dci->antenna_ports][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_18[dci->antenna_ports][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_18[dci->antenna_ports][3]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports > 0)?3:2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_18[dci->antenna_ports][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_18[dci->antenna_ports][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_18[dci->antenna_ports][3]; } if (rank == 4){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = dci->antenna_ports + 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = 0; - ulsch_config_pdu_0_1->dmrs_ports[1] = 1; - ulsch_config_pdu_0_1->dmrs_ports[2] = 2; - ulsch_config_pdu_0_1->dmrs_ports[3] = 3; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = dci->antenna_ports + 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = 0; + //pusch_config_pdu_0_1->dmrs_ports[1] = 1; + //pusch_config_pdu_0_1->dmrs_ports[2] = 2; + //pusch_config_pdu_0_1->dmrs_ports[3] = 3; } } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 2) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-20/21/22/23 if (rank == 1){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = table_7_3_1_1_2_20[dci->antenna_ports][0]; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_20[dci->antenna_ports][1]; - ulsch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_20[dci->antenna_ports][2]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = table_7_3_1_1_2_20[dci->antenna_ports][0]; //TBC + pusch_config_pdu_0_1->dmrs_ports = table_7_3_1_1_2_20[dci->antenna_ports][1]; //TBC + //pusch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_20[dci->antenna_ports][2]; //FIXME } if (rank == 2){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = table_7_3_1_1_2_21[dci->antenna_ports][0]; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_21[dci->antenna_ports][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_21[dci->antenna_ports][2]; - ulsch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_21[dci->antenna_ports][3]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = table_7_3_1_1_2_21[dci->antenna_ports][0]; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_21[dci->antenna_ports][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_21[dci->antenna_ports][2]; + //pusch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_21[dci->antenna_ports][3]; //FIXME } if (rank == 3){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = table_7_3_1_1_2_22[dci->antenna_ports][0]; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_22[dci->antenna_ports][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_22[dci->antenna_ports][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_22[dci->antenna_ports][3]; - ulsch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_22[dci->antenna_ports][4]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = table_7_3_1_1_2_22[dci->antenna_ports][0]; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_22[dci->antenna_ports][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_22[dci->antenna_ports][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_22[dci->antenna_ports][3]; + //pusch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_22[dci->antenna_ports][4]; //FIXME } if (rank == 4){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = table_7_3_1_1_2_23[dci->antenna_ports][0]; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_23[dci->antenna_ports][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_23[dci->antenna_ports][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_23[dci->antenna_ports][3]; - ulsch_config_pdu_0_1->dmrs_ports[3] = table_7_3_1_1_2_23[dci->antenna_ports][4]; - ulsch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_23[dci->antenna_ports][5]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = table_7_3_1_1_2_23[dci->antenna_ports][0]; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_23[dci->antenna_ports][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_23[dci->antenna_ports][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_23[dci->antenna_ports][3]; + //pusch_config_pdu_0_1->dmrs_ports[3] = table_7_3_1_1_2_23[dci->antenna_ports][4]; + //pusch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_23[dci->antenna_ports][5]; //FIXME } } /* SRS_REQUEST */ // if SUL is supported in the cell, there is an additional bit in thsi field and the value of this bit represents table 7.1.1.1-1 TS 38.212 FIXME!!! - ulsch_config_pdu_0_1->srs_config.aperiodicSRS_ResourceTrigger = (dci->srs_request & 0x11); // as per Table 7.3.1.1.2-24 TS 38.212 + //pusch_config_pdu_0_1->srs_config.aperiodicSRS_ResourceTrigger = (dci->srs_request & 0x11); // as per Table 7.3.1.1.2-24 TS 38.212 //FIXME /* CSI_REQUEST */ - ulsch_config_pdu_0_1->csi_reportTriggerSize = dci->csi_request; + //pusch_config_pdu_0_1->csi_reportTriggerSize = dci->csi_request; //FIXME /* CBGTI */ - ulsch_config_pdu_0_1->maxCodeBlockGroupsPerTransportBlock = dci->cbgti; + //pusch_config_pdu_0_1->maxCodeBlockGroupsPerTransportBlock = dci->cbgti; //FIXME /* PTRS_DMRS */ if (((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.ptrs_uplink_config == 0)) || ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_enabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 1))){ } else { - ulsch_config_pdu_0_1->ptrs_dmrs_association_port = dci->ptrs_dmrs; + //pusch_config_pdu_0_1->ptrs_dmrs_association_port = dci->ptrs_dmrs; //FIXME } /* BETA_OFFSET_IND */ // Table 9.3-3 in [5, TS 38.213] - ulsch_config_pdu_0_1->beta_offset_ind = dci->beta_offset_ind; + //pusch_config_pdu_0_1->beta_offset_ind = dci->beta_offset_ind; //FIXME /* DMRS_SEQ_INI */ // FIXME!! /* UL_SCH_IND */ From 672937b4d71d745e7deaf6b95891629b299e8b66 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Tue, 14 Apr 2020 08:38:13 +0200 Subject: [PATCH 09/26] Using SCF structs for DMRS at UE side instead of dmrs_UplinkConfig --- executables/nr-ue.c | 5 ++++- openair1/PHY/INIT/nr_init_ue.c | 8 ++++---- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 10 +++++----- openair1/SIMULATION/NR_PHY/ulsim.c | 16 +++++++++------- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 + 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index c63c7bf1db..24abc37c3d 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -357,8 +357,9 @@ static void UE_synch(void *arg) { } void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { + uint32_t rb_size, rb_start; - uint8_t nr_of_symbols, start_symbol_index, mcs_index, mcs_table, nrOfLayers, harq_process_id, rv_index; + uint8_t nr_of_symbols, start_symbol_index, mcs_index, mcs_table, nrOfLayers, harq_process_id, rv_index, dmrs_config_type; uint16_t rnti, l_prime_mask; nr_dcireq_t dcireq; @@ -392,6 +393,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { harq_process_id = 0; rv_index = 0; l_prime_mask = get_l_prime(nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); + dmrs_config_type = 0; //------------------------------------------------------------------------------// scheduled_response.ul_config->slot = 8; @@ -403,6 +405,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nr_of_symbols = nr_of_symbols; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol_index; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_index = mcs_index; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0; diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 4ed5be2119..c00b5c44c5 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -657,7 +657,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, abstraction_flag = 0; fp->nb_antennas_tx = 1; fp->nb_antennas_rx=1; - dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig; + // dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig; ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); @@ -710,9 +710,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } //------------- config DMRS parameters--------------// - dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1; - dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; - dmrs_Uplink_Config->pusch_maxLength = pusch_len1; + // dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1; + // dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; + // dmrs_Uplink_Config->pusch_maxLength = pusch_len1; //-------------------------------------------------// ue->dmrs_DownlinkConfig.pdsch_dmrs_type = pdsch_dmrs_type1; ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition = pdsch_dmrs_pos0; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 319c3a2778..c30dfd1449 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -133,9 +133,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index]; harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; - start_symbol = harq_process_ul_ue->pusch_pdu.start_symbol_index; - ul_dmrs_symb_pos = harq_process_ul_ue->pusch_pdu.ul_dmrs_symb_pos; + start_symbol = harq_process_ul_ue->pusch_pdu.start_symbol_index; + ul_dmrs_symb_pos = harq_process_ul_ue->pusch_pdu.ul_dmrs_symb_pos; number_of_symbols = harq_process_ul_ue->pusch_pdu.nr_of_symbols; + dmrs_type = harq_process_ul_ue->pusch_pdu.dmrs_config_type; for (i = start_symbol; i < start_symbol + number_of_symbols; i++) { @@ -146,7 +147,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, rnti = harq_process_ul_ue->pusch_pdu.rnti; ulsch_ue->Nid_cell = Nid_cell; - nb_dmrs_re_per_rb = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4); + nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4); N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; @@ -271,7 +272,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; n_dmrs = (nb_rb*nb_dmrs_re_per_rb*number_dmrs_symbols); int16_t mod_dmrs[n_dmrs<<1]; - dmrs_type = UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type; /////////// //////////////////////////////////////////////////////////////////////// @@ -409,7 +409,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ulsch_ue->ptrs_symbols, start_sc, frame_parms->ofdm_symbol_size, - UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, + dmrs_type, ptrs_Uplink_Config->resourceElementOffset); } diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 667cb68dc9..ab4a0b4d0e 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -499,21 +499,18 @@ int main(int argc, char **argv) uint16_t number_dmrs_symbols = 0; unsigned int available_bits; uint8_t nb_re_dmrs; - uint8_t length_dmrs = UE->pusch_config.dmrs_UplinkConfig.pusch_maxLength; unsigned char mod_order; uint16_t code_rate; - uint16_t l_prime_mask = get_l_prime(nb_symb_sch, UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, pusch_dmrs_pos0, length_dmrs); + uint8_t length_dmrs = pusch_len1; // [hna] remove dmrs struct + uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct for (i = 0; i < nb_symb_sch; i++) { number_dmrs_symbols += (l_prime_mask >> i) & 0x01; } mod_order = nr_get_Qm_ul(Imcs, 0); - nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1) ? 6 : 4) * number_dmrs_symbols; code_rate = nr_get_code_rate_ul(Imcs, 0); - available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1); - TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, precod_nbr_layers); printf("\n"); @@ -570,7 +567,6 @@ int main(int argc, char **argv) pusch_pdu->pusch_data.rv_index = 0; pusch_pdu->pusch_data.harq_process_id = 0; pusch_pdu->pusch_data.new_data_indicator = 0; - pusch_pdu->pusch_data.tb_size = TBS>>3; pusch_pdu->pusch_data.num_cb = 0; @@ -593,16 +589,22 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].pusch_config_pdu.nr_of_symbols = nb_symb_sch; ul_config.ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol; ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask; + ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type = 0; ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs; ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = 0; ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0; ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = 0; ul_config.ul_config_list[0].pusch_config_pdu.nrOfLayers = precod_nbr_layers; - ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.tb_size = TBS; ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_pid; //there are plenty of other parameters that we don't seem to be using for now. e.g. ul_config.ul_config_list[0].pusch_config_pdu.absolute_delta_PUSCH = 0; + nb_re_dmrs = ((ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type == pusch_dmrs_type1) ? 6 : 4) * number_dmrs_symbols; + available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1); + TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, precod_nbr_layers); + + pusch_pdu->pusch_data.tb_size = TBS>>3; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.tb_size = TBS; // set FAPI parameters for UE, put them in the scheduled response and call nr_ue_scheduled_response(&scheduled_response); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index d6c90c7d15..2a7e0578de 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -143,6 +143,7 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.transform_precoding = 0; ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 0; ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.dmrs_ports = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.dmrs_config_type = 0; //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.n_front_load_symb = 0; //FIXME //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.srs_config = 0; //FIXME //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.csi_reportTriggerSize = 0; //FIXME From c878bbcc7826cbe4be76cc5c3d2d09fad10e35d2 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Wed, 15 Apr 2020 15:43:49 +0200 Subject: [PATCH 10/26] Fixing ptrs time domain allocation in set_ptrs_symb_idx --- openair1/PHY/NR_REFSIG/ptrs_nr.c | 39 ++++++++----------- openair1/PHY/NR_REFSIG/ptrs_nr.h | 5 +-- .../PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 5 +-- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 5 +-- 4 files changed, 20 insertions(+), 34 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 7ade1654d5..e06b44782d 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -130,35 +130,30 @@ uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB) { void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t duration_in_symbols, uint8_t start_symbol, - uint8_t dmrs_type, uint8_t L_ptrs, - uint8_t pusch_maxLength, - uint16_t ul_dmrs_symb_pos, - uint16_t ofdm_symbol_size) { - uint8_t i, last_symbol, is_dmrs_symbol1, is_dmrs_symbol2; - int16_t l_ref; - *ptrs_symbols = 0; - i = 0; - is_dmrs_symbol1 = 0; - is_dmrs_symbol2 = 0; - l_ref = start_symbol; - last_symbol = start_symbol + duration_in_symbols - 1; + uint16_t ul_dmrs_symb_pos) { + + uint8_t i = 0, last_symbol, is_dmrs_symbol, l_ref; + int8_t l_counter; + l_ref = start_symbol; + last_symbol = start_symbol + duration_in_symbols - 1; while ( (l_ref + i*L_ptrs) <= last_symbol) { - if((ul_dmrs_symb_pos >> max((l_ref + (i-1)*L_ptrs + 1), l_ref)) & 0x01) - is_dmrs_symbol1 = 1; + is_dmrs_symbol = 0; - if((ul_dmrs_symb_pos >> (l_ref + i*L_ptrs)) & 0x01) - is_dmrs_symbol2 = 0; + for(l_counter = l_ref + i*L_ptrs; l_counter >= max(l_ref + (i-1)*L_ptrs + 1, l_ref); l_counter--) { - if ( is_dmrs_symbol1 + is_dmrs_symbol2 > 0 ) { - if (pusch_maxLength == 2) - l_ref = l_ref + i*L_ptrs + 1; - else - l_ref = l_ref + i*L_ptrs; + if((ul_dmrs_symb_pos >> l_counter) & 0x01) { + is_dmrs_symbol = 1; + break; + } - i = 1; + } + + if (is_dmrs_symbol) { + l_ref = l_counter; + i = 1; continue; } diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h index 017fadf8e4..113f0dc7cb 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.h +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h @@ -54,11 +54,8 @@ uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB); void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t duration_in_symbols, uint8_t start_symbol, - uint8_t dmrs_type, uint8_t L_ptrs, - uint8_t pusch_maxLength, - uint16_t ul_dmrs_symb_pos, - uint16_t ofdm_symbol_size); + uint16_t ul_dmrs_symb_pos); uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index b87df84530..9366e5cbbf 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -1052,11 +1052,8 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, set_ptrs_symb_idx(&gNB->pusch_vars[UE_id]->ptrs_symbols, rel15_ul->nr_of_symbols, rel15_ul->start_symbol_index, - rel15_ul->dmrs_config_type, L_ptrs, - 1, // only dmrs of length 1 is currently supported - rel15_ul->ul_dmrs_symb_pos, - frame_parms->ofdm_symbol_size); + rel15_ul->ul_dmrs_symb_pos); } } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index c30dfd1449..44652845b8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -295,11 +295,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols, number_of_symbols, start_symbol, - dmrs_type, L_ptrs, - number_dmrs_symbols, - ul_dmrs_symb_pos, - frame_parms->ofdm_symbol_size); + ul_dmrs_symb_pos); } /////////// From e9dd51a7468760dc46a704584ed331c474e07625 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Wed, 15 Apr 2020 18:48:03 +0200 Subject: [PATCH 11/26] Minor clean-ups regarding PTRS --- openair1/PHY/NR_REFSIG/ptrs_nr.c | 21 +++++++------------ openair1/PHY/NR_REFSIG/ptrs_nr.h | 6 ++---- .../PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 4 ---- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 2 -- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index e06b44782d..63f962f426 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -119,7 +119,7 @@ uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB) { * duration_in_symbols number of scheduled PUSCH ofdm symbols * start_symbol first ofdm symbol of PUSCH within slot * L_ptrs the parameter L_ptrs -* ofdm_symbol_size FFT size +* ul_dmrs_symb_pos bitmap of the time domain positions of the DMRS symbols in the scheduled PUSCH * * RETURN : sets the bit map of PTRS ofdm symbol indicies * @@ -205,7 +205,6 @@ uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs) { * N_RB number of RBs scheduled for PUSCH * k_RE_ref the parameter k_RE_ref * start_sc first subcarrier index -* ofdm_symbol_size FFT size * * RETURN : 1 if subcarrier k is PTRS, or 0 otherwise * @@ -213,11 +212,9 @@ uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs) { * *********************************************************************/ -uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size) { - uint16_t k_RB_ref, i, sc; - i = 0; - sc = 0; - k_RB_ref = 0; +uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc) { + + uint16_t k_RB_ref; if (N_RB % K_ptrs == 0) k_RB_ref = n_rnti % K_ptrs; @@ -227,7 +224,7 @@ uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t if (k < (k_RE_ref + k_RB_ref*NR_NB_SC_PER_RB + start_sc)) return 0; - if ((k-k_RE_ref - k_RB_ref*NR_NB_SC_PER_RB - start_sc)%(K_ptrs*NR_NB_SC_PER_RB) == 0) + if ((k - k_RE_ref - k_RB_ref*NR_NB_SC_PER_RB - start_sc) % (K_ptrs*NR_NB_SC_PER_RB) == 0) return 1; return 0; @@ -241,12 +238,10 @@ uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t * k subcarrier index * n_rnti UE CRNTI * N_RB number of RBs scheduled for PUSCH -* duration_in_symbols number of scheduled PUSCH ofdm symbols * dmrs_antenna_port DMRS antenna port * K_ptrs the parameter K_ptrs * ptrs_symbols bit mask of ptrs * start_sc first subcarrier index -* ofdm_symbol_size FFT size * pusch_dmrs_type PUSCH DMRS type (1 or 2) * ptrs_UplinkConfig PTRS uplink configuration * @@ -260,17 +255,15 @@ uint8_t is_ptrs_symbol(uint8_t l, uint16_t k, uint16_t n_rnti, uint16_t N_RB, - uint8_t duration_in_symbols, uint8_t dmrs_antenna_port, uint8_t K_ptrs, uint16_t ptrs_symbols, uint16_t start_sc, - uint16_t ofdm_symbol_size, - pusch_dmrs_type_t pusch_dmrs_type, + uint8_t pusch_dmrs_type, uint8_t resourceElementOffset) { int16_t k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); - uint8_t is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size); + uint8_t is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc); if (is_ptrs_freq == 0) return 0; diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h index 113f0dc7cb..a22c80d46c 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.h +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h @@ -59,19 +59,17 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs); -uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size); +uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc); uint8_t is_ptrs_symbol(uint8_t l, uint16_t k, uint16_t n_rnti, uint16_t N_RB, - uint8_t duration_in_symbols, uint8_t dmrs_antenna_port, uint8_t K_ptrs, uint16_t ptrs_symbols, uint16_t start_sc, - uint16_t ofdm_symbol_size, - pusch_dmrs_type_t pusch_dmrs_type, + uint8_t pusch_dmrs_type, uint8_t resourceElementOffset); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 9366e5cbbf..d9f874f988 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -289,12 +289,10 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, (start_re + re)%frame_parms->ofdm_symbol_size, n_rnti, pusch_pdu->rb_size, - pusch_pdu->nr_of_symbols, aarx, K_ptrs, pusch_vars->ptrs_symbols, start_re, - frame_parms->ofdm_symbol_size, pusch_pdu->dmrs_config_type, pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset); @@ -1073,12 +1071,10 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, 0, rel15_ul->rnti, rel15_ul->rb_size, - rel15_ul->nr_of_symbols, 0, (rel15_ul->pusch_ptrs.ptrs_freq_density)?4:2, gNB->pusch_vars[UE_id]->ptrs_symbols, 0, - frame_parms->ofdm_symbol_size, rel15_ul->dmrs_config_type, rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 44652845b8..378f97576b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -400,12 +400,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, k, rnti, nb_rb, - number_of_symbols, ap, K_ptrs, ulsch_ue->ptrs_symbols, start_sc, - frame_parms->ofdm_symbol_size, dmrs_type, ptrs_Uplink_Config->resourceElementOffset); } From b8f77a9c600d99d1bf50c319eb431c6c6efdf419 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Wed, 15 Apr 2020 19:14:14 +0200 Subject: [PATCH 12/26] Fixed PTRS frequency domain allocation - The bug occurs when the PUSCH allocation contains the central RB of the whole UL BW --- openair1/PHY/NR_REFSIG/ptrs_nr.c | 3 --- openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 10 ++++++++-- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 10 ++++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 63f962f426..76783990e7 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -221,9 +221,6 @@ uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t else k_RB_ref = n_rnti % (N_RB % K_ptrs); - if (k < (k_RE_ref + k_RB_ref*NR_NB_SC_PER_RB + start_sc)) - return 0; - if ((k - k_RE_ref - k_RB_ref*NR_NB_SC_PER_RB - start_sc) % (K_ptrs*NR_NB_SC_PER_RB) == 0) return 1; diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index d9f874f988..713bb1bd3b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -230,7 +230,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, nfapi_nr_pusch_pdu_t *pusch_pdu, NR_DL_FRAME_PARMS *frame_parms) { - unsigned short start_re, re, nb_re_pusch; + unsigned short start_re, re, nb_re_pusch, k; unsigned char aarx; uint8_t K_ptrs; uint32_t rxF_ext_index = 0; @@ -285,8 +285,14 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, is_dmrs_re = 0; if ( ((pusch_pdu->pdu_bit_map)>>2)& 0x01 ) { + + if(((start_re + re) % frame_parms->ofdm_symbol_size) < start_re) + k = start_re + re; + else + k = (start_re + re) % frame_parms->ofdm_symbol_size; + is_ptrs_symbol_flag = is_ptrs_symbol(symbol, - (start_re + re)%frame_parms->ofdm_symbol_size, + k, n_rnti, pusch_pdu->rb_size, aarx, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 378f97576b..6fb7867710 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -106,7 +106,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int32_t **txdataF; uint16_t start_sc, start_rb; int8_t Wf[2], Wt[2], l_prime[2], delta; - uint16_t rnti, n_dmrs, code_rate, number_dmrs_symbols, nb_rb, k; + uint16_t rnti, n_dmrs, code_rate, number_dmrs_symbols, nb_rb, k, k_temp; uint8_t dmrs_type, nb_dmrs_re_per_rb, number_of_symbols, mcs, Nl; int ap, start_symbol, Nid_cell, i; int sample_offsetF, N_RE_prime, N_PRB_oh; @@ -396,8 +396,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } if (UE->ptrs_configured == 1){ + + if(k < start_sc) + k_temp = k + frame_parms->ofdm_symbol_size; + else + k_temp = k; + is_ptrs = is_ptrs_symbol(l, - k, + k_temp, rnti, nb_rb, ap, From 15629f126c622958f6ca1e97996e14325915a282 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 16 Apr 2020 13:49:52 +0200 Subject: [PATCH 13/26] Moving get_L_ptrs and get_K_ptrs from PHY to MAC --- executables/nr-ue.c | 13 +++- openair1/PHY/INIT/nr_init_ue.c | 14 ++--- openair1/PHY/NR_REFSIG/ptrs_nr.c | 61 ------------------- openair1/PHY/NR_REFSIG/ptrs_nr.h | 4 -- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 5 +- openair1/SIMULATION/NR_PHY/ulsim.c | 13 +++- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 56 +++++++++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 12 ++++ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 3 + 9 files changed, 102 insertions(+), 79 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 24abc37c3d..44616f0355 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -359,9 +359,9 @@ static void UE_synch(void *arg) { void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { uint32_t rb_size, rb_start; + uint16_t rnti, l_prime_mask, n_rb0, n_rb1; uint8_t nr_of_symbols, start_symbol_index, mcs_index, mcs_table, nrOfLayers, harq_process_id, rv_index, dmrs_config_type; - uint16_t rnti, l_prime_mask; - + uint8_t ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, ptrs_time_density, ptrs_freq_density; nr_dcireq_t dcireq; nr_scheduled_response_t scheduled_response; @@ -394,6 +394,13 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { rv_index = 0; l_prime_mask = get_l_prime(nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); dmrs_config_type = 0; + ptrs_mcs1 = 2; + ptrs_mcs2 = 4; + ptrs_mcs3 = 10; + n_rb0 = 25; + n_rb1 = 75; + ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, mcs_index); + ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, rb_size); //------------------------------------------------------------------------------// scheduled_response.ul_config->slot = 8; @@ -412,6 +419,8 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = rv_index; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nrOfLayers = nrOfLayers; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_process_id; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density; nr_ue_scheduled_response(&scheduled_response); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index c00b5c44c5..28105d86c9 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -658,7 +658,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, fp->nb_antennas_tx = 1; fp->nb_antennas_rx=1; // dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig; - ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; + // ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); phy_init_nr_top(ue); @@ -748,12 +748,12 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ue->ptrs_configured = 0; // flag to be toggled by RCC //------------- config PTRS parameters--------------// - ptrs_Uplink_Config->timeDensity.ptrs_mcs1 = 0; // setting MCS values to 0 indicate abscence of time_density field in the configuration - ptrs_Uplink_Config->timeDensity.ptrs_mcs2 = 0; - ptrs_Uplink_Config->timeDensity.ptrs_mcs3 = 0; - ptrs_Uplink_Config->frequencyDensity.n_rb0 = 0; // setting N_RB values to 0 indicate abscence of frequency_density field in the configuration - ptrs_Uplink_Config->frequencyDensity.n_rb1 = 0; - ptrs_Uplink_Config->resourceElementOffset = 0; + // ptrs_Uplink_Config->timeDensity.ptrs_mcs1 = 2; // setting MCS values to 0 indicate abscence of time_density field in the configuration + // ptrs_Uplink_Config->timeDensity.ptrs_mcs2 = 4; + // ptrs_Uplink_Config->timeDensity.ptrs_mcs3 = 10; + // ptrs_Uplink_Config->frequencyDensity.n_rb0 = 25; // setting N_RB values to 0 indicate abscence of frequency_density field in the configuration + // ptrs_Uplink_Config->frequencyDensity.n_rb1 = 75; + // ptrs_Uplink_Config->resourceElementOffset = 0; //-------------------------------------------------// /////////// diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 76783990e7..cdf61a3b62 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -81,35 +81,7 @@ int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t } -/******************************************************************* -* -* NAME : get_K_ptrs -* -* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration -* N_RB number of RBs scheduled for PUSCH -* -* RETURN : the parameter K_ptrs -* -* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-2 -* -*********************************************************************/ -uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB) { - uint16_t nrb0, nrb1; - nrb0 = ptrs_UplinkConfig->frequencyDensity.n_rb0; - nrb1 = ptrs_UplinkConfig->frequencyDensity.n_rb1; - - if (nrb0 == 0 || nrb0 == 0) - return 2; - - if (N_RB < nrb0) { - LOG_I(PHY,"PUSH PT-RS is not present.\n"); - return 0; - } else if (N_RB >= nrb0 && N_RB < nrb1) - return 2; - else - return 4; -} /******************************************************************* * @@ -162,39 +134,6 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, } } -/******************************************************************* -* -* NAME : get_L_ptrs -* -* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration -* I_mcs MCS index used for PUSCH -* -* RETURN : the parameter L_ptrs -* -* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-1 -* -*********************************************************************/ - -uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs) { - uint8_t mcs1, mcs2, mcs3; - mcs1 = ptrs_UplinkConfig->timeDensity.ptrs_mcs1; - mcs2 = ptrs_UplinkConfig->timeDensity.ptrs_mcs2; - mcs3 = ptrs_UplinkConfig->timeDensity.ptrs_mcs3; - - if (mcs1 == 0 || mcs2 == 0 || mcs3 == 0) - return 1; - - if (I_mcs < mcs1) { - LOG_I(PHY,"PUSH PT-RS is not present.\n"); - return 0; - } else if (I_mcs >= mcs1 && I_mcs < mcs2) - return 4; - else if (I_mcs >= mcs2 && I_mcs < mcs3) - return 2; - else - return 1; -} - /******************************************************************* * * NAME : is_ptrs_subcarrier diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h index a22c80d46c..c4ee337b3d 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.h +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h @@ -49,16 +49,12 @@ int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset); -uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB); - void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t duration_in_symbols, uint8_t start_symbol, uint8_t L_ptrs, uint16_t ul_dmrs_symb_pos); -uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs); - uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc); uint8_t is_ptrs_symbol(uint8_t l, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 6fb7867710..921cc3b819 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -284,9 +284,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (UE->ptrs_configured == 1) { - K_ptrs = get_K_ptrs(ptrs_Uplink_Config, nb_rb); - - L_ptrs = get_L_ptrs(ptrs_Uplink_Config, mcs); + K_ptrs = harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density; + L_ptrs = harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_time_density; beta_ptrs = 1; // temp value until power control is implemented diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index ab4a0b4d0e..d1f4e1cb13 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -501,9 +501,15 @@ int main(int argc, char **argv) uint8_t nb_re_dmrs; unsigned char mod_order; uint16_t code_rate; - + uint8_t ptrs_mcs1 = 2; + uint8_t ptrs_mcs2 = 4; + uint8_t ptrs_mcs3 = 10; + uint16_t n_rb0 = 25; + uint16_t n_rb1 = 75; uint8_t length_dmrs = pusch_len1; // [hna] remove dmrs struct uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct + uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, Imcs); + uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, nb_rb); for (i = 0; i < nb_symb_sch; i++) { number_dmrs_symbols += (l_prime_mask >> i) & 0x01; @@ -568,7 +574,8 @@ int main(int argc, char **argv) pusch_pdu->pusch_data.harq_process_id = 0; pusch_pdu->pusch_data.new_data_indicator = 0; pusch_pdu->pusch_data.num_cb = 0; - + pusch_pdu->pusch_ptrs.ptrs_time_density = ptrs_time_density; + pusch_pdu->pusch_ptrs.ptrs_freq_density = ptrs_freq_density; // --------- setting parameters for UE -------- @@ -596,6 +603,8 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = 0; ul_config.ul_config_list[0].pusch_config_pdu.nrOfLayers = precod_nbr_layers; ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_pid; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density; //there are plenty of other parameters that we don't seem to be using for now. e.g. ul_config.ul_config_list[0].pusch_config_pdu.absolute_delta_PUSCH = 0; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 26a08e9afb..1ced590ba6 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -602,6 +602,62 @@ int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmr return l_prime; } +/******************************************************************* +* +* NAME : get_L_ptrs +* +* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration +* I_mcs MCS index used for PUSCH +* +* RETURN : the parameter L_ptrs +* +* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-1 +* +*********************************************************************/ + +uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs) { + + if (mcs1 == 0 || mcs2 == 0 || mcs3 == 0) + return 1; + + if (I_mcs < mcs1) { + LOG_I(PHY,"PUSH PT-RS is not present.\n"); + return 0; + } else if (I_mcs >= mcs1 && I_mcs < mcs2) + return 4; + else if (I_mcs >= mcs2 && I_mcs < mcs3) + return 2; + else + return 1; +} + +/******************************************************************* +* +* NAME : get_K_ptrs +* +* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration +* N_RB number of RBs scheduled for PUSCH +* +* RETURN : the parameter K_ptrs +* +* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-2 +* +*********************************************************************/ + +uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) { + + if (nrb0 == 0 || nrb0 == 0) + return 2; + + if (N_RB < nrb0) { + LOG_I(PHY,"PUSH PT-RS is not present.\n"); + return 0; + } else if (N_RB >= nrb0 && N_RB < nrb1) + return 2; + else + return 4; +} + uint16_t nr_dci_size(nr_dci_format_t format, nr_rnti_type_t rnti_type, uint16_t N_RB) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 196bd3805b..615e50f9f8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -785,6 +785,18 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, // and for each bit 0: DMRS port not used 1: DMRS port used // -------------------------------------------------------------------------------------------------------------------------------------------- + // -------------------- + // ------- PTRS ------- + // -------------------- + uint8_t ptrs_mcs1 = 2; + uint8_t ptrs_mcs2 = 4; + uint8_t ptrs_mcs3 = 10; + uint16_t n_rb0 = 25; + uint16_t n_rb1 = 75; + pusch_pdu->pusch_ptrs.ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, pusch_pdu->mcs_index); + pusch_pdu->pusch_ptrs.ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, pusch_pdu->rb_size); + // -------------------------------------------------------------------------------------------------------------------------------------------- + //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] //Optional Data only included if indicated in pduBitmap pusch_pdu->pusch_data.rv_index = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 6179335277..74cfe304b8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -165,6 +165,9 @@ int get_num_dmrs(uint16_t dmrs_mask ); uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position); int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength); +uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs); +uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB); + uint16_t nr_dci_size(nr_dci_format_t format, nr_rnti_type_t rnti_type, uint16_t N_RB); From b0611cf49d3fbdd6feaed654b44b17b46e498e21 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 16 Apr 2020 14:34:40 +0200 Subject: [PATCH 14/26] Modifying get_L_ptrs and minor fixes --- executables/nr-ue.c | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 10 +++++-- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 29 ++++++++++++------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 8 ++--- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 +- 6 files changed, 33 insertions(+), 20 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 44616f0355..9085749cca 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -399,7 +399,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { ptrs_mcs3 = 10; n_rb0 = 25; n_rb1 = 75; - ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, mcs_index); + ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, mcs_index, mcs_table); ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, rb_size); //------------------------------------------------------------------------------// diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 921cc3b819..3ff098eebb 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -285,7 +285,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (UE->ptrs_configured == 1) { K_ptrs = harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density; - L_ptrs = harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_time_density; + L_ptrs = 1<pusch_pdu.pusch_ptrs.ptrs_time_density; beta_ptrs = 1; // temp value until power control is implemented diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index d1f4e1cb13..1b0e1c9f67 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -506,11 +506,15 @@ int main(int argc, char **argv) uint8_t ptrs_mcs3 = 10; uint16_t n_rb0 = 25; uint16_t n_rb1 = 75; + uint8_t mcs_table = 0; + uint8_t length_dmrs = pusch_len1; // [hna] remove dmrs struct uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct - uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, Imcs); + uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, Imcs, mcs_table); uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, nb_rb); + printf("time_density = %d\n", ptrs_time_density); + printf("freq_density = %d\n", ptrs_freq_density); for (i = 0; i < nb_symb_sch; i++) { number_dmrs_symbols += (l_prime_mask >> i) & 0x01; } @@ -552,7 +556,7 @@ int main(int argc, char **argv) pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; pusch_pdu->rnti = n_rnti; pusch_pdu->mcs_index = Imcs; - pusch_pdu->mcs_table = 0; + pusch_pdu->mcs_table = mcs_table; pusch_pdu->target_code_rate = code_rate; pusch_pdu->qam_mod_order = mod_order; pusch_pdu->transform_precoding = 0; @@ -598,7 +602,7 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask; ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type = 0; ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs; - ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = 0; + ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table; ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0; ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = 0; ul_config.ul_config_list[0].pusch_config_pdu.nrOfLayers = precod_nbr_layers; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 1ced590ba6..cf32f072c7 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -606,29 +606,38 @@ int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmr * * NAME : get_L_ptrs * -* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration +* PARAMETERS : mcs(i) higher layer parameter in PTRS-UplinkConfig * I_mcs MCS index used for PUSCH +* mcs_table 0 for table 5.1.3.1-1, 1 for table 5.1.3.1-1 * * RETURN : the parameter L_ptrs * -* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-1 +* DESCRIPTION : 3GPP TS 38.214 section 6.2.3.1 * *********************************************************************/ -uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs) { +uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table) { - if (mcs1 == 0 || mcs2 == 0 || mcs3 == 0) - return 1; + uint8_t mcs4; + + if(mcs_table == 0) + mcs4 = 29; + else + mcs4 = 28; if (I_mcs < mcs1) { - LOG_I(PHY,"PUSH PT-RS is not present.\n"); - return 0; + LOG_I(PHY, "PUSH PT-RS is not present.\n"); + return -1; } else if (I_mcs >= mcs1 && I_mcs < mcs2) - return 4; - else if (I_mcs >= mcs2 && I_mcs < mcs3) return 2; - else + else if (I_mcs >= mcs2 && I_mcs < mcs3) return 1; + else if (I_mcs >= mcs3 && I_mcs < mcs4) + return 0; + else { + LOG_I(PHY, "PT-RS time-density determination is obtained from the DCI for the same transport block in the initial transmission\n"); + return -1; + } } /******************************************************************* diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 615e50f9f8..c4bfd3c1df 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -788,12 +788,12 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, // -------------------- // ------- PTRS ------- // -------------------- - uint8_t ptrs_mcs1 = 2; - uint8_t ptrs_mcs2 = 4; - uint8_t ptrs_mcs3 = 10; + uint8_t ptrs_mcs1 = 2; // higher layer parameter in PTRS-UplinkConfig + uint8_t ptrs_mcs2 = 4; // higher layer parameter in PTRS-UplinkConfig + uint8_t ptrs_mcs3 = 10; // higher layer parameter in PTRS-UplinkConfig uint16_t n_rb0 = 25; uint16_t n_rb1 = 75; - pusch_pdu->pusch_ptrs.ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, pusch_pdu->mcs_index); + pusch_pdu->pusch_ptrs.ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, pusch_pdu->mcs_index, pusch_pdu->mcs_table); pusch_pdu->pusch_ptrs.ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, pusch_pdu->rb_size); // -------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 74cfe304b8..b18a155f59 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -165,7 +165,7 @@ int get_num_dmrs(uint16_t dmrs_mask ); uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position); int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength); -uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs); +uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table); uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB); uint16_t nr_dci_size(nr_dci_format_t format, From 870845fc9df13920538d7f7bcc5c55439d21bafe Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 16 Apr 2020 14:50:11 +0200 Subject: [PATCH 15/26] Minor fixes and modifications for get_K_ptrs --- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 9 +++------ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 3ff098eebb..790a2622e1 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -284,7 +284,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (UE->ptrs_configured == 1) { - K_ptrs = harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density; + K_ptrs = (harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density)?4:2; L_ptrs = 1<pusch_pdu.pusch_ptrs.ptrs_time_density; beta_ptrs = 1; // temp value until power control is implemented diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index cf32f072c7..cfde40daad 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -655,16 +655,13 @@ uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) { - if (nrb0 == 0 || nrb0 == 0) - return 2; - if (N_RB < nrb0) { LOG_I(PHY,"PUSH PT-RS is not present.\n"); - return 0; + return -1; } else if (N_RB >= nrb0 && N_RB < nrb1) - return 2; + return 0; else - return 4; + return 1; } uint16_t nr_dci_size(nr_dci_format_t format, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index c4bfd3c1df..0ed070ac11 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -791,8 +791,8 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, uint8_t ptrs_mcs1 = 2; // higher layer parameter in PTRS-UplinkConfig uint8_t ptrs_mcs2 = 4; // higher layer parameter in PTRS-UplinkConfig uint8_t ptrs_mcs3 = 10; // higher layer parameter in PTRS-UplinkConfig - uint16_t n_rb0 = 25; - uint16_t n_rb1 = 75; + uint16_t n_rb0 = 25; // higher layer parameter in PTRS-UplinkConfig + uint16_t n_rb1 = 75; // higher layer parameter in PTRS-UplinkConfig pusch_pdu->pusch_ptrs.ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, pusch_pdu->mcs_index, pusch_pdu->mcs_table); pusch_pdu->pusch_ptrs.ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, pusch_pdu->rb_size); // -------------------------------------------------------------------------------------------------------------------------------------------- From 6adc40bbd1800e4472087d530a53c794b44e4585 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 16 Apr 2020 15:58:50 +0200 Subject: [PATCH 16/26] Removed "ptrs_configured" and using "pusch_pdu->pdu_bit_map" instead at UE side --- openair1/PHY/INIT/nr_init_ue.c | 2 -- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 4 ++-- openair1/PHY/defs_nr_UE.h | 3 --- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 28105d86c9..e2fd451f6e 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -745,8 +745,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, /////////////////////////PUSCH PTRS init///////////////////////// /////////// - ue->ptrs_configured = 0; // flag to be toggled by RCC - //------------- config PTRS parameters--------------// // ptrs_Uplink_Config->timeDensity.ptrs_mcs1 = 2; // setting MCS values to 0 indicate abscence of time_density field in the configuration // ptrs_Uplink_Config->timeDensity.ptrs_mcs2 = 4; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 790a2622e1..160a8a4c67 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -282,7 +282,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int16_t mod_ptrs[(nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation K_ptrs = 0; // just to avoid a warning - if (UE->ptrs_configured == 1) { + if ((harq_process_ul_ue->pusch_pdu.pdu_bit_map >> 2) & 0x01) { K_ptrs = (harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density)?4:2; L_ptrs = 1<pusch_pdu.pusch_ptrs.ptrs_time_density; @@ -394,7 +394,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, is_dmrs = 1; } - if (UE->ptrs_configured == 1){ + if ((harq_process_ul_ue->pusch_pdu.pdu_bit_map >> 2) & 0x01){ if(k < start_sc) k_temp = k + frame_parms->ofdm_symbol_size; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 6f6c5ac8e9..b2d6a75265 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -954,9 +954,6 @@ typedef struct { /// PUSCH DMRS sequence uint32_t ****nr_gold_pusch_dmrs; - /// flag to indicate if PTRS is configured - uint8_t ptrs_configured; - uint32_t X_u[64][839]; uint32_t high_speed_flag; From eae301e5d843526fbb81c44302a59e2021dba65d Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 16 Apr 2020 16:44:00 +0200 Subject: [PATCH 17/26] Fix regarding PTRS frequeny domain allocation --- openair1/PHY/NR_REFSIG/ptrs_nr.c | 10 +++++++--- openair1/PHY/NR_REFSIG/ptrs_nr.h | 5 +++-- openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 15 ++++++--------- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 12 ++++-------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index cdf61a3b62..88a44ae139 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -151,7 +151,7 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, * *********************************************************************/ -uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc) { +uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size) { uint16_t k_RB_ref; @@ -160,6 +160,9 @@ uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t else k_RB_ref = n_rnti % (N_RB % K_ptrs); + if (k < start_sc) + k += ofdm_symbol_size; + if ((k - k_RE_ref - k_RB_ref*NR_NB_SC_PER_RB - start_sc) % (K_ptrs*NR_NB_SC_PER_RB) == 0) return 1; @@ -196,10 +199,11 @@ uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols, uint16_t start_sc, uint8_t pusch_dmrs_type, - uint8_t resourceElementOffset) + uint8_t resourceElementOffset, + uint16_t ofdm_symbol_size) { int16_t k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); - uint8_t is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc); + uint8_t is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size); if (is_ptrs_freq == 0) return 0; diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h index c4ee337b3d..40d22e6733 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.h +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h @@ -55,7 +55,7 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t L_ptrs, uint16_t ul_dmrs_symb_pos); -uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc); +uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size); uint8_t is_ptrs_symbol(uint8_t l, uint16_t k, @@ -66,7 +66,8 @@ uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols, uint16_t start_sc, uint8_t pusch_dmrs_type, - uint8_t resourceElementOffset); + uint8_t resourceElementOffset, + uint16_t ofdm_symbol_size); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 713bb1bd3b..acfbc7d49f 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -230,7 +230,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, nfapi_nr_pusch_pdu_t *pusch_pdu, NR_DL_FRAME_PARMS *frame_parms) { - unsigned short start_re, re, nb_re_pusch, k; + unsigned short start_re, re, nb_re_pusch; unsigned char aarx; uint8_t K_ptrs; uint32_t rxF_ext_index = 0; @@ -286,13 +286,8 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, if ( ((pusch_pdu->pdu_bit_map)>>2)& 0x01 ) { - if(((start_re + re) % frame_parms->ofdm_symbol_size) < start_re) - k = start_re + re; - else - k = (start_re + re) % frame_parms->ofdm_symbol_size; - is_ptrs_symbol_flag = is_ptrs_symbol(symbol, - k, + (start_re + re) % frame_parms->ofdm_symbol_size, n_rnti, pusch_pdu->rb_size, aarx, @@ -300,7 +295,8 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, pusch_vars->ptrs_symbols, start_re, pusch_pdu->dmrs_config_type, - pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset); + pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, + frame_parms->ofdm_symbol_size); if (is_ptrs_symbol_flag == 1) num_ptrs_symbols++; @@ -1082,7 +1078,8 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, gNB->pusch_vars[UE_id]->ptrs_symbols, 0, rel15_ul->dmrs_config_type, - rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset); + rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, + frame_parms->ofdm_symbol_size); } if (ptrs_symbol_flag == 1){ diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 160a8a4c67..3035e39201 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -106,7 +106,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int32_t **txdataF; uint16_t start_sc, start_rb; int8_t Wf[2], Wt[2], l_prime[2], delta; - uint16_t rnti, n_dmrs, code_rate, number_dmrs_symbols, nb_rb, k, k_temp; + uint16_t rnti, n_dmrs, code_rate, number_dmrs_symbols, nb_rb, k; uint8_t dmrs_type, nb_dmrs_re_per_rb, number_of_symbols, mcs, Nl; int ap, start_symbol, Nid_cell, i; int sample_offsetF, N_RE_prime, N_PRB_oh; @@ -396,13 +396,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if ((harq_process_ul_ue->pusch_pdu.pdu_bit_map >> 2) & 0x01){ - if(k < start_sc) - k_temp = k + frame_parms->ofdm_symbol_size; - else - k_temp = k; - is_ptrs = is_ptrs_symbol(l, - k_temp, + k, rnti, nb_rb, ap, @@ -410,7 +405,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ulsch_ue->ptrs_symbols, start_sc, dmrs_type, - ptrs_Uplink_Config->resourceElementOffset); + ptrs_Uplink_Config->resourceElementOffset, + frame_parms->ofdm_symbol_size); } if (is_dmrs == 1) { From f8c0de63cdcf3aa486d0b735e5ad92c2257f5a60 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 16 Apr 2020 18:02:59 +0200 Subject: [PATCH 18/26] Using "ptrs_re_offset" at UE side instead of using the function "get_kRE_ref" (TEMP implementation) --- executables/nr-ue.c | 2 ++ openair1/PHY/NR_REFSIG/ptrs_nr.c | 4 ++-- openair1/PHY/NR_REFSIG/ptrs_nr.h | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 4 ++-- openair1/SIMULATION/NR_PHY/ulsim.c | 4 ++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 2 ++ 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 9085749cca..c3d25996d9 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -421,6 +421,8 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_process_id; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t)); + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; nr_ue_scheduled_response(&scheduled_response); diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 88a44ae139..41ab2a2f46 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -199,10 +199,10 @@ uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols, uint16_t start_sc, uint8_t pusch_dmrs_type, - uint8_t resourceElementOffset, + uint8_t k_RE_ref, uint16_t ofdm_symbol_size) { - int16_t k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); + // int16_t k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); uint8_t is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size); if (is_ptrs_freq == 0) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h index 40d22e6733..b37b9401f5 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.h +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h @@ -66,7 +66,7 @@ uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols, uint16_t start_sc, uint8_t pusch_dmrs_type, - uint8_t resourceElementOffset, + uint8_t k_RE_ref, uint16_t ofdm_symbol_size); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 3035e39201..84ba18b2b8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -120,7 +120,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms; NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id]; uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES]; - ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; + // ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; num_of_codewords = 1; // tmp assumption Nid_cell = 0; @@ -405,7 +405,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ulsch_ue->ptrs_symbols, start_sc, dmrs_type, - ptrs_Uplink_Config->resourceElementOffset, + harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, frame_parms->ofdm_symbol_size); } diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 1b0e1c9f67..366692b991 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -580,6 +580,8 @@ int main(int argc, char **argv) pusch_pdu->pusch_data.num_cb = 0; pusch_pdu->pusch_ptrs.ptrs_time_density = ptrs_time_density; pusch_pdu->pusch_ptrs.ptrs_freq_density = ptrs_freq_density; + pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); + pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; // --------- setting parameters for UE -------- @@ -609,6 +611,8 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_pid; ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density; ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t)); + ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; //there are plenty of other parameters that we don't seem to be using for now. e.g. ul_config.ul_config_list[0].pusch_config_pdu.absolute_delta_PUSCH = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 0ed070ac11..fad28c2166 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -795,6 +795,8 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, uint16_t n_rb1 = 75; // higher layer parameter in PTRS-UplinkConfig pusch_pdu->pusch_ptrs.ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, pusch_pdu->mcs_index, pusch_pdu->mcs_table); pusch_pdu->pusch_ptrs.ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, pusch_pdu->rb_size); + pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); + pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; // -------------------------------------------------------------------------------------------------------------------------------------------- //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] From 9b52bf29ca78e4fc9004411469d21ffd61271629 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 16 Apr 2020 19:21:35 +0200 Subject: [PATCH 19/26] Separating "is_ptrs_subcarrier" from "is_ptrs_symbol" --- openair1/PHY/NR_REFSIG/ptrs_nr.c | 45 +++++++------------ openair1/PHY/NR_REFSIG/ptrs_nr.h | 22 +++++---- .../PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 42 ++++++----------- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 21 +++++---- 4 files changed, 50 insertions(+), 80 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 41ab2a2f46..26cc323f4f 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -139,11 +139,14 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, * NAME : is_ptrs_subcarrier * * PARAMETERS : k subcarrier index -* K_ptrs the parameter K_ptrs * n_rnti UE CRNTI +* dmrs_antenna_port DMRS antenna port +* K_ptrs the parameter K_ptrs +* pusch_dmrs_type the DMRS configuration type used for PUSCH * N_RB number of RBs scheduled for PUSCH * k_RE_ref the parameter k_RE_ref * start_sc first subcarrier index +* ofdm_symbol_size number of samples in an OFDM symbol * * RETURN : 1 if subcarrier k is PTRS, or 0 otherwise * @@ -151,8 +154,17 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, * *********************************************************************/ -uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size) { - +uint8_t is_ptrs_subcarrier(uint16_t k, + uint16_t n_rnti, + uint8_t dmrs_antenna_port, + uint8_t pusch_dmrs_type, + uint8_t K_ptrs, + uint16_t N_RB, + uint8_t k_RE_ref, + uint16_t start_sc, + uint16_t ofdm_symbol_size) +{ + // int16_t k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); uint16_t k_RB_ref; if (N_RB % K_ptrs == 0) @@ -174,39 +186,16 @@ uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t * NAME : is_ptrs_symbol * * PARAMETERS : l ofdm symbol index within slot -* k subcarrier index -* n_rnti UE CRNTI -* N_RB number of RBs scheduled for PUSCH -* dmrs_antenna_port DMRS antenna port -* K_ptrs the parameter K_ptrs * ptrs_symbols bit mask of ptrs -* start_sc first subcarrier index -* pusch_dmrs_type PUSCH DMRS type (1 or 2) -* ptrs_UplinkConfig PTRS uplink configuration * -* RETURN : 0 if symbol(k,l) is data, or 1 if symbol(k,l) is ptrs +* RETURN : 1 if symbol is ptrs, or 0 otherwise * * DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH * *********************************************************************/ -uint8_t is_ptrs_symbol(uint8_t l, - uint16_t k, - uint16_t n_rnti, - uint16_t N_RB, - uint8_t dmrs_antenna_port, - uint8_t K_ptrs, - uint16_t ptrs_symbols, - uint16_t start_sc, - uint8_t pusch_dmrs_type, - uint8_t k_RE_ref, - uint16_t ofdm_symbol_size) +uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols) { - // int16_t k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); - uint8_t is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size); - - if (is_ptrs_freq == 0) - return 0; if (((ptrs_symbols>>l)&1) == 1) return 1; diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h index b37b9401f5..b2fa1274a8 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.h +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h @@ -55,19 +55,17 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t L_ptrs, uint16_t ul_dmrs_symb_pos); -uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size); +uint8_t is_ptrs_subcarrier(uint16_t k, + uint16_t n_rnti, + uint8_t dmrs_antenna_port, + uint8_t pusch_dmrs_type, + uint8_t K_ptrs, + uint16_t N_RB, + uint8_t k_RE_ref, + uint16_t start_sc, + uint16_t ofdm_symbol_size); -uint8_t is_ptrs_symbol(uint8_t l, - uint16_t k, - uint16_t n_rnti, - uint16_t N_RB, - uint8_t dmrs_antenna_port, - uint8_t K_ptrs, - uint16_t ptrs_symbols, - uint16_t start_sc, - uint8_t pusch_dmrs_type, - uint8_t k_RE_ref, - uint16_t ofdm_symbol_size); +uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index acfbc7d49f..e484cb960d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -285,18 +285,16 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, is_dmrs_re = 0; if ( ((pusch_pdu->pdu_bit_map)>>2)& 0x01 ) { - - is_ptrs_symbol_flag = is_ptrs_symbol(symbol, - (start_re + re) % frame_parms->ofdm_symbol_size, - n_rnti, - pusch_pdu->rb_size, - aarx, - K_ptrs, - pusch_vars->ptrs_symbols, - start_re, - pusch_pdu->dmrs_config_type, - pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, - frame_parms->ofdm_symbol_size); + if(is_ptrs_symbol(symbol, pusch_vars->ptrs_symbols)) + is_ptrs_symbol_flag = is_ptrs_subcarrier((start_re + re) % frame_parms->ofdm_symbol_size, + n_rnti, + aarx, + pusch_pdu->dmrs_config_type, + K_ptrs, + pusch_pdu->rb_size, + pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, + start_re, + frame_parms->ofdm_symbol_size); if (is_ptrs_symbol_flag == 1) num_ptrs_symbols++; @@ -1026,7 +1024,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, unsigned char harq_pid) { - uint8_t first_symbol_flag, aarx, aatx, dmrs_symbol_flag, ptrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol + uint8_t first_symbol_flag, aarx, aatx, dmrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol uint32_t nb_re_pusch, bwp_start_subcarrier; uint8_t L_ptrs = 0; // PTRS parameter int avgs; @@ -1035,7 +1033,6 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->ulsch_pdu; dmrs_symbol_flag = 0; - ptrs_symbol_flag = 0; first_symbol_flag = 0; gNB->pusch_vars[UE_id]->ptrs_sc_per_ofdm_symbol = 0; @@ -1069,21 +1066,8 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, } if ( ((rel15_ul->pdu_bit_map)>>2)& 0x01 ) { // if there is ptrs pdu - ptrs_symbol_flag = is_ptrs_symbol(symbol, - 0, - rel15_ul->rnti, - rel15_ul->rb_size, - 0, - (rel15_ul->pusch_ptrs.ptrs_freq_density)?4:2, - gNB->pusch_vars[UE_id]->ptrs_symbols, - 0, - rel15_ul->dmrs_config_type, - rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, - frame_parms->ofdm_symbol_size); - } - - if (ptrs_symbol_flag == 1){ - gNB->pusch_vars[UE_id]->ptrs_symbol_index = symbol; + if(is_ptrs_symbol(symbol, gNB->pusch_vars[UE_id]->ptrs_symbols)) + gNB->pusch_vars[UE_id]->ptrs_symbol_index = symbol; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 84ba18b2b8..d576aaf55a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -396,17 +396,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if ((harq_process_ul_ue->pusch_pdu.pdu_bit_map >> 2) & 0x01){ - is_ptrs = is_ptrs_symbol(l, - k, - rnti, - nb_rb, - ap, - K_ptrs, - ulsch_ue->ptrs_symbols, - start_sc, - dmrs_type, - harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, - frame_parms->ofdm_symbol_size); + if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) + is_ptrs = is_ptrs_subcarrier(k, + rnti, + ap, + dmrs_type, + K_ptrs, + nb_rb, + harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, + start_sc, + frame_parms->ofdm_symbol_size); } if (is_dmrs == 1) { From 728a9033698c4c73d49abf029b4a799a2d525cc5 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 16 Apr 2020 19:30:52 +0200 Subject: [PATCH 20/26] Making "is_ptrs_symbol" as a static inline function --- openair1/PHY/NR_REFSIG/ptrs_nr.c | 22 ---------------------- openair1/PHY/NR_REFSIG/ptrs_nr.h | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 26cc323f4f..785252126a 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -181,28 +181,6 @@ uint8_t is_ptrs_subcarrier(uint16_t k, return 0; } -/******************************************************************* -* -* NAME : is_ptrs_symbol -* -* PARAMETERS : l ofdm symbol index within slot -* ptrs_symbols bit mask of ptrs -* -* RETURN : 1 if symbol is ptrs, or 0 otherwise -* -* DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH -* -*********************************************************************/ - -uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols) -{ - - if (((ptrs_symbols>>l)&1) == 1) - return 1; - - return 0; -} - /* int main(int argc, char const *argv[]) { diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h index b2fa1274a8..e8a4e61232 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.h +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h @@ -65,7 +65,20 @@ uint8_t is_ptrs_subcarrier(uint16_t k, uint16_t start_sc, uint16_t ofdm_symbol_size); -uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols); +/******************************************************************* +* +* NAME : is_ptrs_symbol +* +* PARAMETERS : l ofdm symbol index within slot +* ptrs_symbols bit mask of ptrs +* +* RETURN : 1 if symbol is ptrs, or 0 otherwise +* +* DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH +* +*********************************************************************/ + +static inline uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols) { return ((ptrs_symbols >> l) & 1); } From 68ba04abf8db3c9909f5ade4c0c29e37cf2181d0 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 16 Apr 2020 21:15:19 +0200 Subject: [PATCH 21/26] Adding an extra condition for L_ptrs - if L_ptrs is >= number of pusch symbols, then no ptrs will be scheduled --- executables/nr-ue.c | 5 +++++ openair1/SIMULATION/NR_PHY/ulsim.c | 9 ++++++--- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index c3d25996d9..23ee386f59 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -424,6 +424,11 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t)); scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; + if(1<= nr_of_symbols) { + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map = + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map & 0xFFFB; + } + nr_ue_scheduled_response(&scheduled_response); if (UE->mode != loop_through_memory) { diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 366692b991..4da10c1c1c 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -507,14 +507,16 @@ int main(int argc, char **argv) uint16_t n_rb0 = 25; uint16_t n_rb1 = 75; uint8_t mcs_table = 0; + uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA | PUSCH_PDU_BITMAP_PUSCH_PTRS; uint8_t length_dmrs = pusch_len1; // [hna] remove dmrs struct uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, Imcs, mcs_table); uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, nb_rb); - printf("time_density = %d\n", ptrs_time_density); - printf("freq_density = %d\n", ptrs_freq_density); + if(1<= nb_symb_sch) + pdu_bit_map = pdu_bit_map & 0xFFFB; + for (i = 0; i < nb_symb_sch; i++) { number_dmrs_symbols += (l_prime_mask >> i) & 0x01; } @@ -553,7 +555,7 @@ int main(int argc, char **argv) UL_tti_req->pdus_list[0].pdu_size = sizeof(nfapi_nr_pusch_pdu_t); memset(pusch_pdu,0,sizeof(nfapi_nr_pusch_pdu_t)); - pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; + pusch_pdu->pdu_bit_map = pdu_bit_map; pusch_pdu->rnti = n_rnti; pusch_pdu->mcs_index = Imcs; pusch_pdu->mcs_table = mcs_table; @@ -597,6 +599,7 @@ int main(int argc, char **argv) ul_config.number_pdus = 1; ul_config.ul_config_list[0].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; ul_config.ul_config_list[0].pusch_config_pdu.rnti = n_rnti; + ul_config.ul_config_list[0].pusch_config_pdu.pdu_bit_map = pdu_bit_map; ul_config.ul_config_list[0].pusch_config_pdu.rb_size = nb_rb; ul_config.ul_config_list[0].pusch_config_pdu.rb_start = start_rb; ul_config.ul_config_list[0].pusch_config_pdu.nr_of_symbols = nb_symb_sch; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index fad28c2166..9122a06099 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -797,6 +797,9 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, pusch_pdu->pusch_ptrs.ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, pusch_pdu->rb_size); pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; + + if(1<pusch_ptrs.ptrs_time_density >= pusch_pdu->nr_of_symbols) + pusch_pdu->pdu_bit_map = pusch_pdu->pdu_bit_map & 0xFFFB; // -------------------------------------------------------------------------------------------------------------------------------------------- //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] From 2a0bfde4a03deca42a935a760d1e5e8414e74565 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 17 Apr 2020 10:11:32 +0200 Subject: [PATCH 22/26] use "PUSCH_PDU_BITMAP_PUSCH_PTRS" when setting, clearing or checking pdu_bit_map --- executables/nr-ue.c | 5 ++--- openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 6 +++--- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 4 ++-- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 23ee386f59..648e77e53e 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -424,9 +424,8 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t)); scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; - if(1<= nr_of_symbols) { - scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map = - scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map & 0xFFFB; + if (1 << ptrs_time_density >= nr_of_symbols) { + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS } nr_ue_scheduled_response(&scheduled_response); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index e484cb960d..713bcc4d8f 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -284,7 +284,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, else is_dmrs_re = 0; - if ( ((pusch_pdu->pdu_bit_map)>>2)& 0x01 ) { + if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { if(is_ptrs_symbol(symbol, pusch_vars->ptrs_symbols)) is_ptrs_symbol_flag = is_ptrs_subcarrier((start_re + re) % frame_parms->ofdm_symbol_size, n_rnti, @@ -1043,7 +1043,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, gNB->pusch_vars[UE_id]->ptrs_symbols = 0; first_symbol_flag = 1; - if ( ((rel15_ul->pdu_bit_map)>>2)& 0x01 ) { // if there is ptrs pdu + if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { // if there is ptrs pdu L_ptrs = 1<<(rel15_ul->pusch_ptrs.ptrs_time_density); set_ptrs_symb_idx(&gNB->pusch_vars[UE_id]->ptrs_symbols, @@ -1065,7 +1065,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB; } - if ( ((rel15_ul->pdu_bit_map)>>2)& 0x01 ) { // if there is ptrs pdu + if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { // if there is ptrs pdu if(is_ptrs_symbol(symbol, gNB->pusch_vars[UE_id]->ptrs_symbols)) gNB->pusch_vars[UE_id]->ptrs_symbol_index = symbol; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index d576aaf55a..266f398128 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -282,7 +282,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int16_t mod_ptrs[(nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation K_ptrs = 0; // just to avoid a warning - if ((harq_process_ul_ue->pusch_pdu.pdu_bit_map >> 2) & 0x01) { + if (harq_process_ul_ue->pusch_pdu.pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { K_ptrs = (harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density)?4:2; L_ptrs = 1<pusch_pdu.pusch_ptrs.ptrs_time_density; @@ -394,7 +394,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, is_dmrs = 1; } - if ((harq_process_ul_ue->pusch_pdu.pdu_bit_map >> 2) & 0x01){ + if (harq_process_ul_ue->pusch_pdu.pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS){ if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) is_ptrs = is_ptrs_subcarrier(k, diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 4da10c1c1c..5cfdd93206 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -515,7 +515,7 @@ int main(int argc, char **argv) uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, nb_rb); if(1<= nb_symb_sch) - pdu_bit_map = pdu_bit_map & 0xFFFB; + pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS for (i = 0; i < nb_symb_sch; i++) { number_dmrs_symbols += (l_prime_mask >> i) & 0x01; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 9122a06099..f657a1ccb5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -799,7 +799,7 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; if(1<pusch_ptrs.ptrs_time_density >= pusch_pdu->nr_of_symbols) - pusch_pdu->pdu_bit_map = pusch_pdu->pdu_bit_map & 0xFFFB; + pusch_pdu->pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS // -------------------------------------------------------------------------------------------------------------------------------------------- //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] From 42413bc56514de25ced0a57fa5715b3c66025000 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 17 Apr 2020 15:59:05 +0200 Subject: [PATCH 23/26] disable PUSCH PTRS even in ulsim PTRS leads to code shortening, and the current LDPC implementation has issues with that for higher code rate. Because of this, we have to disable PTRS by default, as we test MCS 28 in CI. --- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 5cfdd93206..72e4126805 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -507,7 +507,7 @@ int main(int argc, char **argv) uint16_t n_rb0 = 25; uint16_t n_rb1 = 75; uint8_t mcs_table = 0; - uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA | PUSCH_PDU_BITMAP_PUSCH_PTRS; + uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; // | PUSCH_PDU_BITMAP_PUSCH_PTRS; uint8_t length_dmrs = pusch_len1; // [hna] remove dmrs struct uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct From 1ffa9eed64d1169082076fd7543aeb2c3450fa98 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Wed, 6 May 2020 16:15:30 +0200 Subject: [PATCH 24/26] Bug fix regarding the uplink dmrs symbol position bitmask --- executables/nr-ue.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 4 ++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 648e77e53e..ec7b98332e 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -411,7 +411,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rb_start = rb_start; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nr_of_symbols = nr_of_symbols; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol_index; - scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask << start_symbol_index; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_index = mcs_index; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 0bf814b83f..abfd2c77c4 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -583,7 +583,7 @@ int main(int argc, char **argv) pusch_pdu->transform_precoding = 0; pusch_pdu->data_scrambling_id = 0; pusch_pdu->nrOfLayers = 1; - pusch_pdu->ul_dmrs_symb_pos = l_prime_mask; + pusch_pdu->ul_dmrs_symb_pos = l_prime_mask << start_symbol; pusch_pdu->dmrs_config_type = 0; pusch_pdu->ul_dmrs_scrambling_id = 0; pusch_pdu->scid = 0; @@ -623,7 +623,7 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].pusch_config_pdu.rb_start = start_rb; ul_config.ul_config_list[0].pusch_config_pdu.nr_of_symbols = nb_symb_sch; ul_config.ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol; - ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask; + ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask << start_symbol; ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type = 0; ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs; ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 6d027431e2..6ca8fb9ed2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -773,7 +773,7 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, // ------- DMRS ------- // -------------------- uint16_t l_prime_mask = get_l_prime(pusch_pdu->nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); - pusch_pdu->ul_dmrs_symb_pos = l_prime_mask; + pusch_pdu->ul_dmrs_symb_pos = l_prime_mask << pusch_pdu->start_symbol_index; pusch_pdu->dmrs_config_type = 0; // dmrs-type 1 (the one with a single DMRS symbol in the beginning) pusch_pdu->ul_dmrs_scrambling_id = 0; // If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id pusch_pdu->scid = 0; // DMRS sequence initialization [TS38.211, sec 6.4.1.1.1] From 566de5670be7e3e7f80aba8632f5d29f34179664 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Thu, 14 May 2020 16:18:53 +0200 Subject: [PATCH 25/26] Bug fixes regarding ping issues --- executables/nr-ue.c | 4 +++- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 16 ++++------------ openair1/SIMULATION/NR_PHY/ulsim.c | 8 ++++---- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 2 +- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index ec7b98332e..26e42f6f40 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -359,7 +359,7 @@ static void UE_synch(void *arg) { void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { uint32_t rb_size, rb_start; - uint16_t rnti, l_prime_mask, n_rb0, n_rb1; + uint16_t rnti, l_prime_mask, n_rb0, n_rb1, pdu_bit_map; uint8_t nr_of_symbols, start_symbol_index, mcs_index, mcs_table, nrOfLayers, harq_process_id, rv_index, dmrs_config_type; uint8_t ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, ptrs_time_density, ptrs_freq_density; nr_dcireq_t dcireq; @@ -399,6 +399,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { ptrs_mcs3 = 10; n_rb0 = 25; n_rb1 = 75; + pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, mcs_index, mcs_table); ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, rb_size); //------------------------------------------------------------------------------// @@ -419,6 +420,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = rv_index; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nrOfLayers = nrOfLayers; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_process_id; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map = pdu_bit_map; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density; scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t)); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 266f398128..cd18b7bea4 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -126,7 +126,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, Nid_cell = 0; N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig number_dmrs_symbols = 0; - uint8_t mapping_type = UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) { @@ -140,7 +139,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, for (i = start_symbol; i < start_symbol + number_of_symbols; i++) { - if((ul_dmrs_symb_pos >> (mapping_type ? (i - start_symbol) : i)) & 0x01) + if((ul_dmrs_symb_pos >> i) & 0x01) number_dmrs_symbols += 1; } @@ -230,12 +229,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////ULSCH scrambling///////////////////////// /////////// - available_bits = nr_get_G(nb_rb, - number_of_symbols, - nb_dmrs_re_per_rb, - number_dmrs_symbols, - mod_order, - 1); + available_bits = G; memset(scrambled_output[cwd_index], 0, ((available_bits>>5)+1)*sizeof(uint32_t)); @@ -326,7 +320,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, for (l = start_symbol; l < start_symbol + number_of_symbols; l++) { - if((ul_dmrs_symb_pos >> ((mapping_type)?l-start_symbol:l)) & 0x01) + if((ul_dmrs_symb_pos >> l) & 0x01) is_dmrs = 1; else is_dmrs = 0; @@ -372,7 +366,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t k_prime=0; uint8_t is_dmrs, is_ptrs; - uint8_t l_ref; uint16_t m=0, n=0, dmrs_idx=0, ptrs_idx = 0; for (l=start_symbol; l> l_ref) & 0x01) { + if((ul_dmrs_symb_pos >> l) & 0x01) { if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size)) is_dmrs = 1; } diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index abfd2c77c4..895c2c055b 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -129,7 +129,7 @@ int main(int argc, char **argv) int loglvl = OAILOG_WARNING; uint64_t SSB_positions=0x01; uint16_t nb_symb_sch = 12; - int start_symbol = 0; + int start_symbol = 2; uint16_t nb_rb = 50; uint8_t Imcs = 9; uint8_t precod_nbr_layers = 1; @@ -638,9 +638,9 @@ int main(int argc, char **argv) //there are plenty of other parameters that we don't seem to be using for now. e.g. ul_config.ul_config_list[0].pusch_config_pdu.absolute_delta_PUSCH = 0; - nb_re_dmrs = ((ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type == pusch_dmrs_type1) ? 6 : 4) * number_dmrs_symbols; - available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1); - TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, precod_nbr_layers); + nb_re_dmrs = ((ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type == pusch_dmrs_type1) ? 6 : 4); + available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, number_dmrs_symbols, mod_order, 1); + TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs * number_dmrs_symbols, 0, precod_nbr_layers); pusch_pdu->pusch_data.tb_size = TBS>>3; ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.tb_size = TBS; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 6ca8fb9ed2..dd08143d4d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -810,7 +810,7 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, pusch_pdu->target_code_rate, pusch_pdu->rb_size, pusch_pdu->nr_of_symbols, - 6, //nb_re_dmrs - not sure where this is coming from - its not in the FAPI + pusch_pdu->dmrs_config_type?4:6, //nb_re_dmrs - not sure where this is coming from - its not in the FAPI 0, //nb_rb_oh pusch_pdu->nrOfLayers)>>3; pusch_pdu->pusch_data.num_cb = 0; //CBG not supported From 7fc9ab7720bdd7ba5a9019ce56dc7303fd2524b1 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 14 May 2020 18:38:08 +0200 Subject: [PATCH 26/26] use NR_UE_sched_ctrl_t instead of UE_sched_ctrl_t in gNB_scheduler --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 5 ++--- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 7c3a9e7584..8202e54bd3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -375,7 +375,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, int CC_id, UE_id = 0; gNB_MAC_INST *gNB = RC.nrmac[module_idP]; NR_UE_list_t *UE_list = &gNB->UE_list; - UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + NR_UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; NR_COMMON_channels_t *cc = gNB->common_channels; NR_sched_pucch *pucch_sched = (NR_sched_pucch*) malloc(sizeof(NR_sched_pucch)); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 2fcccd682b..2b7c2274eb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -245,7 +245,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, int current_rnti = 0, UE_id = -1, harq_pid = 0; gNB_MAC_INST *gNB_mac = NULL; NR_UE_list_t *UE_list = NULL; - UE_sched_ctrl_t *UE_scheduling_control = NULL; + NR_UE_sched_ctrl_t *UE_scheduling_control = NULL; current_rnti = rntiP; UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti); @@ -255,13 +255,12 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (UE_id != -1) { UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]); - LOG_D(MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n", + LOG_D(MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d\n", gnb_mod_idP, harq_pid, CC_idP, frameP, slotP, - UE_scheduling_control->round_UL[CC_idP][harq_pid], current_rnti, UE_id, ul_cqi); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 86dac1e11f..bf9358dd43 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -116,6 +116,8 @@ typedef struct { uint64_t dlsch_in_slot_bitmap; // static bitmap signaling which slot in a tdd period contains dlsch uint64_t ulsch_in_slot_bitmap; // static bitmap signaling which slot in a tdd period contains ulsch NR_sched_pucch *sched_pucch; + uint16_t ta_timer; + int16_t ta_update; } NR_UE_sched_ctrl_t; /*! \brief UE list used by eNB to order UEs/CC for scheduling*/