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);