Commit a653034f authored by Gabriele Perrone's avatar Gabriele Perrone

Merge remote-tracking branch 'origin/generate_push_ptrs' into develop_integration_w11

parents 4e523485 8fbdfa39
...@@ -1467,6 +1467,7 @@ set(PHY_SRC_UE ...@@ -1467,6 +1467,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c ${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_adjust_sync_gNB.c ${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_adjust_sync_gNB.c
...@@ -1513,6 +1514,7 @@ set(PHY_SRC_UE ...@@ -1513,6 +1514,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_REFSIG/ul_ref_seq_nr.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/ul_ref_seq_nr.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold_ue.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold_ue.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
......
...@@ -85,6 +85,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -85,6 +85,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
nfapi_nr_config_request_t *cfg = &gNB->gNB_config; nfapi_nr_config_request_t *cfg = &gNB->gNB_config;
NR_gNB_COMMON *const common_vars = &gNB->common_vars; NR_gNB_COMMON *const common_vars = &gNB->common_vars;
NR_gNB_PUSCH **const pusch_vars = gNB->pusch_vars; NR_gNB_PUSCH **const pusch_vars = gNB->pusch_vars;
dmrs_UplinkConfig_t *dmrs_Uplink_Config = &gNB->pusch_config.dmrs_UplinkConfig;
ptrs_UplinkConfig_t *ptrs_Uplink_Config = &gNB->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
/*LTE_eNB_SRS *const srs_vars = gNB->srs_vars; /*LTE_eNB_SRS *const srs_vars = gNB->srs_vars;
LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/ LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/
...@@ -154,9 +156,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -154,9 +156,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
} }
//------------- config PUSCH DMRS parameters(to be updated from RRC)--------------// //------------- config PUSCH DMRS parameters(to be updated from RRC)--------------//
gNB->dmrs_UplinkConfig.pusch_dmrs_type = pusch_dmrs_type1; dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1;
gNB->dmrs_UplinkConfig.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0;
gNB->dmrs_UplinkConfig.pusch_maxLength = pusch_len1; dmrs_Uplink_Config->pusch_maxLength = pusch_len1;
//--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------//
nr_init_pdsch_dmrs(gNB, cfg->sch_config.physical_cell_id.value); nr_init_pdsch_dmrs(gNB, cfg->sch_config.physical_cell_id.value);
...@@ -168,6 +170,17 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -168,6 +170,17 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
gNB->pusch_config.pusch_TimeDomainResourceAllocation[i]->mappingType = typeB; gNB->pusch_config.pusch_TimeDomainResourceAllocation[i]->mappingType = typeB;
} }
gNB->ptrs_configured = 0;
//------------- config PUSCH PTRS parameters(to be updated from RRC)--------------//
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;
//--------------------------------------------------------------------------------//
/// Transport init necessary for NR synchro /// Transport init necessary for NR synchro
init_nr_transport(gNB); init_nr_transport(gNB);
...@@ -225,6 +238,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -225,6 +238,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
pusch_vars[UE_id]->rxdataF_ext2 = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); pusch_vars[UE_id]->rxdataF_ext2 = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_estimates = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); pusch_vars[UE_id]->ul_ch_estimates = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_estimates_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); pusch_vars[UE_id]->ul_ch_estimates_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_ptrs_estimates = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_ptrs_estimates_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_estimates_time = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); pusch_vars[UE_id]->ul_ch_estimates_time = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->rxdataF_comp = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); pusch_vars[UE_id]->rxdataF_comp = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_mag0 = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); pusch_vars[UE_id]->ul_ch_mag0 = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
...@@ -240,6 +255,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -240,6 +255,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
pusch_vars[UE_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot ); pusch_vars[UE_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->ul_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot ); pusch_vars[UE_id]->ul_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->ul_ch_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot ); pusch_vars[UE_id]->ul_ch_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->ul_ch_ptrs_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*2*fp->symbols_per_slot ); // max intensity in freq is 1 sc every 2 RBs
pusch_vars[UE_id]->ul_ch_ptrs_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*2*fp->symbols_per_slot );
pusch_vars[UE_id]->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size ); pusch_vars[UE_id]->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot ); pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->ul_ch_mag0[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 ); pusch_vars[UE_id]->ul_ch_mag0[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 );
...@@ -350,6 +367,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -350,6 +367,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(pusch_vars[UE_id]->rxdataF_ext2[i]); free_and_zero(pusch_vars[UE_id]->rxdataF_ext2[i]);
free_and_zero(pusch_vars[UE_id]->ul_ch_estimates[i]); free_and_zero(pusch_vars[UE_id]->ul_ch_estimates[i]);
free_and_zero(pusch_vars[UE_id]->ul_ch_estimates_ext[i]); free_and_zero(pusch_vars[UE_id]->ul_ch_estimates_ext[i]);
free_and_zero(pusch_vars[UE_id]->ul_ch_ptrs_estimates[i]);
free_and_zero(pusch_vars[UE_id]->ul_ch_ptrs_estimates_ext[i]);
free_and_zero(pusch_vars[UE_id]->ul_ch_estimates_time[i]); free_and_zero(pusch_vars[UE_id]->ul_ch_estimates_time[i]);
free_and_zero(pusch_vars[UE_id]->rxdataF_comp[i]); free_and_zero(pusch_vars[UE_id]->rxdataF_comp[i]);
free_and_zero(pusch_vars[UE_id]->ul_ch_mag0[i]); free_and_zero(pusch_vars[UE_id]->ul_ch_mag0[i]);
...@@ -363,6 +382,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -363,6 +382,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(pusch_vars[UE_id]->rxdataF_ext2); free_and_zero(pusch_vars[UE_id]->rxdataF_ext2);
free_and_zero(pusch_vars[UE_id]->ul_ch_estimates); free_and_zero(pusch_vars[UE_id]->ul_ch_estimates);
free_and_zero(pusch_vars[UE_id]->ul_ch_estimates_ext); free_and_zero(pusch_vars[UE_id]->ul_ch_estimates_ext);
free_and_zero(pusch_vars[UE_id]->ul_ch_ptrs_estimates);
free_and_zero(pusch_vars[UE_id]->ul_ch_ptrs_estimates_ext);
free_and_zero(pusch_vars[UE_id]->ul_ch_estimates_time); free_and_zero(pusch_vars[UE_id]->ul_ch_estimates_time);
free_and_zero(pusch_vars[UE_id]->rxdataF_comp); free_and_zero(pusch_vars[UE_id]->rxdataF_comp);
free_and_zero(pusch_vars[UE_id]->ul_ch_mag0); free_and_zero(pusch_vars[UE_id]->ul_ch_mag0);
......
...@@ -659,6 +659,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -659,6 +659,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
abstraction_flag = 0; abstraction_flag = 0;
fp->nb_antennas_tx = 1; fp->nb_antennas_tx = 1;
fp->nb_antennas_rx=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;
printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); 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); //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,k_ssb); nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,k_ssb);
...@@ -711,9 +713,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -711,9 +713,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
} }
//------------- config DMRS parameters--------------// //------------- config DMRS parameters--------------//
ue->dmrs_UplinkConfig.pusch_dmrs_type = pusch_dmrs_type1; dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1;
ue->dmrs_UplinkConfig.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0;
ue->dmrs_UplinkConfig.pusch_maxLength = pusch_len1; dmrs_Uplink_Config->pusch_maxLength = pusch_len1;
//-------------------------------------------------// //-------------------------------------------------//
ue->dmrs_DownlinkConfig.pdsch_dmrs_type = pdsch_dmrs_type1; ue->dmrs_DownlinkConfig.pdsch_dmrs_type = pdsch_dmrs_type1;
ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition = pdsch_dmrs_pos0; ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition = pdsch_dmrs_pos0;
...@@ -743,6 +745,23 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -743,6 +745,23 @@ 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 = 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;
//-------------------------------------------------//
///////////
////////////////////////////////////////////////////////////////////////////////////////////
for (i=0; i<10; i++) for (i=0; i<10; i++)
ue->tx_power_dBm[i]=-127; ue->tx_power_dBm[i]=-127;
......
...@@ -117,7 +117,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -117,7 +117,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
//------------------generate DMRS------------------// //------------------generate DMRS------------------//
length_dmrs = gNB->dmrs_UplinkConfig.pusch_maxLength; length_dmrs = dmrs_UplinkConfig->pusch_maxLength;
nr_gold_pusch(gNB, symbol, n_idDMRS, length_dmrs); nr_gold_pusch(gNB, symbol, n_idDMRS, length_dmrs);
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/**********************************************************************
*
* FILENAME : ptrs_nr.c
*
* MODULE : phase tracking reference signals
*
* DESCRIPTION : resource element mapping of ptrs sequences
* 3GPP TS 38.211 and 3GPP TS 38.214
*
************************************************************************/
#include <stdint.h>
#include <stdio.h>
#include "dmrs_nr.h"
#include "PHY/NR_REFSIG/ptrs_nr.h"
/***********************************************************************/
//#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},
};
/*******************************************************************
*
* NAME : get_kRE_ref
*
* PARAMETERS : dmrs_antenna_port DMRS antenna port
* pusch_dmrs_type PUSCH DMRS type
* resourceElementOffset the parameter resourceElementOffset
*
* RETURN : the parameter k_RE_ref
*
* DESCRIPTION : 3GPP TS 38.211 Table 6.4.1.2.2.1-1
*
*********************************************************************/
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;
}
/*******************************************************************
*
* 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;
}
/*******************************************************************
*
* NAME : set_ptrs_symb_idx
*
* PARAMETERS : ptrs_symbols PTRS OFDM symbol indicies bit mask
* ptrs_UplinkConfig PTRS uplink configuration
* dmrs_UplinkConfig DMRS uplink configuration
* mapping_type PUSCH time domain mapping type
* 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
*
* RETURN : sets the bit map of PTRS ofdm symbol indicies
*
* DESCRIPTION : 3GPP TS 38.211 6.4.1.2.2.1
*
*********************************************************************/
void set_ptrs_symb_idx(uint16_t *ptrs_symbols,
ptrs_UplinkConfig_t *ptrs_UplinkConfig,
dmrs_UplinkConfig_t *dmrs_UplinkConfig,
uint8_t mapping_type,
uint8_t duration_in_symbols,
uint8_t start_symbol,
uint8_t L_ptrs,
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;
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_UplinkConfig,
mapping_type,
ofdm_symbol_size);
is_dmrs_symbol2 = is_dmrs_symbol(l_ref + i*L_ptrs,
0,
0,
0,
0,
0,
duration_in_symbols,
dmrs_UplinkConfig,
mapping_type,
ofdm_symbol_size);
if ( is_dmrs_symbol1 + is_dmrs_symbol2 > 0 ) {
if (dmrs_UplinkConfig->pusch_maxLength == 2)
l_ref = l_ref + i*L_ptrs + 1;
else
l_ref = l_ref + i*L_ptrs;
i = 1;
continue;
}
*ptrs_symbols = *ptrs_symbols | (1<<(l_ref + i*L_ptrs));
i++;
}
}
/*******************************************************************
*
* 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
*
* PARAMETERS : k subcarrier index
* K_ptrs the parameter K_ptrs
* n_rnti UE CRNTI
* 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
*
* DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH
*
*********************************************************************/
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;
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;
}
/*******************************************************************
*
* 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
* 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
*
* RETURN : 0 if symbol(k,l) is data, or 1 if symbol(k,l) is ptrs
*
* 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 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,
ptrs_UplinkConfig_t *ptrs_UplinkConfig) {
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, ptrs_UplinkConfig->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)
return 0;
if (((ptrs_symbols>>l)&1) == 1)
is_ptrs_time = 1;
if (is_ptrs_time && is_ptrs_freq)
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_Uplink_Config.pusch_dmrs_type = pusch_dmrs_type1;
dmrs_Uplink_Config.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos1;
dmrs_Uplink_Config.pusch_maxLength = pusch_len2;
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;
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;
k_RE_ref = get_kRE_ref(dmrs_antenna_port, dmrs_Uplink_Config.pusch_dmrs_type, resourceElementOffset);
K_ptrs = get_K_ptrs(&ptrs_Uplink_Config, N_RB);
L_ptrs = get_L_ptrs(&ptrs_Uplink_Config, I_mcs);
set_ptrs_symb_idx(&ptrs_symbols,
&ptrs_Uplink_Config,
&dmrs_Uplink_Config,
1,
duration_in_symbols,
start_symbol,
L_ptrs,
ofdm_symbol_size);
printf("PTRS OFDM symbol indicies: ");
for (l = start_symbol; l < start_symbol + duration_in_symbols; l++){
ptrs_symbol_flag = is_ptrs_symbol(l,
0,
n_rnti,
N_RB,
duration_in_symbols,
dmrs_antenna_port,
K_ptrs,
ptrs_symbols,
dmrs_Uplink_Config.pusch_dmrs_type,
&ptrs_Uplink_Config);
if (ptrs_symbol_flag == 1)
printf(" %d ", l);
}
printf("\n");
printf("PTRS subcarrier indicies: ");
for (k = 0; k < N_RB*12; k++){
if (is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref) == 1)
printf(" %d ", k);
}
printf("\n");
return 0;
}
*/
\ No newline at end of file
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/**********************************************************************
*
* FILENAME : dmrs.h
*
* MODULE : demodulation reference signals
*
* DESCRIPTION : generation of dmrs sequences for NR 5G
* 3GPP TS 38.211
*
************************************************************************/
#ifndef PTRS_NR_H
#define PTRS_NR_H
#include "PHY/defs_nr_UE.h"
/************** CODE GENERATION ***********************************/
/************** DEFINE ********************************************/
/************* STRUCTURES *****************************************/
/************** VARIABLES *****************************************/
/************** FUNCTION ******************************************/
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,
ptrs_UplinkConfig_t *ptrs_UplinkConfig,
dmrs_UplinkConfig_t *dmrs_UplinkConfig,
uint8_t mapping_type,
uint8_t duration_in_symbols,
uint8_t start_symbol,
uint8_t L_ptrs,
uint16_t ofdm_symbol_size);
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_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,
ptrs_UplinkConfig_t *ptrs_UplinkConfig);
#endif /* PTRS_NR_H */
\ No newline at end of file
...@@ -338,7 +338,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, ...@@ -338,7 +338,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
rel15_ul->ulsch_pdu_rel15.number_rbs = ulsch_pdu->rb_size; rel15_ul->ulsch_pdu_rel15.number_rbs = ulsch_pdu->rb_size;
rel15_ul->ulsch_pdu_rel15.start_symbol = ulsch_pdu->start_symbol_index; rel15_ul->ulsch_pdu_rel15.start_symbol = ulsch_pdu->start_symbol_index;
rel15_ul->ulsch_pdu_rel15.number_symbols = ulsch_pdu->nr_of_symbols; rel15_ul->ulsch_pdu_rel15.number_symbols = ulsch_pdu->nr_of_symbols;
rel15_ul->ulsch_pdu_rel15.length_dmrs = gNB->dmrs_UplinkConfig.pusch_maxLength; rel15_ul->ulsch_pdu_rel15.length_dmrs = gNB->pusch_config.dmrs_UplinkConfig.pusch_maxLength;
rel15_ul->ulsch_pdu_rel15.Qm = ulsch_pdu->qam_mod_order; rel15_ul->ulsch_pdu_rel15.Qm = ulsch_pdu->qam_mod_order;
rel15_ul->ulsch_pdu_rel15.mcs = ulsch_pdu->mcs_index; rel15_ul->ulsch_pdu_rel15.mcs = ulsch_pdu->mcs_index;
rel15_ul->ulsch_pdu_rel15.rv = ulsch_pdu->pusch_data.rv_index; rel15_ul->ulsch_pdu_rel15.rv = ulsch_pdu->pusch_data.rv_index;
......
...@@ -65,20 +65,18 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -65,20 +65,18 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
@param is_dmrs_symbol, flag to indicate wether this OFDM symbol contains DMRS symbols or not. @param is_dmrs_symbol, flag to indicate wether this OFDM symbol contains DMRS symbols or not.
*/ */
void nr_ulsch_extract_rbs_single(int **rxdataF, void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
int **ul_ch_estimates, NR_gNB_PUSCH *pusch_vars,
int **rxdataF_ext,
int **ul_ch_estimates_ext,
uint32_t rxdataF_ext_offset,
// unsigned int *rb_alloc, [hna] Resource Allocation Type 1 is assumed only for the moment
unsigned char symbol, unsigned char symbol,
unsigned short start_rb, unsigned short start_rb,
unsigned short nb_rb_pusch, unsigned short nb_rb_pusch,
uint16_t n_rnti,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
uint8_t dmrs_symbol,
uint16_t number_symbols, uint16_t number_symbols,
uint8_t mapping_type, uint8_t mapping_type,
dmrs_UplinkConfig_t *dmrs_UplinkConfig); uint8_t ptrs_configured,
dmrs_UplinkConfig_t *dmrs_UplinkConfig,
ptrs_UplinkConfig_t *ptrs_Uplink_Config);
void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext, void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "PHY/impl_defs_top.h" #include "PHY/impl_defs_top.h"
#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" #include "PHY/NR_TRANSPORT/nr_sch_dmrs.h"
#include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/NR_REFSIG/dmrs_nr.h"
#include "PHY/NR_REFSIG/ptrs_nr.h"
#include "PHY/NR_ESTIMATION/nr_ul_estimation.h" #include "PHY/NR_ESTIMATION/nr_ul_estimation.h"
#include "PHY/defs_nr_common.h" #include "PHY/defs_nr_common.h"
...@@ -221,31 +222,32 @@ void nr_idft(uint32_t *z, uint32_t Msc_PUSCH) ...@@ -221,31 +222,32 @@ void nr_idft(uint32_t *z, uint32_t Msc_PUSCH)
} }
void nr_ulsch_extract_rbs_single(int **rxdataF, void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
int **ul_ch_estimates, NR_gNB_PUSCH *pusch_vars,
int **rxdataF_ext,
int **ul_ch_estimates_ext,
uint32_t rxdataF_ext_offset,
// unsigned int *rb_alloc, [hna] Resource Allocation Type 1 is assumed only for the moment
unsigned char symbol, unsigned char symbol,
unsigned short start_rb, unsigned short start_rb,
unsigned short nb_rb_pusch, unsigned short nb_rb_pusch,
uint16_t n_rnti,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
uint8_t dmrs_symbol,
uint16_t number_symbols, uint16_t number_symbols,
uint8_t mapping_type, uint8_t mapping_type,
dmrs_UplinkConfig_t *dmrs_UplinkConfig) uint8_t ptrs_configured,
dmrs_UplinkConfig_t *dmrs_UplinkConfig,
ptrs_UplinkConfig_t *ptrs_Uplink_Config)
{ {
unsigned short start_re, re, nb_re_pusch; unsigned short start_re, re, nb_re_pusch;
unsigned char aarx; unsigned char aarx;
uint8_t K_ptrs;
uint32_t rxF_ext_index = 0; uint32_t rxF_ext_index = 0;
uint32_t ul_ch0_ext_index = 0; uint32_t ul_ch0_ext_index = 0;
uint32_t ul_ch0_index = 0; uint32_t ul_ch0_index = 0;
uint8_t is_dmrs_symbol_flag, k_prime; uint32_t ul_ch0_ptrs_ext_index = 0;
uint16_t n=0; uint32_t ul_ch0_ptrs_index = 0;
uint8_t is_dmrs_symbol_flag, is_ptrs_symbol_flag,k_prime;
uint16_t n=0, num_ptrs_symbols;
int16_t *rxF,*rxF_ext; int16_t *rxF,*rxF_ext;
int *ul_ch0,*ul_ch0_ext; int *ul_ch0,*ul_ch0_ext;
int *ul_ch0_ptrs,*ul_ch0_ptrs_ext;
#ifdef DEBUG_RB_EXT #ifdef DEBUG_RB_EXT
...@@ -258,15 +260,23 @@ void nr_ulsch_extract_rbs_single(int **rxdataF, ...@@ -258,15 +260,23 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
nb_re_pusch = NR_NB_SC_PER_RB * nb_rb_pusch; nb_re_pusch = NR_NB_SC_PER_RB * nb_rb_pusch;
is_dmrs_symbol_flag = 0; is_dmrs_symbol_flag = 0;
is_ptrs_symbol_flag = 0;
num_ptrs_symbols = 0;
K_ptrs = get_K_ptrs(ptrs_Uplink_Config, nb_rb_pusch);
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
rxF = (int16_t *)&rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size]; rxF = (int16_t *)&rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size];
rxF_ext = (int16_t *)&rxdataF_ext[aarx][symbol * nb_re_pusch]; // [hna] rxdataF_ext isn't contiguous in order to solve an alignment problem ib llr computation in case of mod_order = 4, 6 rxF_ext = (int16_t *)&pusch_vars->rxdataF_ext[aarx][symbol * nb_re_pusch]; // [hna] rxdataF_ext isn't contiguous in order to solve an alignment problem ib llr computation in case of mod_order = 4, 6
ul_ch0 = &pusch_vars->ul_ch_estimates[aarx][pusch_vars->dmrs_symbol*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available
ul_ch0_ext = &pusch_vars->ul_ch_estimates_ext[aarx][symbol*nb_re_pusch];
ul_ch0 = &ul_ch_estimates[aarx][dmrs_symbol*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available ul_ch0_ptrs = &pusch_vars->ul_ch_ptrs_estimates[aarx][pusch_vars->ptrs_symbol_index*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available
ul_ch0_ext = &ul_ch_estimates_ext[aarx][symbol*nb_re_pusch]; ul_ch0_ptrs_ext = &pusch_vars->ul_ch_ptrs_estimates_ext[aarx][symbol*nb_re_pusch];
n = 0; n = 0;
k_prime = 0; k_prime = 0;
...@@ -283,15 +293,36 @@ void nr_ulsch_extract_rbs_single(int **rxdataF, ...@@ -283,15 +293,36 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
dmrs_UplinkConfig, dmrs_UplinkConfig,
mapping_type, mapping_type,
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
if (ptrs_configured == 1){
is_ptrs_symbol_flag = is_ptrs_symbol(symbol,
(start_re + re)%frame_parms->ofdm_symbol_size,
n_rnti,
nb_rb_pusch,
number_symbols,
aarx,
K_ptrs,
pusch_vars->ptrs_symbols,
start_re,
frame_parms->ofdm_symbol_size,
dmrs_UplinkConfig->pusch_dmrs_type,
ptrs_Uplink_Config);
if (is_ptrs_symbol_flag == 1)
num_ptrs_symbols++;
}
#ifdef DEBUG_RB_EXT #ifdef DEBUG_RB_EXT
printf("re = %d, is_dmrs_symbol_flag = %d, symbol = %d\n", re, is_dmrs_symbol_flag, symbol); printf("re = %d, is_dmrs_symbol_flag = %d, symbol = %d\n", re, is_dmrs_symbol_flag, symbol);
#endif #endif
if ( is_dmrs_symbol_flag == 0 ) { if ( is_dmrs_symbol_flag == 0 && is_ptrs_symbol_flag == 0) {
rxF_ext[rxF_ext_index] = (rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]); rxF_ext[rxF_ext_index] = (rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]);
rxF_ext[rxF_ext_index + 1] = (rxF[(((start_re + re)*2) + 1) % (frame_parms->ofdm_symbol_size*2)]); rxF_ext[rxF_ext_index + 1] = (rxF[(((start_re + re)*2) + 1) % (frame_parms->ofdm_symbol_size*2)]);
ul_ch0_ext[ul_ch0_ext_index] = ul_ch0[ul_ch0_index]; ul_ch0_ext[ul_ch0_ext_index] = ul_ch0[ul_ch0_index];
ul_ch0_ptrs_ext[ul_ch0_ptrs_ext_index] = ul_ch0_ptrs[ul_ch0_ptrs_index];
#ifdef DEBUG_RB_EXT #ifdef DEBUG_RB_EXT
printf("rxF_ext[%d] = %d\n", rxF_ext_index, rxF_ext[rxF_ext_index]); printf("rxF_ext[%d] = %d\n", rxF_ext_index, rxF_ext[rxF_ext_index]);
...@@ -299,6 +330,7 @@ void nr_ulsch_extract_rbs_single(int **rxdataF, ...@@ -299,6 +330,7 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
#endif #endif
ul_ch0_ext_index++; ul_ch0_ext_index++;
ul_ch0_ptrs_ext_index++;
rxF_ext_index +=2; rxF_ext_index +=2;
} else { } else {
k_prime++; k_prime++;
...@@ -306,8 +338,12 @@ void nr_ulsch_extract_rbs_single(int **rxdataF, ...@@ -306,8 +338,12 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
n+=(k_prime)?0:1; n+=(k_prime)?0:1;
} }
ul_ch0_index++; ul_ch0_index++;
ul_ch0_ptrs_index++;
} }
} }
pusch_vars->ptrs_sc_per_ofdm_symbol = num_ptrs_symbols;
} }
void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
...@@ -1001,17 +1037,21 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1001,17 +1037,21 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
unsigned char harq_pid) unsigned char harq_pid)
{ {
uint8_t first_symbol_flag, aarx, aatx, dmrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol 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
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_ul_config_ulsch_pdu_rel15_t *rel15_ul = &gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->ulsch_pdu.ulsch_pdu_rel15;
uint32_t nb_re_pusch, bwp_start_subcarrier; uint32_t nb_re_pusch, bwp_start_subcarrier;
uint8_t mapping_type; uint8_t mapping_type;
uint8_t L_ptrs = 0; // PTRS parameter
int avgs; int avgs;
int avg[4]; int avg[4];
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_ul_config_ulsch_pdu_rel15_t *rel15_ul = &gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->ulsch_pdu.ulsch_pdu_rel15;
ptrs_UplinkConfig_t *ptrs_Uplink_Config = &gNB->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
dmrs_symbol_flag = 0; dmrs_symbol_flag = 0;
ptrs_symbol_flag = 0;
first_symbol_flag = 0; first_symbol_flag = 0;
mapping_type = gNB->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; mapping_type = gNB->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType;
gNB->pusch_vars[UE_id]->ptrs_sc_per_ofdm_symbol = 0;
if (mapping_type == typeB) { if (mapping_type == typeB) {
...@@ -1019,6 +1059,20 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1019,6 +1059,20 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = 0; gNB->pusch_vars[UE_id]->rxdataF_ext_offset = 0;
gNB->pusch_vars[UE_id]->dmrs_symbol = 0; gNB->pusch_vars[UE_id]->dmrs_symbol = 0;
first_symbol_flag = 1; first_symbol_flag = 1;
L_ptrs = get_L_ptrs(ptrs_Uplink_Config, rel15_ul->mcs);
gNB->pusch_vars[UE_id]->ptrs_symbols = 0;
set_ptrs_symb_idx(&gNB->pusch_vars[UE_id]->ptrs_symbols,
ptrs_Uplink_Config,
&gNB->pusch_config.dmrs_UplinkConfig,
1,
rel15_ul->number_symbols,
rel15_ul->start_symbol,
L_ptrs,
frame_parms->ofdm_symbol_size);
} }
bwp_start_subcarrier = (rel15_ul->start_rb*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size; bwp_start_subcarrier = (rel15_ul->start_rb*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
...@@ -1030,17 +1084,36 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1030,17 +1084,36 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
0, 0,
0, 0,
rel15_ul->number_symbols, rel15_ul->number_symbols,
&gNB->dmrs_UplinkConfig, &gNB->pusch_config.dmrs_UplinkConfig,
mapping_type, mapping_type,
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
if (dmrs_symbol_flag == 1){ if (dmrs_symbol_flag == 1){
nb_re_pusch = rel15_ul->number_rbs * ((gNB->dmrs_UplinkConfig.pusch_dmrs_type==pusch_dmrs_type1)?6:8); nb_re_pusch = rel15_ul->number_rbs * ((gNB->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type==pusch_dmrs_type1)?6:8);
gNB->pusch_vars[UE_id]->dmrs_symbol = symbol; gNB->pusch_vars[UE_id]->dmrs_symbol = symbol;
} else { } else {
nb_re_pusch = rel15_ul->number_rbs * NR_NB_SC_PER_RB; nb_re_pusch = rel15_ul->number_rbs * NR_NB_SC_PER_RB;
} }
if (gNB->ptrs_configured == 1)
ptrs_symbol_flag = is_ptrs_symbol(symbol,
0,
gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->ulsch_pdu.rnti,
rel15_ul->number_rbs,
rel15_ul->number_symbols,
0,
get_K_ptrs(ptrs_Uplink_Config, rel15_ul->number_rbs),
gNB->pusch_vars[UE_id]->ptrs_symbols,
0,
frame_parms->ofdm_symbol_size,
gNB->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type,
ptrs_Uplink_Config);
if (ptrs_symbol_flag == 1){
gNB->pusch_vars[UE_id]->ptrs_symbol_index = symbol;
}
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- Channel estimation --------------------- //--------------------- Channel estimation ---------------------
...@@ -1054,26 +1127,24 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1054,26 +1127,24 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
symbol, symbol,
bwp_start_subcarrier, bwp_start_subcarrier,
rel15_ul->number_rbs, rel15_ul->number_rbs,
&gNB->dmrs_UplinkConfig); &gNB->pusch_config.dmrs_UplinkConfig);
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- RBs extraction --------------------- //--------------------- RBs extraction ---------------------
//---------------------------------------------------------- //----------------------------------------------------------
nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF, nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
gNB->pusch_vars[UE_id]->ul_ch_estimates, gNB->pusch_vars[UE_id],
gNB->pusch_vars[UE_id]->rxdataF_ext,
gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
gNB->pusch_vars[UE_id]->rxdataF_ext_offset,
// rb_alloc, [hna] Resource Allocation Type 1 is assumed only for the moment
symbol, symbol,
rel15_ul->start_rb, rel15_ul->start_rb,
rel15_ul->number_rbs, rel15_ul->number_rbs,
gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->ulsch_pdu.rnti,
frame_parms, frame_parms,
gNB->pusch_vars[UE_id]->dmrs_symbol,
rel15_ul->number_symbols, rel15_ul->number_symbols,
mapping_type, mapping_type,
&gNB->dmrs_UplinkConfig); gNB->ptrs_configured,
&gNB->pusch_config.dmrs_UplinkConfig,
ptrs_Uplink_Config);
nr_ulsch_scale_channel(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext, nr_ulsch_scale_channel(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
frame_parms, frame_parms,
...@@ -1081,7 +1152,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1081,7 +1152,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
symbol, symbol,
dmrs_symbol_flag, dmrs_symbol_flag,
rel15_ul->number_rbs, rel15_ul->number_rbs,
gNB->dmrs_UplinkConfig.pusch_dmrs_type); gNB->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type);
if (first_symbol_flag==1) { if (first_symbol_flag==1) {
...@@ -1131,7 +1202,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1131,7 +1202,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
symbol, symbol,
rel15_ul->Qm); rel15_ul->Qm);
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = gNB->pusch_vars[UE_id]->rxdataF_ext_offset + nb_re_pusch; gNB->pusch_vars[UE_id]->rxdataF_ext_offset = gNB->pusch_vars[UE_id]->rxdataF_ext_offset + nb_re_pusch - gNB->pusch_vars[UE_id]->ptrs_sc_per_ofdm_symbol;
} else { } else {
LOG_E(PHY, "PUSCH mapping type A is not supported \n"); LOG_E(PHY, "PUSCH mapping type A is not supported \n");
} }
......
...@@ -1975,7 +1975,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue, ...@@ -1975,7 +1975,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
PUSCH_Config_t pusch_config = ue->pusch_config; PUSCH_Config_t pusch_config = ue->pusch_config;
PUCCH_Config_t pucch_config_dedicated = ue->pucch_config_dedicated_nr[eNB_id]; PUCCH_Config_t pucch_config_dedicated = ue->pucch_config_dedicated_nr[eNB_id];
crossCarrierSchedulingConfig_t crossCarrierSchedulingConfig = ue->crossCarrierSchedulingConfig; crossCarrierSchedulingConfig_t crossCarrierSchedulingConfig = ue->crossCarrierSchedulingConfig;
dmrs_UplinkConfig_t dmrs_UplinkConfig = ue->dmrs_UplinkConfig; dmrs_UplinkConfig_t dmrs_UplinkConfig = ue->pusch_config.dmrs_UplinkConfig;
dmrs_DownlinkConfig_t dmrs_DownlinkConfig = ue->dmrs_DownlinkConfig; dmrs_DownlinkConfig_t dmrs_DownlinkConfig = ue->dmrs_DownlinkConfig;
csi_MeasConfig_t csi_MeasConfig = ue->csi_MeasConfig; csi_MeasConfig_t csi_MeasConfig = ue->csi_MeasConfig;
PUSCH_ServingCellConfig_t PUSCH_ServingCellConfig= ue->PUSCH_ServingCellConfig; PUSCH_ServingCellConfig_t PUSCH_ServingCellConfig= ue->PUSCH_ServingCellConfig;
......
...@@ -240,6 +240,8 @@ typedef struct { ...@@ -240,6 +240,8 @@ typedef struct {
int16_t Po_SRS; int16_t Po_SRS;
/// num active cba group /// num active cba group
uint8_t num_active_cba_groups; uint8_t num_active_cba_groups;
/// bit mask of PT-RS ofdm symbol indicies
uint16_t ptrs_symbols;
/// num dci found for cba /// num dci found for cba
//uint8_t num_cba_dci[10]; //uint8_t num_cba_dci[10];
/// allocated CBA RNTI /// allocated CBA RNTI
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/NR_REFSIG/dmrs_nr.h"
#include "PHY/NR_REFSIG/ptrs_nr.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/nr_modulation.h"
...@@ -105,19 +106,22 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -105,19 +106,22 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
int32_t **txdataF; int32_t **txdataF;
uint16_t start_sc, start_rb; uint16_t start_sc, start_rb;
int8_t Wf[2], Wt[2], l_prime[2], delta; int8_t Wf[2], Wt[2], l_prime[2], delta;
uint16_t n_dmrs, code_rate, number_dmrs_symbols; uint16_t n_dmrs, code_rate, number_dmrs_symbols, k;
uint8_t dmrs_type; uint8_t dmrs_type;
uint8_t mapping_type; uint8_t mapping_type;
int ap, start_symbol, Nid_cell, i; int ap, start_symbol, Nid_cell, i;
int sample_offsetF, N_RE_prime, N_PRB_oh; int sample_offsetF, N_RE_prime, N_PRB_oh;
uint16_t n_rnti; uint16_t n_rnti;
uint8_t data_existing =0; uint8_t data_existing =0;
uint8_t L_ptrs, K_ptrs; // PTRS parameters
uint16_t beta_ptrs; // PTRS parameter related to power control
NR_UE_ULSCH_t *ulsch_ue; NR_UE_ULSCH_t *ulsch_ue;
NR_UL_UE_HARQ_t *harq_process_ul_ue; NR_UL_UE_HARQ_t *harq_process_ul_ue;
NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id]; NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES]; uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
num_of_codewords = 1; // tmp assumption num_of_codewords = 1; // tmp assumption
n_rnti = 0x1234; n_rnti = 0x1234;
...@@ -142,14 +146,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -142,14 +146,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
0, 0,
0, 0,
harq_process_ul_ue->number_of_symbols, harq_process_ul_ue->number_of_symbols,
&UE->dmrs_UplinkConfig, &UE->pusch_config.dmrs_UplinkConfig,
mapping_type, mapping_type,
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
ulsch_ue->length_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength; ulsch_ue->length_dmrs = UE->pusch_config.dmrs_UplinkConfig.pusch_maxLength;
ulsch_ue->rnti = n_rnti; ulsch_ue->rnti = n_rnti;
ulsch_ue->Nid_cell = Nid_cell; ulsch_ue->Nid_cell = Nid_cell;
ulsch_ue->nb_re_dmrs = ((UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; ulsch_ue->nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols;
N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs - N_PRB_oh; N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs - N_PRB_oh;
...@@ -277,10 +281,40 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -277,10 +281,40 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
n_dmrs = (harq_process_ul_ue->nb_rb*ulsch_ue->nb_re_dmrs); n_dmrs = (harq_process_ul_ue->nb_rb*ulsch_ue->nb_re_dmrs);
int16_t mod_dmrs[n_dmrs<<1]; int16_t mod_dmrs[n_dmrs<<1];
dmrs_type = UE->dmrs_UplinkConfig.pusch_dmrs_type; dmrs_type = UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type;
/////////// ///////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/////////////////////////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
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);
L_ptrs = get_L_ptrs(ptrs_Uplink_Config, harq_process_ul_ue->mcs);
beta_ptrs = 1; // temp value until power control is implemented
ulsch_ue->ptrs_symbols = 0;
set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols,
ptrs_Uplink_Config,
&UE->pusch_config.dmrs_UplinkConfig,
1,
harq_process_ul_ue->number_of_symbols,
start_symbol,
L_ptrs,
frame_parms->ofdm_symbol_size);
}
///////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////ULSCH layer mapping///////////////////////// /////////////////////////ULSCH layer mapping/////////////////////////
/////////// ///////////
...@@ -313,7 +347,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -313,7 +347,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
0, 0,
0, 0,
harq_process_ul_ue->number_of_symbols, harq_process_ul_ue->number_of_symbols,
&UE->dmrs_UplinkConfig, &UE->pusch_config.dmrs_UplinkConfig,
mapping_type, mapping_type,
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
...@@ -357,8 +391,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -357,8 +391,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint8_t k_prime=0; uint8_t k_prime=0;
uint8_t is_dmrs; uint8_t is_dmrs, is_ptrs;
uint16_t m=0, n=0, dmrs_idx=0, k=0; uint16_t m=0, n=0, dmrs_idx=0, ptrs_idx = 0;
for (l=start_symbol; l<start_symbol+harq_process_ul_ue->number_of_symbols; l++) { for (l=start_symbol; l<start_symbol+harq_process_ul_ue->number_of_symbols; l++) {
...@@ -371,6 +405,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -371,6 +405,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
sample_offsetF = l*frame_parms->ofdm_symbol_size + k; sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
is_dmrs = 0; is_dmrs = 0;
is_ptrs = 0;
is_dmrs = is_dmrs_symbol(l, is_dmrs = is_dmrs_symbol(l,
k, k,
...@@ -379,13 +414,30 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -379,13 +414,30 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
n, n,
delta, delta,
harq_process_ul_ue->number_of_symbols, harq_process_ul_ue->number_of_symbols,
&UE->dmrs_UplinkConfig, &UE->pusch_config.dmrs_UplinkConfig,
mapping_type, mapping_type,
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
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,
ap,
K_ptrs,
ulsch_ue->ptrs_symbols,
start_sc,
frame_parms->ofdm_symbol_size,
UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type,
ptrs_Uplink_Config);
}
if (is_dmrs == 1) { if (is_dmrs == 1) {
if (k == start_sc){
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
}
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15; ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15;
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
...@@ -401,9 +453,19 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -401,9 +453,19 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
k_prime++; k_prime++;
k_prime&=1; k_prime&=1;
n+=(k_prime)?0:1; n+=(k_prime)?0:1;
} 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);
} }
else { ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15;
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (beta_ptrs*AMP*mod_ptrs[(ptrs_idx<<1) + 1]) >> 15;
ptrs_idx++;
} else {
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1]; ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1];
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1]; ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1];
...@@ -484,6 +546,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, ...@@ -484,6 +546,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
frame_parms); frame_parms);
} }
} }
/////////// ///////////
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
return 0; return 0;
......
...@@ -375,6 +375,14 @@ typedef struct { ...@@ -375,6 +375,14 @@ typedef struct {
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_estimates_ext; int32_t **ul_ch_estimates_ext;
/// \brief Hold the PTRS phase estimates in frequency domain.
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_ptrs_estimates;
/// \brief Uplink phase estimates extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_ptrs_estimates_ext;
/// \brief Holds the compensated signal. /// \brief Holds the compensated signal.
/// - first index: rx antenna id [0..nb_antennas_rx[ /// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
...@@ -416,6 +424,12 @@ typedef struct { ...@@ -416,6 +424,12 @@ typedef struct {
int16_t *llr; int16_t *llr;
// DMRS symbol index, to be updated every DMRS symbol within a slot. // DMRS symbol index, to be updated every DMRS symbol within a slot.
uint8_t dmrs_symbol; uint8_t dmrs_symbol;
// PTRS symbol index, to be updated every PTRS symbol within a slot.
uint8_t ptrs_symbol_index;
/// bit mask of PT-RS ofdm symbol indicies
uint16_t ptrs_symbols;
// PTRS subcarriers per OFDM symbol
uint16_t ptrs_sc_per_ofdm_symbol;
} NR_gNB_PUSCH; } NR_gNB_PUSCH;
...@@ -670,6 +684,9 @@ typedef struct PHY_VARS_gNB_s { ...@@ -670,6 +684,9 @@ typedef struct PHY_VARS_gNB_s {
/// PDSCH DMRS sequence /// PDSCH DMRS sequence
uint32_t ****nr_gold_pdsch_dmrs; uint32_t ****nr_gold_pdsch_dmrs;
/// flag to indicate if PTRS is configured
uint8_t ptrs_configured;
/// PUSCH DMRS /// PUSCH DMRS
uint32_t nr_gold_pusch[2][20][2][NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD]; uint32_t nr_gold_pusch[2][20][2][NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD];
...@@ -727,8 +744,6 @@ typedef struct PHY_VARS_gNB_s { ...@@ -727,8 +744,6 @@ typedef struct PHY_VARS_gNB_s {
// SRS Variables // SRS Variables
SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_UE_MAX]; SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_UE_MAX];
dmrs_UplinkConfig_t dmrs_UplinkConfig;
dmrs_DownlinkConfig_t dmrs_DownlinkConfig; dmrs_DownlinkConfig_t dmrs_DownlinkConfig;
uint8_t ncs_cell[20][7]; uint8_t ncs_cell[20][7];
......
...@@ -1012,6 +1012,9 @@ typedef struct { ...@@ -1012,6 +1012,9 @@ typedef struct {
/// PUSCH DMRS sequence /// PUSCH DMRS sequence
uint32_t ****nr_gold_pusch_dmrs; 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 X_u[64][839];
uint32_t high_speed_flag; uint32_t high_speed_flag;
...@@ -1143,7 +1146,6 @@ typedef struct { ...@@ -1143,7 +1146,6 @@ typedef struct {
crossCarrierSchedulingConfig_t crossCarrierSchedulingConfig; crossCarrierSchedulingConfig_t crossCarrierSchedulingConfig;
supplementaryUplink_t supplementaryUplink; supplementaryUplink_t supplementaryUplink;
dmrs_UplinkConfig_t dmrs_UplinkConfig;
dmrs_DownlinkConfig_t dmrs_DownlinkConfig; dmrs_DownlinkConfig_t dmrs_DownlinkConfig;
csi_MeasConfig_t csi_MeasConfig; csi_MeasConfig_t csi_MeasConfig;
PUSCH_ServingCellConfig_t PUSCH_ServingCellConfig; PUSCH_ServingCellConfig_t PUSCH_ServingCellConfig;
......
...@@ -510,9 +510,6 @@ typedef struct { ...@@ -510,9 +510,6 @@ typedef struct {
uint8_t startSymbolAndLength; uint8_t startSymbolAndLength;
} PUSCH_TimeDomainResourceAllocation_t; } PUSCH_TimeDomainResourceAllocation_t;
////////////////////////////////////////////////////////////////////////////////################################ ////////////////////////////////////////////////////////////////////////////////################################
typedef struct { // The IE PTRS-UplinkConfig is used to configure uplink Phase-Tracking-Reference-Signals (PTRS)
} ptrs_UplinkConfig_t;
typedef enum{ typedef enum{
maxCodeBlockGroupsPerTransportBlock_n2 = 2, maxCodeBlockGroupsPerTransportBlock_n2 = 2,
maxCodeBlockGroupsPerTransportBlock_n4 = 4, maxCodeBlockGroupsPerTransportBlock_n4 = 4,
...@@ -544,6 +541,12 @@ typedef enum { ...@@ -544,6 +541,12 @@ typedef enum {
pusch_dmrs_pos2 = 2, pusch_dmrs_pos2 = 2,
pusch_dmrs_pos3 = 3, pusch_dmrs_pos3 = 3,
} pusch_dmrs_AdditionalPosition_t; } pusch_dmrs_AdditionalPosition_t;
typedef enum {
offset00 = 0,
offset01 = 1,
offset10 = 2,
offset11 = 3,
} ptrs_resource_elementoffset_t;
typedef enum { typedef enum {
pdsch_len1 = 1, pdsch_len1 = 1,
pdsch_len2 = 2 pdsch_len2 = 2
...@@ -552,6 +555,22 @@ typedef enum { ...@@ -552,6 +555,22 @@ typedef enum {
pusch_len1 = 1, pusch_len1 = 1,
pusch_len2 = 2 pusch_len2 = 2
} pusch_maxLength_t; } pusch_maxLength_t;
typedef struct {
uint8_t ptrs_mcs1;
uint8_t ptrs_mcs2;
uint8_t ptrs_mcs3;
} ptrs_time_density_t;
typedef struct {
uint16_t n_rb0;
uint16_t n_rb1;
} ptrs_frequency_density_t;
typedef struct { // The IE PTRS-UplinkConfig is used to configure uplink Phase-Tracking-Reference-Signals (PTRS)
uint8_t num_ptrs_ports;
ptrs_resource_elementoffset_t resourceElementOffset;
ptrs_time_density_t timeDensity;
ptrs_frequency_density_t frequencyDensity;
uint32_t ul_ptrs_power;
} ptrs_UplinkConfig_t;
typedef struct { // The IE DMRS-DownlinkConfig is used to configure downlink demodulation reference signals for PDSCH typedef struct { // The IE DMRS-DownlinkConfig is used to configure downlink demodulation reference signals for PDSCH
pdsch_dmrs_type_t pdsch_dmrs_type; pdsch_dmrs_type_t pdsch_dmrs_type;
pdsch_dmrs_AdditionalPosition_t pdsch_dmrs_AdditionalPosition; pdsch_dmrs_AdditionalPosition_t pdsch_dmrs_AdditionalPosition;
...@@ -563,6 +582,7 @@ typedef struct { // The IE DMRS-UplinkConfig is used to configure uplink demodul ...@@ -563,6 +582,7 @@ typedef struct { // The IE DMRS-UplinkConfig is used to configure uplink demodul
pusch_dmrs_type_t pusch_dmrs_type; pusch_dmrs_type_t pusch_dmrs_type;
pusch_dmrs_AdditionalPosition_t pusch_dmrs_AdditionalPosition; pusch_dmrs_AdditionalPosition_t pusch_dmrs_AdditionalPosition;
pusch_maxLength_t pusch_maxLength; pusch_maxLength_t pusch_maxLength;
ptrs_UplinkConfig_t ptrs_UplinkConfig;
uint16_t scramblingID0; uint16_t scramblingID0;
uint16_t scramblingID1; uint16_t scramblingID1;
} dmrs_UplinkConfig_t; } dmrs_UplinkConfig_t;
...@@ -647,6 +667,10 @@ typedef struct { ...@@ -647,6 +667,10 @@ typedef struct {
* resourceAllocation * resourceAllocation
*/ */
ul_resourceAllocation_t ul_resourceAllocation; ul_resourceAllocation_t ul_resourceAllocation;
/*
* DMRS-Uplinkconfig
*/
dmrs_UplinkConfig_t dmrs_UplinkConfig;
/* /*
* rgb_Size * rgb_Size
*/ */
......
...@@ -244,11 +244,11 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id ...@@ -244,11 +244,11 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id
0, 0,
0, 0,
number_symbols, number_symbols,
&gNB->dmrs_UplinkConfig, &gNB->pusch_config.dmrs_UplinkConfig,
mapping_type, mapping_type,
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
nb_re_dmrs = ((gNB->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; nb_re_dmrs = ((gNB->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols;
G = nr_get_G(nfapi_ulsch_pdu_rel15->number_rbs, G = nr_get_G(nfapi_ulsch_pdu_rel15->number_rbs,
number_symbols, number_symbols,
......
...@@ -428,7 +428,7 @@ int main(int argc, char **argv) ...@@ -428,7 +428,7 @@ int main(int argc, char **argv)
uint16_t number_dmrs_symbols = 0; uint16_t number_dmrs_symbols = 0;
unsigned int available_bits; unsigned int available_bits;
uint8_t nb_re_dmrs; uint8_t nb_re_dmrs;
uint8_t length_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength; uint8_t length_dmrs = UE->pusch_config.dmrs_UplinkConfig.pusch_maxLength;
unsigned char mod_order; unsigned char mod_order;
uint16_t code_rate; uint16_t code_rate;
...@@ -440,12 +440,12 @@ int main(int argc, char **argv) ...@@ -440,12 +440,12 @@ int main(int argc, char **argv)
0, 0,
0, 0,
nb_symb_sch, nb_symb_sch,
&UE->dmrs_UplinkConfig, &UE->pusch_config.dmrs_UplinkConfig,
UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType, UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType,
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
mod_order = nr_get_Qm_ul(Imcs, 0); mod_order = nr_get_Qm_ul(Imcs, 0);
nb_re_dmrs = ((UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1) ? 6 : 4) * number_dmrs_symbols; 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); 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); 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); TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, precod_nbr_layers);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment