Commit 00ff5e8a authored by adk's avatar adk Committed by Thomas Schlichter

PUSCH PTRS extraction and fixing nr_ulsim

parent 505d06e9
...@@ -170,7 +170,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -170,7 +170,7 @@ 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; gNB->ptrs_configured = 1;
//------------- config PUSCH PTRS parameters(to be updated from RRC)--------------// //------------- 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_mcs1 = 0; // setting MCS values to 0 indicate abscence of time_density field in the configuration
...@@ -234,32 +234,36 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -234,32 +234,36 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
for (int UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { for (int UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
//FIXME //FIXME
pusch_vars[UE_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) ); pusch_vars[UE_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) );
pusch_vars[UE_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); pusch_vars[UE_id]->rxdataF_ext = (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]->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_estimates_time = (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]->rxdataF_comp = (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_mag0 = (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_magb0 = (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_mag = (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_magb = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); pusch_vars[UE_id]->ul_ch_magb0 = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) ); pusch_vars[UE_id]->ul_ch_mag = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_magb = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
for (i=0; i<fp->nb_antennas_rx; i++) { for (i=0; i<fp->nb_antennas_rx; i++) {
// RK 2 times because of output format of FFT! // RK 2 times because of output format of FFT!
// FIXME We should get rid of this // FIXME We should get rid of this
pusch_vars[UE_id]->rxdataF_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]->rxdataF_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]->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_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size ); 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]->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_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_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_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
pusch_vars[UE_id]->ul_ch_magb0[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 ); 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_mag[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 );
pusch_vars[UE_id]->ul_ch_magb[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_magb0[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 );
pusch_vars[UE_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_UL*12*7*2) ); pusch_vars[UE_id]->ul_ch_mag[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_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 );
pusch_vars[UE_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_UL*12*7*2) );
} }
pusch_vars[UE_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear pusch_vars[UE_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
...@@ -363,6 +367,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -363,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]);
...@@ -376,6 +382,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -376,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);
......
...@@ -748,7 +748,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -748,7 +748,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
/////////////////////////PUSCH PTRS init///////////////////////// /////////////////////////PUSCH PTRS init/////////////////////////
/////////// ///////////
ue->ptrs_configured = 0; // flag to be toggled by RCC ue->ptrs_configured = 1; // flag to be toggled by RCC
//------------- config PTRS parameters--------------// //------------- 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_mcs1 = 0; // setting MCS values to 0 indicate abscence of time_density field in the configuration
......
...@@ -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,
......
...@@ -546,6 +546,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, ...@@ -546,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;
......
...@@ -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