Commit 17993d73 authored by adk's avatar adk Committed by Thomas Schlichter

PUSCH PTRS extraction and fixing nr_ulsim

parent 4ebc1dcb
...@@ -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
...@@ -238,6 +238,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -238,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 *) );
...@@ -253,6 +255,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -253,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 );
...@@ -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,
......
...@@ -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;
...@@ -1041,6 +1095,25 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1041,6 +1095,25 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
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 ---------------------
...@@ -1061,19 +1134,17 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1061,19 +1134,17 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
//---------------------------------------------------------- //----------------------------------------------------------
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->pusch_config.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,
...@@ -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");
} }
......
...@@ -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