Commit 0d664103 authored by francescomani's avatar francescomani

another round of review

parent 12ccca72
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# define NUMBER_OF_SRS_MAX 16 # define NUMBER_OF_SRS_MAX 16
# define NUMBER_OF_SCH_STATS_MAX 16 # define NUMBER_OF_SCH_STATS_MAX 16
# define NUMBER_FRAMES_PHY_UE_INACTIVE 10 #define NUMBER_FRAMES_PHY_UE_INACTIVE 10
#define MAX_MANAGED_ENB_PER_MOBILE 2 #define MAX_MANAGED_ENB_PER_MOBILE 2
#define MAX_MANAGED_GNB_PER_MOBILE 2 #define MAX_MANAGED_GNB_PER_MOBILE 2
......
...@@ -130,7 +130,6 @@ void tx_func(void *param) { ...@@ -130,7 +130,6 @@ void tx_func(void *param) {
void rx_func(void *param) void rx_func(void *param)
{ {
processingData_L1_t *info = (processingData_L1_t *) param; processingData_L1_t *info = (processingData_L1_t *) param;
PHY_VARS_gNB *gNB = info->gNB; PHY_VARS_gNB *gNB = info->gNB;
int frame_rx = info->frame_rx; int frame_rx = info->frame_rx;
...@@ -179,7 +178,7 @@ void rx_func(void *param) ...@@ -179,7 +178,7 @@ void rx_func(void *param)
reset_active_ulsch(gNB, frame_tx); reset_active_ulsch(gNB, frame_tx);
// RX processing // RX processing
int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); int rx_slot_type = nr_slot_select(cfg, frame_rx, slot_rx);
if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) { if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) {
// UE-specific RX processing for subframe n // UE-specific RX processing for subframe n
// TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT // TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT
......
...@@ -1220,8 +1220,10 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, ...@@ -1220,8 +1220,10 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
if (tx_data != NULL) { if (tx_data != NULL) {
uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct; uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct;
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols); //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols);
AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch,"Number of PDSCH PDUs %d exceeded the limit %d\n", AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch,
msgTx->num_pdsch_slot, gNB->max_nb_pdsch); "Number of PDSCH PDUs %d exceeded the limit %d\n",
msgTx->num_pdsch_slot,
gNB->max_nb_pdsch);
handle_nr_nfapi_pdsch_pdu(msgTx, pdsch_pdu, dlsch_sdu); handle_nr_nfapi_pdsch_pdu(msgTx, pdsch_pdu, dlsch_sdu);
} }
else { else {
......
...@@ -96,7 +96,7 @@ NR_gNB_PHY_STATS_t *get_phy_stats(PHY_VARS_gNB *gNB, uint16_t rnti) ...@@ -96,7 +96,7 @@ NR_gNB_PHY_STATS_t *get_phy_stats(PHY_VARS_gNB *gNB, uint16_t rnti)
memset(&stats->dlsch_stats, 0, sizeof(stats->dlsch_stats)); memset(&stats->dlsch_stats, 0, sizeof(stats->dlsch_stats));
memset(&stats->ulsch_stats, 0, sizeof(stats->ulsch_stats)); memset(&stats->ulsch_stats, 0, sizeof(stats->ulsch_stats));
memset(&stats->uci_stats, 0, sizeof(stats->uci_stats)); memset(&stats->uci_stats, 0, sizeof(stats->uci_stats));
return(stats); return stats;
} }
void reset_active_stats(PHY_VARS_gNB *gNB, int frame) void reset_active_stats(PHY_VARS_gNB *gNB, int frame)
...@@ -104,7 +104,7 @@ void reset_active_stats(PHY_VARS_gNB *gNB, int frame) ...@@ -104,7 +104,7 @@ void reset_active_stats(PHY_VARS_gNB *gNB, int frame)
// disactivate PHY stats if UE is inactive for a given number of frames // disactivate PHY stats if UE is inactive for a given number of frames
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) { for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i]; NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
if(stats->active && (((frame - stats->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE)) if (stats->active && (((frame - stats->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE))
stats->active = false; stats->active = false;
} }
} }
...@@ -695,52 +695,54 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -695,52 +695,54 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
int nb_re_pusch = N_RB_UL * NR_NB_SC_PER_RB; int nb_re_pusch = N_RB_UL * NR_NB_SC_PER_RB;
int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7); int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7);
NR_gNB_PUSCH **pusch_vars = (NR_gNB_PUSCH **)malloc16_clear(gNB->max_nb_pusch * sizeof(NR_gNB_PUSCH*)); gNB->pusch_vars = (NR_gNB_PUSCH *)malloc16_clear(gNB->max_nb_pusch * sizeof(NR_gNB_PUSCH));
for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) { for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) {
pusch_vars[ULSCH_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) ); NR_gNB_PUSCH *pusch = &gNB->pusch_vars[ULSCH_id];
pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) ); pusch->rxdataF_ext = (int32_t **)malloc16(Prx * sizeof(int32_t *));
pusch_vars[ULSCH_id]->ul_ch_estimates = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); pusch->ul_ch_estimates = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch_vars[ULSCH_id]->ul_ch_estimates_ext = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); pusch->ul_ch_estimates_ext = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch_vars[ULSCH_id]->ptrs_phase_per_slot = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); pusch->ptrs_phase_per_slot = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch_vars[ULSCH_id]->ul_ch_estimates_time = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); pusch->ul_ch_estimates_time = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch_vars[ULSCH_id]->rxdataF_comp = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); pusch->rxdataF_comp = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch_vars[ULSCH_id]->ul_ch_mag0 = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); pusch->ul_ch_mag0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch_vars[ULSCH_id]->ul_ch_magb0 = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); pusch->ul_ch_magb0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch_vars[ULSCH_id]->ul_ch_mag = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); pusch->ul_ch_mag = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch_vars[ULSCH_id]->ul_ch_magb = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); pusch->ul_ch_magb = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch_vars[ULSCH_id]->rho = (int32_t ***)malloc16(Prx*sizeof(int32_t **) ); pusch->rho = (int32_t ***)malloc16(Prx * sizeof(int32_t **));
pusch_vars[ULSCH_id]->llr_layers = (int16_t **)malloc16(max_ul_mimo_layers*sizeof(int32_t *) ); pusch->llr_layers = (int16_t **)malloc16(max_ul_mimo_layers * sizeof(int32_t *));
for (i=0; i<Prx; i++) { for (i=0; i<Prx; i++) {
pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*nb_re_pusch2*fp->symbols_per_slot ); pusch->rxdataF_ext[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch_vars[ULSCH_id]->rho[i] = (int32_t **)malloc16_clear(NR_MAX_NB_LAYERS*NR_MAX_NB_LAYERS*sizeof(int32_t*)); pusch->rho[i] = (int32_t **)malloc16_clear(NR_MAX_NB_LAYERS * NR_MAX_NB_LAYERS * sizeof(int32_t *));
for (int j=0; j< max_ul_mimo_layers; j++) { for (int j=0; j< max_ul_mimo_layers; j++) {
for (int k=0; k<max_ul_mimo_layers; k++) { for (int k=0; k<max_ul_mimo_layers; k++) {
pusch_vars[ULSCH_id]->rho[i][j*max_ul_mimo_layers+k]=(int32_t *)malloc16_clear( sizeof(int32_t)*nb_re_pusch2*fp->symbols_per_slot ); pusch->rho[i][j * max_ul_mimo_layers + k] =
(int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
} }
} }
} }
for (i=0; i<n_buf; i++) { for (i=0; i<n_buf; i++) {
pusch_vars[ULSCH_id]->ul_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_slot ); pusch->ul_ch_estimates[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->ofdm_symbol_size * fp->symbols_per_slot);
pusch_vars[ULSCH_id]->ul_ch_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*nb_re_pusch2*fp->symbols_per_slot ); pusch->ul_ch_estimates_ext[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch_vars[ULSCH_id]->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size ); pusch->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->ofdm_symbol_size);
pusch_vars[ULSCH_id]->ptrs_phase_per_slot[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot); // symbols per slot pusch->ptrs_phase_per_slot[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->symbols_per_slot); // symbols per slot
pusch_vars[ULSCH_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*nb_re_pusch2*fp->symbols_per_slot ); pusch->rxdataF_comp[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch_vars[ULSCH_id]->ul_ch_mag0[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*nb_re_pusch2*fp->symbols_per_slot ); pusch->ul_ch_mag0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch_vars[ULSCH_id]->ul_ch_magb0[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*nb_re_pusch2*fp->symbols_per_slot ); pusch->ul_ch_magb0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch_vars[ULSCH_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*nb_re_pusch2*fp->symbols_per_slot ); pusch->ul_ch_mag[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch_vars[ULSCH_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*nb_re_pusch2*fp->symbols_per_slot ); pusch->ul_ch_magb[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
} }
for (i=0; i< max_ul_mimo_layers; i++) { for (i=0; i< max_ul_mimo_layers; i++) {
pusch_vars[ULSCH_id]->llr_layers[i] = (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->llr_layers[i] = (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[ULSCH_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->llr = (int16_t *)malloc16_clear((8 * ((3 * 8 * 6144) + 12))
pusch_vars[ULSCH_id]->ul_valid_re_per_slot = (int16_t *)malloc16_clear( sizeof(int16_t)*fp->symbols_per_slot); * sizeof(int16_t)); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
} //ulsch_id pusch->ul_valid_re_per_slot = (int16_t *)malloc16_clear(sizeof(int16_t) * fp->symbols_per_slot);
} // ulsch_id
gNB->pusch_vars = pusch_vars;
return (0); return (0);
} }
...@@ -845,46 +847,46 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -845,46 +847,46 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(prach_vars->rxsigF); free_and_zero(prach_vars->rxsigF);
free_and_zero(prach_vars->prach_ifft); free_and_zero(prach_vars->prach_ifft);
NR_gNB_PUSCH** pusch_vars = gNB->pusch_vars;
for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) { for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) {
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ULSCH_id];
for (int i=0; i< max_ul_mimo_layers; i++) for (int i=0; i< max_ul_mimo_layers; i++)
free_and_zero(pusch_vars[ULSCH_id]->llr_layers[i]); free_and_zero(pusch_vars->llr_layers[i]);
for (int i = 0; i < Prx; i++) { for (int i = 0; i < Prx; i++) {
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]); free_and_zero(pusch_vars->rxdataF_ext[i]);
for (int j=0; j< max_ul_mimo_layers; j++) { for (int j=0; j< max_ul_mimo_layers; j++) {
for (int k=0; k<max_ul_mimo_layers; k++) for (int k=0; k<max_ul_mimo_layers; k++)
free_and_zero(pusch_vars[ULSCH_id]->rho[i][j*max_ul_mimo_layers+k]); free_and_zero(pusch_vars->rho[i][j * max_ul_mimo_layers + k]);
} }
free_and_zero(pusch_vars[ULSCH_id]->rho[i]); free_and_zero(pusch_vars->rho[i]);
} }
for (int i = 0; i < n_buf; i++) { for (int i = 0; i < n_buf; i++) {
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates[i]); free_and_zero(pusch_vars->ul_ch_estimates[i]);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_ext[i]); free_and_zero(pusch_vars->ul_ch_estimates_ext[i]);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time[i]); free_and_zero(pusch_vars->ul_ch_estimates_time[i]);
free_and_zero(pusch_vars[ULSCH_id]->ptrs_phase_per_slot[i]); free_and_zero(pusch_vars->ptrs_phase_per_slot[i]);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp[i]); free_and_zero(pusch_vars->rxdataF_comp[i]);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag0[i]); free_and_zero(pusch_vars->ul_ch_mag0[i]);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb0[i]); free_and_zero(pusch_vars->ul_ch_magb0[i]);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag[i]); free_and_zero(pusch_vars->ul_ch_mag[i]);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb[i]); free_and_zero(pusch_vars->ul_ch_magb[i]);
} }
free_and_zero(pusch_vars[ULSCH_id]->llr_layers); free_and_zero(pusch_vars->llr_layers);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext); free_and_zero(pusch_vars->rxdataF_ext);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates); free_and_zero(pusch_vars->ul_ch_estimates);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_ext); free_and_zero(pusch_vars->ul_ch_estimates_ext);
free_and_zero(pusch_vars[ULSCH_id]->ptrs_phase_per_slot); free_and_zero(pusch_vars->ptrs_phase_per_slot);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time); free_and_zero(pusch_vars->ul_ch_estimates_time);
free_and_zero(pusch_vars[ULSCH_id]->ul_valid_re_per_slot); free_and_zero(pusch_vars->ul_valid_re_per_slot);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp); free_and_zero(pusch_vars->rxdataF_comp);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag0); free_and_zero(pusch_vars->ul_ch_mag0);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb0); free_and_zero(pusch_vars->ul_ch_magb0);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag); free_and_zero(pusch_vars->ul_ch_mag);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb); free_and_zero(pusch_vars->ul_ch_magb);
free_and_zero(pusch_vars[ULSCH_id]->rho); free_and_zero(pusch_vars->rho);
free_and_zero(pusch_vars[ULSCH_id]->llr); free_and_zero(pusch_vars->llr);
free_and_zero(pusch_vars[ULSCH_id]); free_and_zero(pusch_vars);
} //ULSCH_id } // ULSCH_id
free(gNB->pusch_vars); free(gNB->pusch_vars);
} }
...@@ -965,7 +967,6 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, ...@@ -965,7 +967,6 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
LOG_I(PHY,"gNB configured\n"); LOG_I(PHY,"gNB configured\n");
} }
void nr_phy_config_request(NR_PHY_Config_t *phy_config) void nr_phy_config_request(NR_PHY_Config_t *phy_config)
{ {
uint8_t Mod_id = phy_config->Mod_id; uint8_t Mod_id = phy_config->Mod_id;
...@@ -1026,14 +1027,13 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) ...@@ -1026,14 +1027,13 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg)
uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value; uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value;
msg->num_pdsch_slot = 0; msg->num_pdsch_slot = 0;
msg->dlsch = malloc16(gNB->max_nb_pdsch * sizeof(NR_gNB_DLSCH_t **)); msg->dlsch = malloc16(gNB->max_nb_pdsch * sizeof(NR_gNB_DLSCH_t *));
int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; int num_cw = NR_MAX_NB_LAYERS > 4? 2:1;
for (int i = 0; i < gNB->max_nb_pdsch; i++) { for (int i = 0; i < gNB->max_nb_pdsch; i++) {
LOG_D(PHY, "Allocating Transport Channel Buffers for DLSCH %d/%d\n", i, gNB->max_nb_pdsch); LOG_D(PHY, "Allocating Transport Channel Buffers for DLSCH %d/%d\n", i, gNB->max_nb_pdsch);
msg->dlsch[i] = (NR_gNB_DLSCH_t **)malloc16(num_cw * sizeof(NR_gNB_DLSCH_t *)); msg->dlsch[i] = (NR_gNB_DLSCH_t *)malloc16(num_cw * sizeof(NR_gNB_DLSCH_t));
for (int j = 0; j < num_cw; j++) { for (int j = 0; j < num_cw; j++) {
msg->dlsch[i][j] = new_gNB_dlsch(fp, grid_size); msg->dlsch[i][j] = new_gNB_dlsch(fp, grid_size);
AssertFatal(msg->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i);
} }
} }
} }
...@@ -1045,9 +1045,8 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) ...@@ -1045,9 +1045,8 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg)
const uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value; const uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value;
int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; int num_cw = NR_MAX_NB_LAYERS > 4? 2:1;
for (int i = 0; i < gNB->max_nb_pdsch; i++) { for (int i = 0; i < gNB->max_nb_pdsch; i++) {
for (int j=0; j<num_cw; j++) { for (int j = 0; j < num_cw; j++) {
free_gNB_dlsch(&msg->dlsch[i][j], grid_size, fp); free_gNB_dlsch(&msg->dlsch[i][j], grid_size, fp);
free(msg->dlsch[i][j]);
} }
free(msg->dlsch[i]); free(msg->dlsch[i]);
} }
...@@ -1089,28 +1088,19 @@ void init_nr_transport(PHY_VARS_gNB *gNB) ...@@ -1089,28 +1088,19 @@ void init_nr_transport(PHY_VARS_gNB *gNB)
gNB->max_nb_pusch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1; gNB->max_nb_pusch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1;
gNB->max_nb_srs = buffer_ul_slots << 1; // assuming at most 2 SRS per slot gNB->max_nb_srs = buffer_ul_slots << 1; // assuming at most 2 SRS per slot
gNB->pucch = (NR_gNB_PUCCH_t **) malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t*)); gNB->pucch = (NR_gNB_PUCCH_t *)malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t));
for (int i = 0; i < gNB->max_nb_pucch; i++) { for (int i = 0; i < gNB->max_nb_pucch; i++) {
LOG_D(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n", i, gNB->max_nb_pucch); memset(&gNB->pucch[i], 0, sizeof(gNB->pucch[i]));
gNB->pucch[i] = new_gNB_pucch();
AssertFatal(gNB->pucch[i] != NULL,"Can't initialize pucch %d \n", i);
} }
gNB->srs = (NR_gNB_SRS_t **) malloc16(gNB->max_nb_srs * sizeof(NR_gNB_SRS_t*)); gNB->srs = (NR_gNB_SRS_t *)malloc16(gNB->max_nb_srs * sizeof(NR_gNB_SRS_t));
for (int i = 0; i < gNB->max_nb_srs; i++) { for (int i = 0; i < gNB->max_nb_srs; i++)
LOG_D(PHY,"Allocating Transport Channel Buffers for SRS %d/%d\n", i, gNB->max_nb_srs); gNB->srs[i].active = 0;
gNB->srs[i] = new_gNB_srs();
AssertFatal(gNB->srs[i]!=NULL,"Can't initialize srs %d \n", i);
}
gNB->ulsch = (NR_gNB_ULSCH_t **) malloc16(gNB->max_nb_pusch * sizeof(NR_gNB_ULSCH_t*)); gNB->ulsch = (NR_gNB_ULSCH_t *)malloc16(gNB->max_nb_pusch * sizeof(NR_gNB_ULSCH_t));
for (int i = 0; i < gNB->max_nb_pusch; i++) { for (int i = 0; i < gNB->max_nb_pusch; i++) {
LOG_D(PHY, "Allocating Transport Channel Buffers for ULSCH %d/%d\n", i, gNB->max_nb_pusch); LOG_D(PHY, "Allocating Transport Channel Buffers for ULSCH %d/%d\n", i, gNB->max_nb_pusch);
gNB->ulsch[i] = new_gNB_ulsch(gNB->max_ldpc_iterations, fp->N_RB_UL); gNB->ulsch[i] = new_gNB_ulsch(gNB->max_ldpc_iterations, fp->N_RB_UL);
if (!gNB->ulsch[i]) {
LOG_E(PHY,"Can't get gNB ulsch structures\n");
exit(-1);
}
} }
gNB->rx_total_gain_dB=130; gNB->rx_total_gain_dB=130;
...@@ -1122,15 +1112,9 @@ void reset_nr_transport(PHY_VARS_gNB *gNB) ...@@ -1122,15 +1112,9 @@ void reset_nr_transport(PHY_VARS_gNB *gNB)
{ {
const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
for (int i = 0; i < gNB->max_nb_pucch; i++)
free_gNB_pucch(gNB->pucch[i]);
free(gNB->pucch); free(gNB->pucch);
for (int i = 0; i < gNB->max_nb_srs; i++)
free_gNB_srs(gNB->srs[i]);
free(gNB->srs); free(gNB->srs);
for (int i = 0; i < gNB->max_nb_pusch; i++) for (int i = 0; i < gNB->max_nb_pusch; i++)
free_gNB_ulsch(&gNB->ulsch[i], fp->N_RB_UL); free_gNB_ulsch(&gNB->ulsch[i], fp->N_RB_UL);
free(gNB->ulsch);
} }
...@@ -208,9 +208,12 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb ...@@ -208,9 +208,12 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
// //
// Todo: // Todo:
// - averaging IIR filter for RX power and noise // - averaging IIR filter for RX power and noise
void nr_gnb_measurements(PHY_VARS_gNB *gNB, NR_gNB_ULSCH_t *ulsch, NR_gNB_PUSCH *pusch_vars, unsigned char symbol, uint8_t nrOfLayers) void nr_gnb_measurements(PHY_VARS_gNB *gNB,
NR_gNB_ULSCH_t *ulsch,
NR_gNB_PUSCH *pusch_vars,
unsigned char symbol,
uint8_t nrOfLayers)
{ {
int rx_power_tot = 0; int rx_power_tot = 0;
unsigned short rx_power_avg_dB; unsigned short rx_power_avg_dB;
unsigned short rx_power_tot_dB; unsigned short rx_power_tot_dB;
...@@ -225,34 +228,35 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, NR_gNB_ULSCH_t *ulsch, NR_gNB_PUSCH ...@@ -225,34 +228,35 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, NR_gNB_ULSCH_t *ulsch, NR_gNB_PUSCH
int rx_power[fp->nb_antennas_rx]; int rx_power[fp->nb_antennas_rx];
for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){ for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){
rx_power[aarx] = 0; rx_power[aarx] = 0;
for (int aatx = 0; aatx < nrOfLayers; aatx++){ for (int aatx = 0; aatx < nrOfLayers; aatx++){
ulsch_measurements->rx_spatial_power[aatx][aarx] =
ulsch_measurements->rx_spatial_power[aatx][aarx] = (signal_energy_nodc(&pusch_vars->ul_ch_estimates[aatx*fp->nb_antennas_rx+aarx][ch_offset], N_RB_UL * NR_NB_SC_PER_RB)); (signal_energy_nodc(&pusch_vars->ul_ch_estimates[aatx * fp->nb_antennas_rx + aarx][ch_offset],
N_RB_UL * NR_NB_SC_PER_RB));
if (ulsch_measurements->rx_spatial_power[aatx][aarx] < 0) { if (ulsch_measurements->rx_spatial_power[aatx][aarx] < 0) {
ulsch_measurements->rx_spatial_power[aatx][aarx] = 0; ulsch_measurements->rx_spatial_power[aatx][aarx] = 0;
} }
ulsch_measurements->rx_spatial_power_dB[aatx][aarx] = (unsigned short) dB_fixed(ulsch_measurements->rx_spatial_power[aatx][aarx]); ulsch_measurements->rx_spatial_power_dB[aatx][aarx] =
(unsigned short)dB_fixed(ulsch_measurements->rx_spatial_power[aatx][aarx]);
rx_power[aarx] += ulsch_measurements->rx_spatial_power[aatx][aarx]; rx_power[aarx] += ulsch_measurements->rx_spatial_power[aatx][aarx];
} }
LOG_D(PHY, "[RNTI %04x] RX power in antenna %d = %d\n", ulsch->rnti, aarx, rx_power[aarx]); LOG_D(PHY, "[RNTI %04x] RX power in antenna %d = %d\n", ulsch->rnti, aarx, rx_power[aarx]);
rx_power_tot += rx_power[aarx]; rx_power_tot += rx_power[aarx];
} }
rx_power_tot_dB = (unsigned short) dB_fixed(rx_power_tot); rx_power_tot_dB = (unsigned short)dB_fixed(rx_power_tot);
rx_power_avg_dB = rx_power_tot_dB; rx_power_avg_dB = rx_power_tot_dB;
ulsch_measurements->wideband_cqi_tot = dB_fixed2(rx_power_tot, meas->n0_power_tot); ulsch_measurements->wideband_cqi_tot = dB_fixed2(rx_power_tot, meas->n0_power_tot);
ulsch_measurements->rx_rssi_dBm = rx_power_avg_dB + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size); ulsch_measurements->rx_rssi_dBm =
rx_power_avg_dB + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size);
LOG_D(PHY, "[RNTI %04x] RSSI %d dBm/RE, RSSI (digital) %d dB (N_RB_UL %d), WBand CQI tot %d dB, N0 Power tot %d, RX Power tot %d\n", LOG_D(PHY,
"[RNTI %04x] RSSI %d dBm/RE, RSSI (digital) %d dB (N_RB_UL %d), WBand CQI tot %d dB, N0 Power tot %d, RX Power tot %d\n",
ulsch->rnti, ulsch->rnti,
ulsch_measurements->rx_rssi_dBm, ulsch_measurements->rx_rssi_dBm,
rx_power_avg_dB, rx_power_avg_dB,
......
...@@ -130,7 +130,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -130,7 +130,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
debug_ch_est = fopen("debug_ch_est.txt","w"); debug_ch_est = fopen("debug_ch_est.txt","w");
#endif #endif
//uint16_t Nid_cell = (eNB_offset == 0) ? gNB->frame_parms.Nid_cell : gNB->measurements.adj_cell_id[eNB_offset-1]; //uint16_t Nid_cell = (eNB_offset == 0) ? gNB->frame_parms.Nid_cell : gNB->measurements.adj_cell_id[eNB_offset-1];
c16_t **ul_ch_estimates = (c16_t **) gNB->pusch_vars[ul_id]->ul_ch_estimates; NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ul_id];
c16_t **ul_ch_estimates = (c16_t **)pusch_vars->ul_ch_estimates;
const int symbolSize = gNB->frame_parms.ofdm_symbol_size; const int symbolSize = gNB->frame_parms.ofdm_symbol_size;
const int soffset = (Ns&3)*gNB->frame_parms.symbols_per_slot*symbolSize; const int soffset = (Ns&3)*gNB->frame_parms.symbols_per_slot*symbolSize;
const int nushift = (p>>1)&1; const int nushift = (p>>1)&1;
...@@ -187,8 +188,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -187,8 +188,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
c16_t ul_ls_est[symbolSize] __attribute__((aligned(32))); c16_t ul_ls_est[symbolSize] __attribute__((aligned(32)));
memset(ul_ls_est, 0, sizeof(c16_t) * symbolSize); memset(ul_ls_est, 0, sizeof(c16_t) * symbolSize);
NR_ULSCH_delay_t *delay = &gNB->ulsch[ul_id]->delay; NR_ULSCH_delay_t *delay = &gNB->ulsch[ul_id].delay;
memset(&delay, 0, sizeof(delay)); memset(delay, 0, sizeof(*delay));
for (int aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) { for (int aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) {
c16_t *rxdataF = (c16_t *)&gNB->common_vars.rxdataF[aarx][symbol_offset]; c16_t *rxdataF = (c16_t *)&gNB->common_vars.rxdataF[aarx][symbol_offset];
...@@ -229,11 +230,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -229,11 +230,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
pilot_cnt += 2; pilot_cnt += 2;
} }
freq2time(symbolSize, freq2time(symbolSize, (int16_t *)ul_ls_est, (int16_t *)pusch_vars->ul_ch_estimates_time[aarx]);
(int16_t *) ul_ls_est,
(int16_t *) gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx]);
nr_est_timing_advance_pusch(&gNB->frame_parms, gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx], delay); nr_est_timing_advance_pusch(&gNB->frame_parms, pusch_vars->ul_ch_estimates_time[aarx], delay);
int pusch_delay = delay->pusch_est_delay; int pusch_delay = delay->pusch_est_delay;
int delay_idx = get_delay_idx(pusch_delay); int delay_idx = get_delay_idx(pusch_delay);
c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx]; c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx];
...@@ -311,8 +310,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -311,8 +310,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
} }
// Delay compensation // Delay compensation
freq2time(symbolSize, (int16_t *)ul_ls_est, (int16_t *)gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx]); freq2time(symbolSize, (int16_t *)ul_ls_est, (int16_t *)pusch_vars->ul_ch_estimates_time[aarx]);
nr_est_timing_advance_pusch(&gNB->frame_parms, gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx], delay); nr_est_timing_advance_pusch(&gNB->frame_parms, pusch_vars->ul_ch_estimates_time[aarx], delay);
int pusch_delay = delay->pusch_est_delay; int pusch_delay = delay->pusch_est_delay;
int delay_idx = get_delay_idx(-pusch_delay); int delay_idx = get_delay_idx(-pusch_delay);
c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx]; c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx];
...@@ -533,7 +532,9 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -533,7 +532,9 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
uint8_t ulsch_id, uint8_t ulsch_id,
uint8_t nr_tti_rx, uint8_t nr_tti_rx,
unsigned char symbol, unsigned char symbol,
uint32_t nb_re_pusch) { uint32_t nb_re_pusch)
{
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ulsch_id];
//#define DEBUG_UL_PTRS 1 //#define DEBUG_UL_PTRS 1
int32_t *ptrs_re_symbol = NULL; int32_t *ptrs_re_symbol = NULL;
int8_t ret = 0; int8_t ret = 0;
...@@ -543,16 +544,16 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -543,16 +544,16 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
uint8_t *L_ptrs = &rel15_ul->pusch_ptrs.ptrs_time_density; uint8_t *L_ptrs = &rel15_ul->pusch_ptrs.ptrs_time_density;
uint8_t *K_ptrs = &rel15_ul->pusch_ptrs.ptrs_freq_density; uint8_t *K_ptrs = &rel15_ul->pusch_ptrs.ptrs_freq_density;
uint16_t *dmrsSymbPos = &rel15_ul->ul_dmrs_symb_pos; uint16_t *dmrsSymbPos = &rel15_ul->ul_dmrs_symb_pos;
uint16_t *ptrsSymbPos = &gNB->pusch_vars[ulsch_id]->ptrs_symbols; uint16_t *ptrsSymbPos = &pusch_vars->ptrs_symbols;
uint8_t *ptrsSymbIdx = &gNB->pusch_vars[ulsch_id]->ptrs_symbol_index; uint8_t *ptrsSymbIdx = &pusch_vars->ptrs_symbol_index;
uint8_t *dmrsConfigType = &rel15_ul->dmrs_config_type; uint8_t *dmrsConfigType = &rel15_ul->dmrs_config_type;
uint16_t *nb_rb = &rel15_ul->rb_size; uint16_t *nb_rb = &rel15_ul->rb_size;
uint8_t *ptrsReOffset = &rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset; uint8_t *ptrsReOffset = &rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset;
/* loop over antennas */ /* loop over antennas */
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
c16_t *phase_per_symbol = (c16_t*)gNB->pusch_vars[ulsch_id]->ptrs_phase_per_slot[aarx]; c16_t *phase_per_symbol = (c16_t *)pusch_vars->ptrs_phase_per_slot[aarx];
ptrs_re_symbol = &gNB->pusch_vars[ulsch_id]->ptrs_re_per_slot; ptrs_re_symbol = &pusch_vars->ptrs_re_per_slot;
*ptrs_re_symbol = 0; *ptrs_re_symbol = 0;
phase_per_symbol[symbol].i = 0; phase_per_symbol[symbol].i = 0;
/* set DMRS estimates to 0 angle with magnitude 1 */ /* set DMRS estimates to 0 angle with magnitude 1 */
...@@ -585,13 +586,17 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -585,13 +586,17 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
/*------------------------------------------------------------------------------------------------------- */ /*------------------------------------------------------------------------------------------------------- */
/* 1) Estimate common phase error per PTRS symbol */ /* 1) Estimate common phase error per PTRS symbol */
/*------------------------------------------------------------------------------------------------------- */ /*------------------------------------------------------------------------------------------------------- */
nr_ptrs_cpe_estimation(*K_ptrs,*ptrsReOffset,*dmrsConfigType,*nb_rb, nr_ptrs_cpe_estimation(*K_ptrs,
*ptrsReOffset,
*dmrsConfigType,
*nb_rb,
rel15_ul->rnti, rel15_ul->rnti,
nr_tti_rx, nr_tti_rx,
symbol,frame_parms->ofdm_symbol_size, symbol,
(int16_t *)&gNB->pusch_vars[ulsch_id]->rxdataF_comp[aarx][(symbol * nb_re_pusch)], frame_parms->ofdm_symbol_size,
(int16_t *)&pusch_vars->rxdataF_comp[aarx][(symbol * nb_re_pusch)],
gNB->nr_gold_pusch_dmrs[rel15_ul->scid][nr_tti_rx][symbol], gNB->nr_gold_pusch_dmrs[rel15_ul->scid][nr_tti_rx][symbol],
(int16_t*)&phase_per_symbol[symbol], (int16_t *)&phase_per_symbol[symbol],
ptrs_re_symbol); ptrs_re_symbol);
} }
...@@ -609,7 +614,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -609,7 +614,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
} }
#ifdef DEBUG_UL_PTRS #ifdef DEBUG_UL_PTRS
LOG_M("ptrsEstUl.m","est",gNB->pusch_vars[ulsch_id]->ptrs_phase_per_slot[aarx],frame_parms->symbols_per_slot,1,1 ); LOG_M("ptrsEstUl.m", "est", pusch_vars->ptrs_phase_per_slot[aarx], frame_parms->symbols_per_slot, 1, 1);
LOG_M("rxdataF_bf_ptrs_comp_ul.m","bf_ptrs_cmp", LOG_M("rxdataF_bf_ptrs_comp_ul.m","bf_ptrs_cmp",
&gNB->pusch_vars[0]->rxdataF_comp[aarx][rel15_ul->start_symbol_index * NR_NB_SC_PER_RB * rel15_ul->rb_size], &gNB->pusch_vars[0]->rxdataF_comp[aarx][rel15_ul->start_symbol_index * NR_NB_SC_PER_RB * rel15_ul->rb_size],
rel15_ul->nr_of_symbols * NR_NB_SC_PER_RB * rel15_ul->rb_size,1,1); rel15_ul->nr_of_symbols * NR_NB_SC_PER_RB * rel15_ul->rb_size,1,1);
...@@ -625,10 +630,11 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -625,10 +630,11 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
#ifdef DEBUG_UL_PTRS #ifdef DEBUG_UL_PTRS
printf("[PHY][UL][PTRS]: Rotate Symbol %2d with %d + j* %d\n", i, phase_per_symbol[i].r,phase_per_symbol[i].i); printf("[PHY][UL][PTRS]: Rotate Symbol %2d with %d + j* %d\n", i, phase_per_symbol[i].r,phase_per_symbol[i].i);
#endif #endif
rotate_cpx_vector((c16_t*)&gNB->pusch_vars[ulsch_id]->rxdataF_comp[aarx][(i * rel15_ul->rb_size * NR_NB_SC_PER_RB)], rotate_cpx_vector((c16_t *)&pusch_vars->rxdataF_comp[aarx][(i * rel15_ul->rb_size * NR_NB_SC_PER_RB)],
&phase_per_symbol[i], &phase_per_symbol[i],
(c16_t*)&gNB->pusch_vars[ulsch_id]->rxdataF_comp[aarx][(i * rel15_ul->rb_size * NR_NB_SC_PER_RB)], (c16_t *)&pusch_vars->rxdataF_comp[aarx][(i * rel15_ul->rb_size * NR_NB_SC_PER_RB)],
((*nb_rb) * NR_NB_SC_PER_RB), 15); ((*nb_rb) * NR_NB_SC_PER_RB),
15);
}// if not DMRS Symbol }// if not DMRS Symbol
}// symbol loop }// symbol loop
}// last symbol check }// last symbol check
......
...@@ -53,9 +53,15 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB); ...@@ -53,9 +53,15 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB);
void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot,int first_symb,int num_symb); void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot,int first_symb,int num_symb);
void nr_gnb_measurements(PHY_VARS_gNB *gNB, NR_gNB_ULSCH_t *ulsch, NR_gNB_PUSCH *pusch_vars, unsigned char symbol, uint8_t nrOfLayers); void nr_gnb_measurements(PHY_VARS_gNB *gNB,
NR_gNB_ULSCH_t *ulsch,
NR_gNB_PUSCH *pusch_vars,
unsigned char symbol,
uint8_t nrOfLayers);
void nr_est_timing_advance_pusch(const NR_DL_FRAME_PARMS *frame_parms, const int32_t *ul_ch_estimates_time, NR_ULSCH_delay_t *delay); void nr_est_timing_advance_pusch(const NR_DL_FRAME_PARMS *frame_parms,
const int32_t *ul_ch_estimates_time,
NR_ULSCH_delay_t *delay);
int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms, int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms,
const int32_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]); const int32_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]);
......
...@@ -75,7 +75,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -75,7 +75,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
time_stats_t *dlsch_segmentation_stats=&gNB->dlsch_segmentation_stats; time_stats_t *dlsch_segmentation_stats=&gNB->dlsch_segmentation_stats;
for (int dlsch_id=0; dlsch_id<msgTx->num_pdsch_slot; dlsch_id++) { for (int dlsch_id=0; dlsch_id<msgTx->num_pdsch_slot; dlsch_id++) {
dlsch = msgTx->dlsch[dlsch_id][0]; dlsch = &msgTx->dlsch[dlsch_id][0];
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
...@@ -567,12 +567,12 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -567,12 +567,12 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
} }
void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB) { void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) { for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i]; NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
if (stats->active && stats->frame != stats->dlsch_stats.dump_frame) { if (stats->active && stats->frame != stats->dlsch_stats.dump_frame) {
stats->dlsch_stats.dump_frame = stats->frame; stats->dlsch_stats.dump_frame = stats->frame;
fprintf(fd,"DLSCH RNTI %x: current_Qm %d, current_RI %d, total_bytes TX %d\n", fprintf(fd,
"DLSCH RNTI %x: current_Qm %d, current_RI %d, total_bytes TX %d\n",
stats->rnti, stats->rnti,
stats->dlsch_stats.current_Qm, stats->dlsch_stats.current_Qm,
stats->dlsch_stats.current_RI, stats->dlsch_stats.current_RI,
......
...@@ -48,13 +48,8 @@ ...@@ -48,13 +48,8 @@
//#define DEBUG_DLSCH_CODING //#define DEBUG_DLSCH_CODING
//#define DEBUG_DLSCH_FREE 1 //#define DEBUG_DLSCH_FREE 1
void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARMS *frame_parms)
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, {
uint16_t N_RB,
const NR_DL_FRAME_PARMS* frame_parms) {
NR_gNB_DLSCH_t *dlsch = *dlschptr;
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS; int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers;
...@@ -92,14 +87,10 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, ...@@ -92,14 +87,10 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr,
} }
free(dlsch->txdataF); free(dlsch->txdataF);
free(dlsch->ue_spec_bf_weights); free(dlsch->ue_spec_bf_weights);
free(dlsch);
*dlschptr = NULL;
} }
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
uint16_t N_RB) { {
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS; int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated
...@@ -110,34 +101,32 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, ...@@ -110,34 +101,32 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
LOG_D(PHY,"Allocating %d segments (MAX %d, N_PRB %d)\n",a_segments,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER,N_RB); LOG_D(PHY,"Allocating %d segments (MAX %d, N_PRB %d)\n",a_segments,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER,N_RB);
uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
NR_gNB_DLSCH_t *dlsch = malloc16(sizeof(NR_gNB_DLSCH_t)); NR_gNB_DLSCH_t dlsch;
AssertFatal(dlsch, "cannot allocate dlsch\n");
bzero(dlsch,sizeof(NR_gNB_DLSCH_t));
int txdataf_size = frame_parms->N_RB_DL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8; // max pdsch encoded length for each layer int txdataf_size = frame_parms->N_RB_DL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8; // max pdsch encoded length for each layer
dlsch->txdataF = (int32_t **)malloc16(max_layers*sizeof(int32_t *)); dlsch.txdataF = (int32_t **)malloc16(max_layers * sizeof(int32_t *));
dlsch->ue_spec_bf_weights = (int32_t ***)malloc16(max_layers*sizeof(int32_t **)); dlsch.ue_spec_bf_weights = (int32_t ***)malloc16(max_layers * sizeof(int32_t **));
for (int layer=0; layer<max_layers; layer++) { for (int layer=0; layer<max_layers; layer++) {
dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64*sizeof(int32_t *)); dlsch.ue_spec_bf_weights[layer] = (int32_t **)malloc16(64 * sizeof(int32_t *));
for (int aa=0; aa<64; aa++) { for (int aa=0; aa<64; aa++) {
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); dlsch.ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES * sizeof(int32_t));
for (int re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { for (int re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff; dlsch.ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
} }
} }
dlsch->txdataF[layer] = (int32_t *)malloc16((txdataf_size)*sizeof(int32_t)); dlsch.txdataF[layer] = (int32_t *)malloc16((txdataf_size) * sizeof(int32_t));
} }
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
dlsch->mod_symbs = (int32_t **)malloc16(nb_codewords*sizeof(int32_t *)); dlsch.mod_symbs = (int32_t **)malloc16(nb_codewords * sizeof(int32_t *));
for (int q=0; q<nb_codewords; q++) for (int q=0; q<nb_codewords; q++)
dlsch->mod_symbs[q] = (int32_t *)malloc16(txdataf_size*max_layers*sizeof(int32_t)); dlsch.mod_symbs[q] = (int32_t *)malloc16(txdataf_size * max_layers * sizeof(int32_t));
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; NR_DL_gNB_HARQ_t *harq = &dlsch.harq_process;
bzero(harq, sizeof(NR_DL_gNB_HARQ_t)); bzero(harq, sizeof(NR_DL_gNB_HARQ_t));
harq->b = malloc16(dlsch_bytes); harq->b = malloc16(dlsch_bytes);
AssertFatal(harq->b, "cannot allocate memory for harq->b\n"); AssertFatal(harq->b, "cannot allocate memory for harq->b\n");
...@@ -276,9 +265,13 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -276,9 +265,13 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
uint8_t slot, uint8_t slot,
NR_DL_gNB_HARQ_t *harq, NR_DL_gNB_HARQ_t *harq,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
unsigned char * output, unsigned char *output,
time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput, time_stats_t *tinput,
time_stats_t *dlsch_rate_matching_stats,time_stats_t *dlsch_interleaving_stats, time_stats_t *tprep,
time_stats_t *tparity,
time_stats_t *toutput,
time_stats_t *dlsch_rate_matching_stats,
time_stats_t *dlsch_interleaving_stats,
time_stats_t *dlsch_segmentation_stats) time_stats_t *dlsch_segmentation_stats)
{ {
encoder_implemparams_t impp; encoder_implemparams_t impp;
......
...@@ -44,17 +44,13 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) { ...@@ -44,17 +44,13 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) {
*(pdu+i) = (uint8_t)rand(); *(pdu+i) = (uint8_t)rand();
} }
void nr_fill_dlsch(processingData_L1tx_t *msgTx, void nr_fill_dlsch(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, uint8_t *sdu)
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu)
{ {
NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[msgTx->num_pdsch_slot][0];
NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[msgTx->num_pdsch_slot][0];
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
/// DLSCH struct /// DLSCH struct
memcpy((void*)&harq->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu)); memcpy((void*)&harq->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu));
msgTx->num_pdsch_slot++; msgTx->num_pdsch_slot++;
AssertFatal(sdu != NULL,"sdu is null\n"); AssertFatal(sdu != NULL, "sdu is null\n");
harq->pdu = sdu; harq->pdu = sdu;
} }
...@@ -108,10 +108,9 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, ...@@ -108,10 +108,9 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu,
*/ */
void nr_init_pbch_interleaver(uint8_t *interleaver); void nr_init_pbch_interleaver(uint8_t *interleaver);
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB);
uint16_t N_RB);
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB, const NR_DL_FRAME_PARMS* frame_parms); void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARMS *frame_parms);
/** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs /** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs
- RB extraction (signal and channel estimates) - RB extraction (signal and channel estimates)
...@@ -308,17 +307,11 @@ void nr_fill_prach_ru(RU_t *ru, ...@@ -308,17 +307,11 @@ void nr_fill_prach_ru(RU_t *ru,
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, find_type_t type); int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, find_type_t type);
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type); int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type);
NR_gNB_PUCCH_t *new_gNB_pucch(void);
void free_gNB_pucch(NR_gNB_PUCCH_t *pucch);
void nr_fill_pucch(PHY_VARS_gNB *gNB, void nr_fill_pucch(PHY_VARS_gNB *gNB,
int frame, int frame,
int slot, int slot,
nfapi_nr_pucch_pdu_t *pucch_pdu); nfapi_nr_pucch_pdu_t *pucch_pdu);
NR_gNB_SRS_t *new_gNB_srs(void);
void free_gNB_srs(NR_gNB_SRS_t *srs);
void nr_fill_srs(PHY_VARS_gNB *gNB, void nr_fill_srs(PHY_VARS_gNB *gNB,
frame_t frame, frame_t frame,
slot_t slot, slot_t slot,
......
...@@ -36,36 +36,30 @@ ...@@ -36,36 +36,30 @@
NR_gNB_ULSCH_t *find_nr_ulsch(PHY_VARS_gNB *gNB, uint16_t rnti, int pid) NR_gNB_ULSCH_t *find_nr_ulsch(PHY_VARS_gNB *gNB, uint16_t rnti, int pid)
{ {
int16_t first_free_index = -1; int16_t first_free_index = -1;
AssertFatal(gNB != NULL,"gNB is null\n"); AssertFatal(gNB != NULL, "gNB is null\n");
NR_gNB_ULSCH_t *ulsch = NULL; NR_gNB_ULSCH_t *ulsch = NULL;
for (int i = 0; i < gNB->max_nb_pusch; i++) { for (int i = 0; i < gNB->max_nb_pusch; i++) {
ulsch = gNB->ulsch[i]; ulsch = &gNB->ulsch[i];
AssertFatal(ulsch != NULL, "gNB->ulsch[%d] is null\n", i); AssertFatal(ulsch != NULL, "gNB->ulsch[%d] is null\n", i);
if(!ulsch->active) { if (!ulsch->active) {
if (first_free_index == -1) if (first_free_index == -1)
first_free_index = i; first_free_index = i;
} } else {
else {
// if there is already an active ULSCH for this RNTI and HARQ_PID // if there is already an active ULSCH for this RNTI and HARQ_PID
if ((ulsch->harq_pid == pid) && (ulsch->rnti == rnti)) if ((ulsch->harq_pid == pid) && (ulsch->rnti == rnti))
return ulsch; return ulsch;
} }
} }
if (first_free_index != -1) if (first_free_index != -1)
ulsch = gNB->ulsch[first_free_index]; ulsch = &gNB->ulsch[first_free_index];
return ulsch; return ulsch;
} }
void nr_fill_ulsch(PHY_VARS_gNB *gNB, void nr_fill_ulsch(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_pusch_pdu_t *ulsch_pdu)
int frame,
int slot,
nfapi_nr_pusch_pdu_t *ulsch_pdu)
{ {
int harq_pid = ulsch_pdu->pusch_data.harq_process_id; int harq_pid = ulsch_pdu->pusch_data.harq_process_id;
NR_gNB_ULSCH_t *ulsch = find_nr_ulsch(gNB, ulsch_pdu->rnti, harq_pid); NR_gNB_ULSCH_t *ulsch = find_nr_ulsch(gNB, ulsch_pdu->rnti, harq_pid);
AssertFatal(ulsch, "No ulsch_id found for rnti %04x\n", ulsch_pdu->rnti); AssertFatal(ulsch, "No ulsch_id found for rnti %04x\n", ulsch_pdu->rnti);
...@@ -79,8 +73,13 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, ...@@ -79,8 +73,13 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
NR_UL_gNB_HARQ_t *harq = ulsch->harq_process; NR_UL_gNB_HARQ_t *harq = ulsch->harq_process;
harq->new_rx = ulsch_pdu->pusch_data.new_data_indicator; harq->new_rx = ulsch_pdu->pusch_data.new_data_indicator;
LOG_D(PHY,"%d.%d RNTI %x HARQ PID %d new data indicator %d\n", LOG_D(PHY,
frame, slot, ulsch_pdu->rnti, harq_pid, ulsch_pdu->pusch_data.new_data_indicator); "%d.%d RNTI %x HARQ PID %d new data indicator %d\n",
frame,
slot,
ulsch_pdu->rnti,
harq_pid,
ulsch_pdu->pusch_data.new_data_indicator);
if (harq->new_rx) if (harq->new_rx)
harq->round = 0; harq->round = 0;
else else
...@@ -88,16 +87,16 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, ...@@ -88,16 +87,16 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
memcpy(&ulsch->harq_process->ulsch_pdu, ulsch_pdu, sizeof(ulsch->harq_process->ulsch_pdu)); memcpy(&ulsch->harq_process->ulsch_pdu, ulsch_pdu, sizeof(ulsch->harq_process->ulsch_pdu));
LOG_D(PHY,"Initializing nFAPI for ULSCH, harq_pid %d\n", harq_pid); LOG_D(PHY, "Initializing nFAPI for ULSCH, harq_pid %d\n", harq_pid);
} }
void reset_active_ulsch(PHY_VARS_gNB *gNB, int frame) void reset_active_ulsch(PHY_VARS_gNB *gNB, int frame)
{ {
// disactivate ULSCH structure after a given number of frames // deactivate ULSCH structure after a given number of frames
// no activity on this structure for NUMBER_FRAMES_PHY_UE_INACTIVE // no activity on this structure for NUMBER_FRAMES_PHY_UE_INACTIVE
// assuming UE disconnected or some other error occurred // assuming UE disconnected or some other error occurred
for (int i = 0; i < gNB->max_nb_pusch; i++) { for (int i = 0; i < gNB->max_nb_pusch; i++) {
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[i]; NR_gNB_ULSCH_t *ulsch = &gNB->ulsch[i];
if (ulsch->active && (((frame - ulsch->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE)) if (ulsch->active && (((frame - ulsch->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE))
ulsch->active = false; ulsch->active = false;
} }
...@@ -108,11 +107,7 @@ void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n ...@@ -108,11 +107,7 @@ void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n
nr_codeword_unscrambling(llr, size, 0, Nid, n_RNTI); nr_codeword_unscrambling(llr, size, 0, Nid, n_RNTI);
} }
void nr_ulsch_layer_demapping(int16_t *llr_cw, void nr_ulsch_layer_demapping(int16_t *llr_cw, uint8_t Nl, uint8_t mod_order, uint32_t length, int16_t **llr_layers)
uint8_t Nl,
uint8_t mod_order,
uint32_t length,
int16_t **llr_layers)
{ {
switch (Nl) { switch (Nl) {
...@@ -137,31 +132,43 @@ void nr_ulsch_layer_demapping(int16_t *llr_cw, ...@@ -137,31 +132,43 @@ void nr_ulsch_layer_demapping(int16_t *llr_cw,
void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB) void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB)
{ {
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
for (int i = 0;i < MAX_MOBILES_PER_GNB; i++) {
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i]; NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
if (stats->active && stats->frame != stats->ulsch_stats.dump_frame) { if (stats->active && stats->frame != stats->ulsch_stats.dump_frame) {
stats->ulsch_stats.dump_frame = stats->frame; stats->ulsch_stats.dump_frame = stats->frame;
for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++)
if (aa==0) if (aa == 0)
fprintf(fd,"ULSCH RNTI %4x, %d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d, sync_pos %d\n", fprintf(fd,
stats->rnti, stats->frame, "ULSCH RNTI %4x, %d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d, sync_pos %d\n",
aa, stats->ulsch_stats.power[aa]/10, stats->ulsch_stats.power[aa]%10, stats->rnti,
aa, stats->ulsch_stats.noise_power[aa]/10, stats->ulsch_stats.noise_power[aa]%10, stats->frame,
aa,
stats->ulsch_stats.power[aa] / 10,
stats->ulsch_stats.power[aa] % 10,
aa,
stats->ulsch_stats.noise_power[aa] / 10,
stats->ulsch_stats.noise_power[aa] % 10,
stats->ulsch_stats.sync_pos); stats->ulsch_stats.sync_pos);
else else
fprintf(fd," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n", fprintf(fd,
aa, stats->ulsch_stats.power[aa]/10, stats->ulsch_stats.power[aa]%10, " ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n",
aa, stats->ulsch_stats.noise_power[aa]/10, stats->ulsch_stats.noise_power[aa]%10); aa,
stats->ulsch_stats.power[aa] / 10,
stats->ulsch_stats.power[aa] % 10,
aa,
stats->ulsch_stats.noise_power[aa] / 10,
stats->ulsch_stats.noise_power[aa] % 10);
int *rt = stats->ulsch_stats.round_trials; int *rt = stats->ulsch_stats.round_trials;
fprintf(fd," round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, DTX %d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d\n", fprintf(fd,
" round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, DTX %d, current_Qm %d, current_RI %d, total_bytes "
"RX/SCHED %d/%d\n",
rt[0], rt[0],
(double)rt[1]/rt[0], (double)rt[1] / rt[0],
rt[1], rt[1],
(double)rt[2]/rt[0], (double)rt[2] / rt[0],
rt[2], rt[2],
(double)rt[3]/rt[0], (double)rt[3] / rt[0],
rt[3], rt[3],
stats->ulsch_stats.DTX, stats->ulsch_stats.DTX,
stats->ulsch_stats.current_Qm, stats->ulsch_stats.current_Qm,
...@@ -171,5 +178,3 @@ void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB) ...@@ -171,5 +178,3 @@ void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB)
} }
} }
} }
...@@ -33,10 +33,9 @@ ...@@ -33,10 +33,9 @@
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "common/utils/threadPool/thread-pool.h" #include "common/utils/threadPool/thread-pool.h"
void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch, uint16_t N_RB_UL); void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch, uint16_t N_RB_UL);
NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL);
NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL);
/*! \brief Perform PUSCH decoding. TS 38.212 V15.4.0 subclause 6.2 /*! \brief Perform PUSCH decoding. TS 38.212 V15.4.0 subclause 6.2
@param phy_vars_gNB, Pointer to PHY data structure for gNB @param phy_vars_gNB, Pointer to PHY data structure for gNB
......
...@@ -55,11 +55,10 @@ ...@@ -55,11 +55,10 @@
//extern double cpuf; //extern double cpuf;
void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL) void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch, uint16_t N_RB_UL)
{ {
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated
NR_gNB_ULSCH_t *ulsch = *ulschptr;
if (N_RB_UL != 273) { if (N_RB_UL != 273) {
a_segments = a_segments*N_RB_UL; a_segments = a_segments*N_RB_UL;
...@@ -80,11 +79,10 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL) ...@@ -80,11 +79,10 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL)
free_and_zero(ulsch->harq_process); free_and_zero(ulsch->harq_process);
ulsch->harq_process = NULL; ulsch->harq_process = NULL;
} }
free_and_zero(*ulschptr); free_and_zero(ulsch);
} }
NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
{ {
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated
...@@ -95,14 +93,14 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL) ...@@ -95,14 +93,14 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
} }
uint32_t ulsch_bytes = a_segments * 1056; // allocated bytes per segment uint32_t ulsch_bytes = a_segments * 1056; // allocated bytes per segment
NR_gNB_ULSCH_t *ulsch = malloc16_clear(sizeof(*ulsch)); NR_gNB_ULSCH_t ulsch;
ulsch->max_ldpc_iterations = max_ldpc_iterations; ulsch.max_ldpc_iterations = max_ldpc_iterations;
ulsch->harq_pid = -1; ulsch.harq_pid = -1;
ulsch->active = false; ulsch.active = false;
NR_UL_gNB_HARQ_t *harq = malloc16_clear(sizeof(harq)); NR_UL_gNB_HARQ_t *harq = malloc16_clear(sizeof(*harq));
ulsch->harq_process = harq; ulsch.harq_process = harq;
harq->b = malloc16_clear(ulsch_bytes * sizeof(*harq->b)); harq->b = malloc16_clear(ulsch_bytes * sizeof(*harq->b));
harq->c = malloc16_clear(a_segments * sizeof(*harq->c)); harq->c = malloc16_clear(a_segments * sizeof(*harq->c));
harq->d = malloc16_clear(a_segments * sizeof(*harq->d)); harq->d = malloc16_clear(a_segments * sizeof(*harq->d));
...@@ -117,10 +115,9 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL) ...@@ -117,10 +115,9 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
static uint32_t prnt_crc_cnt = 0; static uint32_t prnt_crc_cnt = 0;
#endif #endif
void nr_processULSegment(void* arg) void nr_processULSegment(void *arg)
{ {
ldpcDecode_t *rdata = (ldpcDecode_t *)arg;
ldpcDecode_t *rdata = (ldpcDecode_t*) arg;
PHY_VARS_gNB *phy_vars_gNB = rdata->gNB; PHY_VARS_gNB *phy_vars_gNB = rdata->gNB;
NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq; NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
t_nrLDPC_dec_params *p_decoderParms = &rdata->decoderParms; t_nrLDPC_dec_params *p_decoderParms = &rdata->decoderParms;
...@@ -139,24 +136,24 @@ void nr_processULSegment(void* arg) ...@@ -139,24 +136,24 @@ void nr_processULSegment(void* arg)
int rv_index = rdata->rv_index; int rv_index = rdata->rv_index;
int r_offset = rdata->r_offset; int r_offset = rdata->r_offset;
uint8_t kc = rdata->Kc; uint8_t kc = rdata->Kc;
short* ulsch_llr = rdata->ulsch_llr; short *ulsch_llr = rdata->ulsch_llr;
int max_ldpc_iterations = p_decoderParms->numMaxIter; int max_ldpc_iterations = p_decoderParms->numMaxIter;
int8_t llrProcBuf[OAI_UL_LDPC_MAX_NUM_LLR] __attribute__((aligned(32))); int8_t llrProcBuf[OAI_UL_LDPC_MAX_NUM_LLR] __attribute__((aligned(32)));
int16_t z [68*384 + 16] __attribute__ ((aligned(16))); int16_t z[68 * 384 + 16] __attribute__((aligned(16)));
int8_t l [68*384 + 16] __attribute__ ((aligned(16))); int8_t l[68 * 384 + 16] __attribute__((aligned(16)));
__m128i *pv = (__m128i*)&z; __m128i *pv = (__m128i *)&z;
__m128i *pl = (__m128i*)&l; __m128i *pl = (__m128i *)&l;
Kr = ulsch_harq->K; Kr = ulsch_harq->K;
Kr_bytes = Kr>>3; Kr_bytes = Kr >> 3;
K_bits_F = Kr-ulsch_harq->F; K_bits_F = Kr - ulsch_harq->F;
t_nrLDPC_time_stats procTime = {0}; t_nrLDPC_time_stats procTime = {0};
t_nrLDPC_time_stats* p_procTime = &procTime ; t_nrLDPC_time_stats *p_procTime = &procTime;
//start_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); // start_meas(&phy_vars_gNB->ulsch_deinterleaving_stats);
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// nr_deinterleaving_ldpc /////////////////////////////////// ///////////////////////////////// nr_deinterleaving_ldpc ///////////////////////////////////
...@@ -167,27 +164,22 @@ void nr_processULSegment(void* arg) ...@@ -167,27 +164,22 @@ void nr_processULSegment(void* arg)
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1) /// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
int16_t harq_e[E]; int16_t harq_e[E];
nr_deinterleaving_ldpc(E, nr_deinterleaving_ldpc(E, Qm, harq_e, ulsch_llr + r_offset);
Qm,
harq_e,
ulsch_llr+r_offset);
//for (int i =0; i<16; i++) // for (int i =0; i<16; i++)
// printf("rx output deinterleaving w[%d]= %d r_offset %d\n", i,ulsch_harq->w[r][i], r_offset); // printf("rx output deinterleaving w[%d]= %d r_offset %d\n", i,ulsch_harq->w[r][i], r_offset);
stop_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); stop_meas(&phy_vars_gNB->ulsch_deinterleaving_stats);
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////// nr_rate_matching_ldpc_rx //////////////////////////////// //////////////////////////////// nr_rate_matching_ldpc_rx ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
///////////////////////// ulsch_harq->e =====> ulsch_harq->d ///////////////////////// ///////////////////////// ulsch_harq->e =====> ulsch_harq->d /////////////////////////
//start_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); // start_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats);
if (nr_rate_matching_ldpc_rx(rdata->tbslbrm, if (nr_rate_matching_ldpc_rx(rdata->tbslbrm,
p_decoderParms->BG, p_decoderParms->BG,
...@@ -199,18 +191,18 @@ void nr_processULSegment(void* arg) ...@@ -199,18 +191,18 @@ void nr_processULSegment(void* arg)
ulsch_harq->new_rx, ulsch_harq->new_rx,
E, E,
ulsch_harq->F, ulsch_harq->F,
Kr-ulsch_harq->F-2*(p_decoderParms->Z))==-1) { Kr - ulsch_harq->F - 2 * (p_decoderParms->Z))
== -1) {
stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats);
LOG_E(PHY,"ulsch_decoding.c: Problem in rate_matching\n"); LOG_E(PHY, "ulsch_decoding.c: Problem in rate_matching\n");
rdata->decodeIterations = max_ldpc_iterations + 1; rdata->decodeIterations = max_ldpc_iterations + 1;
return; return;
} else { } else {
stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats);
} }
memset(ulsch_harq->c[r],0,Kr_bytes); memset(ulsch_harq->c[r], 0, Kr_bytes);
if (ulsch_harq->C == 1) { if (ulsch_harq->C == 1) {
if (A > 3824) if (A > 3824)
...@@ -219,42 +211,36 @@ void nr_processULSegment(void* arg) ...@@ -219,42 +211,36 @@ void nr_processULSegment(void* arg)
crc_type = CRC16; crc_type = CRC16;
length_dec = ulsch_harq->B; length_dec = ulsch_harq->B;
} } else {
else {
crc_type = CRC24_B; crc_type = CRC24_B;
length_dec = (ulsch_harq->B+24*ulsch_harq->C)/ulsch_harq->C; length_dec = (ulsch_harq->B + 24 * ulsch_harq->C) / ulsch_harq->C;
} }
//start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); // start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
//set first 2*Z_c bits to zeros // set first 2*Z_c bits to zeros
memset(&z[0],0,2*ulsch_harq->Z*sizeof(int16_t)); memset(&z[0], 0, 2 * ulsch_harq->Z * sizeof(int16_t));
//set Filler bits // set Filler bits
memset((&z[0]+K_bits_F),127,ulsch_harq->F*sizeof(int16_t)); memset((&z[0] + K_bits_F), 127, ulsch_harq->F * sizeof(int16_t));
//Move coded bits before filler bits // Move coded bits before filler bits
memcpy((&z[0]+2*ulsch_harq->Z),ulsch_harq->d[r],(K_bits_F-2*ulsch_harq->Z)*sizeof(int16_t)); memcpy((&z[0] + 2 * ulsch_harq->Z), ulsch_harq->d[r], (K_bits_F - 2 * ulsch_harq->Z) * sizeof(int16_t));
//skip filler bits // skip filler bits
memcpy((&z[0]+Kr),ulsch_harq->d[r]+(Kr-2*ulsch_harq->Z),(kc*ulsch_harq->Z-Kr)*sizeof(int16_t)); memcpy((&z[0] + Kr), ulsch_harq->d[r] + (Kr - 2 * ulsch_harq->Z), (kc * ulsch_harq->Z - Kr) * sizeof(int16_t));
//Saturate coded bits before decoding into 8 bits values // Saturate coded bits before decoding into 8 bits values
for (i=0, j=0; j < ((kc*ulsch_harq->Z)>>4)+1; i+=2, j++) for (i = 0, j = 0; j < ((kc * ulsch_harq->Z) >> 4) + 1; i += 2, j++) {
{ pl[j] = _mm_packs_epi16(pv[i], pv[i + 1]);
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////// nrLDPC_decoder ///////////////////////////////////// ///////////////////////////////////// nrLDPC_decoder /////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// pl =====> llrProcBuf ////////////////////////////////// ////////////////////////////////// pl =====> llrProcBuf //////////////////////////////////
p_decoderParms->block_length = length_dec; p_decoderParms->block_length = length_dec;
no_iteration_ldpc = nrLDPC_decoder(p_decoderParms, no_iteration_ldpc = nrLDPC_decoder(p_decoderParms, (int8_t *)&pl[0], llrProcBuf, p_procTime);
(int8_t*)&pl[0],
llrProcBuf,
p_procTime);
if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) { if (check_crc((uint8_t *)llrProcBuf, length_dec, ulsch_harq->F, crc_type)) {
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
LOG_I(PHY,"Segment %d CRC OK, iterations %d/%d\n",r,no_iteration_ldpc,max_ldpc_iterations); LOG_I(PHY,"Segment %d CRC OK, iterations %d/%d\n",r,no_iteration_ldpc,max_ldpc_iterations);
#endif #endif
...@@ -272,7 +258,7 @@ void nr_processULSegment(void* arg) ...@@ -272,7 +258,7 @@ void nr_processULSegment(void* arg)
} }
//stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); //stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
} }
uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint8_t ULSCH_id, uint8_t ULSCH_id,
...@@ -284,13 +270,12 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -284,13 +270,12 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint8_t harq_pid, uint8_t harq_pid,
uint32_t G) uint32_t G)
{ {
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
prnt_crc_cnt++; prnt_crc_cnt++;
#endif #endif
NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id]; NR_gNB_ULSCH_t *ulsch = &phy_vars_gNB->ulsch[ULSCH_id];
NR_gNB_PUSCH *pusch = phy_vars_gNB->pusch_vars[ULSCH_id]; NR_gNB_PUSCH *pusch = &phy_vars_gNB->pusch_vars[ULSCH_id];
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process;
if (!harq_process) { if (!harq_process) {
......
...@@ -1847,11 +1847,13 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1847,11 +1847,13 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
int avgs = 0; int avgs = 0;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id]->harq_process->ulsch_pdu; NR_gNB_ULSCH_t *ulsch = &gNB->ulsch[ulsch_id];
nfapi_nr_pusch_pdu_t *rel15_ul = &ulsch->harq_process->ulsch_pdu;
int avg[frame_parms->nb_antennas_rx*rel15_ul->nrOfLayers]; int avg[frame_parms->nb_antennas_rx*rel15_ul->nrOfLayers];
gNB->pusch_vars[ulsch_id]->dmrs_symbol = INVALID_VALUE; NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ulsch_id];
gNB->pusch_vars[ulsch_id]->cl_done = 0; pusch_vars->dmrs_symbol = INVALID_VALUE;
pusch_vars->cl_done = 0;
bwp_start_subcarrier = ((rel15_ul->rb_start + rel15_ul->bwp_start)*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size; bwp_start_subcarrier = ((rel15_ul->rb_start + rel15_ul->bwp_start)*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
LOG_D(PHY,"pusch %d.%d : bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n", frame,slot,bwp_start_subcarrier, rel15_ul->rb_start, frame_parms->first_carrier_offset); LOG_D(PHY,"pusch %d.%d : bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n", frame,slot,bwp_start_subcarrier, rel15_ul->rb_start, frame_parms->first_carrier_offset);
...@@ -1870,8 +1872,8 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1870,8 +1872,8 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
LOG_D(PHY, "symbol %d, dmrs_symbol_flag :%d\n", symbol, dmrs_symbol_flag); LOG_D(PHY, "symbol %d, dmrs_symbol_flag :%d\n", symbol, dmrs_symbol_flag);
if (dmrs_symbol_flag == 1) { if (dmrs_symbol_flag == 1) {
if (gNB->pusch_vars[ulsch_id]->dmrs_symbol == INVALID_VALUE) if (pusch_vars->dmrs_symbol == INVALID_VALUE)
gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol; pusch_vars->dmrs_symbol = symbol;
for (int nl=0; nl<rel15_ul->nrOfLayers; nl++) { for (int nl=0; nl<rel15_ul->nrOfLayers; nl++) {
...@@ -1885,40 +1887,44 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1885,40 +1887,44 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
&max_ch); &max_ch);
} }
nr_gnb_measurements(gNB, gNB->ulsch[ulsch_id], gNB->pusch_vars[ulsch_id], symbol, rel15_ul->nrOfLayers); nr_gnb_measurements(gNB, ulsch, pusch_vars, symbol, rel15_ul->nrOfLayers);
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
if (symbol == rel15_ul->start_symbol_index) { if (symbol == rel15_ul->start_symbol_index) {
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = 0; pusch_vars->ulsch_power[aarx] = 0;
gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx] = 0; pusch_vars->ulsch_noise_power[aarx] = 0;
} }
for (aatx = 0; aatx < rel15_ul->nrOfLayers; aatx++) { for (aatx = 0; aatx < rel15_ul->nrOfLayers; aatx++) {
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] += signal_energy_nodc( pusch_vars->ulsch_power[aarx] += signal_energy_nodc(
&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aatx*gNB->frame_parms.nb_antennas_rx+aarx][symbol * frame_parms->ofdm_symbol_size], &pusch_vars->ul_ch_estimates[aatx * gNB->frame_parms.nb_antennas_rx + aarx][symbol * frame_parms->ofdm_symbol_size],
rel15_ul->rb_size * 12); rel15_ul->rb_size * 12);
} }
for (int rb = 0; rb < rel15_ul->rb_size; rb++) { for (int rb = 0; rb < rel15_ul->rb_size; rb++) {
gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx] += pusch_vars->ulsch_noise_power[aarx] +=
gNB->measurements.n0_subband_power[aarx][rel15_ul->bwp_start + rel15_ul->rb_start + rb] / gNB->measurements.n0_subband_power[aarx][rel15_ul->bwp_start + rel15_ul->rb_start + rb] / rel15_ul->rb_size;
rel15_ul->rb_size; }
} LOG_D(PHY,
LOG_D(PHY,"aa %d, bwp_start%d, rb_start %d, rb_size %d: ulsch_power %d, ulsch_noise_power %d\n",aarx, "aa %d, bwp_start%d, rb_start %d, rb_size %d: ulsch_power %d, ulsch_noise_power %d\n",
rel15_ul->bwp_start,rel15_ul->rb_start,rel15_ul->rb_size, aarx,
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx], rel15_ul->bwp_start,
gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx]); rel15_ul->rb_start,
rel15_ul->rb_size,
pusch_vars->ulsch_power[aarx],
pusch_vars->ulsch_noise_power[aarx]);
} }
} }
} }
if (gNB->chest_time == 1) { // averaging time domain channel estimates if (gNB->chest_time == 1) { // averaging time domain channel estimates
nr_chest_time_domain_avg(frame_parms, nr_chest_time_domain_avg(frame_parms,
gNB->pusch_vars[ulsch_id]->ul_ch_estimates, pusch_vars->ul_ch_estimates,
rel15_ul->nr_of_symbols, rel15_ul->nr_of_symbols,
rel15_ul->start_symbol_index, rel15_ul->start_symbol_index,
rel15_ul->ul_dmrs_symb_pos, rel15_ul->ul_dmrs_symb_pos,
rel15_ul->rb_size); rel15_ul->rb_size);
gNB->pusch_vars[ulsch_id]->dmrs_symbol = get_next_dmrs_symbol_in_slot(rel15_ul->ul_dmrs_symb_pos, rel15_ul->start_symbol_index, rel15_ul->nr_of_symbols); pusch_vars->dmrs_symbol =
get_next_dmrs_symbol_in_slot(rel15_ul->ul_dmrs_symb_pos, rel15_ul->start_symbol_index, rel15_ul->nr_of_symbols);
} }
stop_meas(&gNB->ulsch_channel_estimation_stats); stop_meas(&gNB->ulsch_channel_estimation_stats);
...@@ -1940,7 +1946,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1940,7 +1946,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
AssertFatal(1==0,"Double DMRS configuration is not yet supported\n"); AssertFatal(1==0,"Double DMRS configuration is not yet supported\n");
if (gNB->chest_time == 0) // Non averaging time domain channel estimates if (gNB->chest_time == 0) // Non averaging time domain channel estimates
gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol; pusch_vars->dmrs_symbol = symbol;
if (rel15_ul->dmrs_config_type == 0) { if (rel15_ul->dmrs_config_type == 0) {
// if no data in dmrs cdm group is 1 only even REs have no data // if no data in dmrs cdm group is 1 only even REs have no data
...@@ -1955,29 +1961,23 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1955,29 +1961,23 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB; nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB;
} }
gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] = nb_re_pusch; pusch_vars->ul_valid_re_per_slot[symbol] = nb_re_pusch;
LOG_D(PHY,"symbol %d: nb_re_pusch %d, DMRS symbl used for Chest :%d \n", symbol, nb_re_pusch, gNB->pusch_vars[ulsch_id]->dmrs_symbol); LOG_D(PHY, "symbol %d: nb_re_pusch %d, DMRS symbl used for Chest :%d \n", symbol, nb_re_pusch, pusch_vars->dmrs_symbol);
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- RBs extraction --------------------- //--------------------- RBs extraction ---------------------
//---------------------------------------------------------- //----------------------------------------------------------
if (nb_re_pusch > 0) { if (nb_re_pusch > 0) {
start_meas(&gNB->ulsch_rbs_extraction_stats); start_meas(&gNB->ulsch_rbs_extraction_stats);
nr_ulsch_extract_rbs(gNB->common_vars.rxdataF, nr_ulsch_extract_rbs(gNB->common_vars.rxdataF, pusch_vars, slot, symbol, dmrs_symbol_flag, rel15_ul, frame_parms);
gNB->pusch_vars[ulsch_id],
slot,
symbol,
dmrs_symbol_flag,
rel15_ul,
frame_parms);
stop_meas(&gNB->ulsch_rbs_extraction_stats); stop_meas(&gNB->ulsch_rbs_extraction_stats);
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- Channel Scaling -------------------- //--------------------- Channel Scaling --------------------
//---------------------------------------------------------- //----------------------------------------------------------
nr_ulsch_scale_channel(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, nr_ulsch_scale_channel(pusch_vars->ul_ch_estimates_ext,
frame_parms, frame_parms,
gNB->ulsch[ulsch_id], ulsch,
symbol, symbol,
dmrs_symbol_flag, dmrs_symbol_flag,
nb_re_pusch, nb_re_pusch,
...@@ -1985,8 +1985,8 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1985,8 +1985,8 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
rel15_ul->rb_size, rel15_ul->rb_size,
shift_ch_ext); shift_ch_ext);
if (gNB->pusch_vars[ulsch_id]->cl_done==0) { if (pusch_vars->cl_done == 0) {
nr_ulsch_channel_level(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, nr_ulsch_channel_level(pusch_vars->ul_ch_estimates_ext,
frame_parms, frame_parms,
avg, avg,
symbol, symbol,
...@@ -2000,24 +2000,24 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -2000,24 +2000,24 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[aatx*frame_parms->nb_antennas_rx+aarx]); avgs = cmax(avgs,avg[aatx*frame_parms->nb_antennas_rx+aarx]);
gNB->pusch_vars[ulsch_id]->log2_maxh = (log2_approx(avgs) >> 1) + ad_shift; pusch_vars->log2_maxh = (log2_approx(avgs) >> 1) + ad_shift;
if (gNB->pusch_vars[ulsch_id]->log2_maxh < 0) { if (pusch_vars->log2_maxh < 0) {
gNB->pusch_vars[ulsch_id]->log2_maxh = 0; pusch_vars->log2_maxh = 0;
} }
gNB->pusch_vars[ulsch_id]->cl_done = 1; pusch_vars->cl_done = 1;
} }
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- Channel Compensation --------------- //--------------------- Channel Compensation ---------------
//---------------------------------------------------------- //----------------------------------------------------------
start_meas(&gNB->ulsch_channel_compensation_stats); start_meas(&gNB->ulsch_channel_compensation_stats);
LOG_D(PHY,"Doing channel compensations log2_maxh %d, avgs %d (%d,%d)\n",gNB->pusch_vars[ulsch_id]->log2_maxh,avgs,avg[0],avg[1]); LOG_D(PHY, "Doing channel compensations log2_maxh %d, avgs %d (%d,%d)\n", pusch_vars->log2_maxh, avgs, avg[0], avg[1]);
nr_ulsch_channel_compensation(gNB->pusch_vars[ulsch_id]->rxdataF_ext, nr_ulsch_channel_compensation(pusch_vars->rxdataF_ext,
gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, pusch_vars->ul_ch_estimates_ext,
gNB->pusch_vars[ulsch_id]->ul_ch_mag0, pusch_vars->ul_ch_mag0,
gNB->pusch_vars[ulsch_id]->ul_ch_magb0, pusch_vars->ul_ch_magb0,
gNB->pusch_vars[ulsch_id]->rxdataF_comp, pusch_vars->rxdataF_comp,
(rel15_ul->nrOfLayers>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL, (rel15_ul->nrOfLayers > 1) ? pusch_vars->rho : NULL,
frame_parms, frame_parms,
symbol, symbol,
nb_re_pusch, nb_re_pusch,
...@@ -2025,15 +2025,15 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -2025,15 +2025,15 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
rel15_ul->qam_mod_order, rel15_ul->qam_mod_order,
rel15_ul->nrOfLayers, rel15_ul->nrOfLayers,
rel15_ul->rb_size, rel15_ul->rb_size,
gNB->pusch_vars[ulsch_id]->log2_maxh); pusch_vars->log2_maxh);
stop_meas(&gNB->ulsch_channel_compensation_stats); stop_meas(&gNB->ulsch_channel_compensation_stats);
start_meas(&gNB->ulsch_mrc_stats); start_meas(&gNB->ulsch_mrc_stats);
nr_ulsch_detection_mrc(frame_parms, nr_ulsch_detection_mrc(frame_parms,
gNB->pusch_vars[ulsch_id]->rxdataF_comp, pusch_vars->rxdataF_comp,
gNB->pusch_vars[ulsch_id]->ul_ch_mag0, pusch_vars->ul_ch_mag0,
gNB->pusch_vars[ulsch_id]->ul_ch_magb0, pusch_vars->ul_ch_magb0,
(rel15_ul->nrOfLayers>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL, (rel15_ul->nrOfLayers > 1) ? pusch_vars->rho : NULL,
rel15_ul->nrOfLayers, rel15_ul->nrOfLayers,
symbol, symbol,
rel15_ul->rb_size, rel15_ul->rb_size,
...@@ -2042,14 +2042,14 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -2042,14 +2042,14 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
//Apply zero forcing for 2 Tx layers //Apply zero forcing for 2 Tx layers
if (rel15_ul->nrOfLayers == 2) { if (rel15_ul->nrOfLayers == 2) {
nr_ulsch_zero_forcing_rx_2layers(frame_parms, nr_ulsch_zero_forcing_rx_2layers(frame_parms,
gNB->pusch_vars[ulsch_id]->rxdataF_comp, pusch_vars->rxdataF_comp,
gNB->pusch_vars[ulsch_id]->ul_ch_mag0, pusch_vars->ul_ch_mag0,
gNB->pusch_vars[ulsch_id]->ul_ch_magb0, pusch_vars->ul_ch_magb0,
gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, pusch_vars->ul_ch_estimates_ext,
rel15_ul->rb_size, rel15_ul->rb_size,
frame_parms->nb_antennas_rx, frame_parms->nb_antennas_rx,
rel15_ul->qam_mod_order, rel15_ul->qam_mod_order,
gNB->pusch_vars[ulsch_id]->log2_maxh, pusch_vars->log2_maxh,
symbol, symbol,
nb_re_pusch); nb_re_pusch);
} }
...@@ -2061,7 +2061,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -2061,7 +2061,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7); int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7);
// perform IDFT operation on the compensated rxdata if transform precoding is enabled // perform IDFT operation on the compensated rxdata if transform precoding is enabled
nr_idft(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * nb_re_pusch2], nb_re_pusch); nr_idft(&pusch_vars->rxdataF_comp[0][symbol * nb_re_pusch2], nb_re_pusch);
LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d\n", symbol, nb_re_pusch); LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d\n", symbol, nb_re_pusch);
} }
...@@ -2082,7 +2082,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -2082,7 +2082,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
stop_meas(&gNB->ulsch_ptrs_processing_stats); stop_meas(&gNB->ulsch_ptrs_processing_stats);
/* Subtract total PTRS RE's in the symbol from PUSCH RE's */ /* Subtract total PTRS RE's in the symbol from PUSCH RE's */
gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] -= gNB->pusch_vars[ulsch_id]->ptrs_re_per_slot; pusch_vars->ul_valid_re_per_slot[symbol] -= pusch_vars->ptrs_re_per_slot;
} }
/*---------------------------------------------------------------------------------------------------- */ /*---------------------------------------------------------------------------------------------------- */
...@@ -2090,17 +2090,18 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -2090,17 +2090,18 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
/*-----------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------*/
start_meas(&gNB->ulsch_llr_stats); start_meas(&gNB->ulsch_llr_stats);
for (aatx=0; aatx < rel15_ul->nrOfLayers; aatx++) { for (aatx=0; aatx < rel15_ul->nrOfLayers; aatx++) {
nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[aatx*frame_parms->nb_antennas_rx][symbol * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)], nr_ulsch_compute_llr(
gNB->pusch_vars[ulsch_id]->ul_ch_mag0[aatx*frame_parms->nb_antennas_rx], &pusch_vars->rxdataF_comp[aatx * frame_parms->nb_antennas_rx][symbol * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)],
gNB->pusch_vars[ulsch_id]->ul_ch_magb0[aatx*frame_parms->nb_antennas_rx], pusch_vars->ul_ch_mag0[aatx * frame_parms->nb_antennas_rx],
&gNB->pusch_vars[ulsch_id]->llr_layers[aatx][rxdataF_ext_offset * rel15_ul->qam_mod_order], pusch_vars->ul_ch_magb0[aatx * frame_parms->nb_antennas_rx],
&pusch_vars->llr_layers[aatx][rxdataF_ext_offset * rel15_ul->qam_mod_order],
rel15_ul->rb_size, rel15_ul->rb_size,
gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol], pusch_vars->ul_valid_re_per_slot[symbol],
symbol, symbol,
rel15_ul->qam_mod_order); rel15_ul->qam_mod_order);
} }
stop_meas(&gNB->ulsch_llr_stats); stop_meas(&gNB->ulsch_llr_stats);
rxdataF_ext_offset += gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol]; rxdataF_ext_offset += pusch_vars->ul_valid_re_per_slot[symbol];
} }
} // symbol loop } // symbol loop
} }
...@@ -55,18 +55,6 @@ ...@@ -55,18 +55,6 @@
//#define DEBUG_NR_PUCCH_RX 1 //#define DEBUG_NR_PUCCH_RX 1
NR_gNB_PUCCH_t *new_gNB_pucch(void)
{
NR_gNB_PUCCH_t *pucch = malloc16(sizeof(*pucch));
memset(pucch, 0, sizeof(*pucch));
return pucch;
}
void free_gNB_pucch(NR_gNB_PUCCH_t *pucch)
{
free_and_zero(pucch);
}
void nr_fill_pucch(PHY_VARS_gNB *gNB, void nr_fill_pucch(PHY_VARS_gNB *gNB,
int frame, int frame,
int slot, int slot,
...@@ -74,18 +62,25 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB, ...@@ -74,18 +62,25 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB,
{ {
if (NFAPI_MODE == NFAPI_MODE_PNF) if (NFAPI_MODE == NFAPI_MODE_PNF)
gNB->pucch[0]->active = 0; //check if ture in monolithic mode gNB->pucch[0].active = 0; // check if ture in monolithic mode
bool found = false; bool found = false;
for (int i = 0; i < gNB->max_nb_pucch; i++) { for (int i = 0; i < gNB->max_nb_pucch; i++) {
if (gNB->pucch[i]->active == 0) { NR_gNB_PUCCH_t *pucch = &gNB->pucch[i];
NR_gNB_PUCCH_t *pucch = gNB->pucch[i]; if (pucch->active == 0) {
pucch->frame = frame; pucch->frame = frame;
pucch->slot = slot; pucch->slot = slot;
pucch->active = 1; pucch->active = 1;
memcpy((void*)&pucch->pucch_pdu, (void*)pucch_pdu, sizeof(nfapi_nr_pucch_pdu_t)); memcpy((void *)&pucch->pucch_pdu, (void *)pucch_pdu, sizeof(nfapi_nr_pucch_pdu_t));
LOG_D(PHY,"Programming PUCCH[%d] for %d.%d, format %d, nb_harq %d, nb_sr %d, nb_csi %d\n", LOG_D(PHY,
i, pucch->frame, pucch->slot, pucch->pucch_pdu.format_type, pucch->pucch_pdu.bit_len_harq, pucch->pucch_pdu.sr_flag, pucch->pucch_pdu.bit_len_csi_part1); "Programming PUCCH[%d] for %d.%d, format %d, nb_harq %d, nb_sr %d, nb_csi %d\n",
i,
pucch->frame,
pucch->slot,
pucch->pucch_pdu.format_type,
pucch->pucch_pdu.bit_len_harq,
pucch->pucch_pdu.sr_flag,
pucch->pucch_pdu.bit_len_csi_part1);
found = true; found = true;
break; break;
} }
...@@ -157,10 +152,9 @@ int16_t idft12_im[12][12] = { ...@@ -157,10 +152,9 @@ int16_t idft12_im[12][12] = {
void nr_decode_pucch0(PHY_VARS_gNB *gNB, void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int frame, int frame,
int slot, int slot,
nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu) nfapi_nr_pucch_pdu_t *pucch_pdu)
{ {
c16_t **rxdataF = gNB->common_vars.rxdataF; c16_t **rxdataF = gNB->common_vars.rxdataF;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
int soffset = (slot & 3) * frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size; int soffset = (slot & 3) * frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size;
...@@ -170,7 +164,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -170,7 +164,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
pucch_pdu->bit_len_harq,pucch_pdu->sr_flag); pucch_pdu->bit_len_harq,pucch_pdu->sr_flag);
NR_gNB_PHY_STATS_t *phy_stats = get_phy_stats(gNB, pucch_pdu->rnti); NR_gNB_PHY_STATS_t *phy_stats = get_phy_stats(gNB, pucch_pdu->rnti);
AssertFatal(phy_stats != NULL,"No stat index found\n"); AssertFatal(phy_stats != NULL, "phy_stats shouldn't be NULL\n");
phy_stats->frame = frame; phy_stats->frame = frame;
NR_gNB_UCI_STATS_t *uci_stats = &phy_stats->uci_stats; NR_gNB_UCI_STATS_t *uci_stats = &phy_stats->uci_stats;
...@@ -227,11 +221,21 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -227,11 +221,21 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int prb_offset[2] = {pucch_pdu->bwp_start+pucch_pdu->prb_start, pucch_pdu->bwp_start+pucch_pdu->prb_start}; int prb_offset[2] = {pucch_pdu->bwp_start+pucch_pdu->prb_start, pucch_pdu->bwp_start+pucch_pdu->prb_start};
pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag << 1); pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag << 1);
nr_group_sequence_hopping(pucch_GroupHopping, pucch_pdu->hopping_id, 0, slot, &u[0], &v[0]); // calculating u and v value first hop nr_group_sequence_hopping(pucch_GroupHopping,
pucch_pdu->hopping_id,
0,
slot,
&u[0],
&v[0]); // calculating u and v value first hop
LOG_D(PHY,"pucch0: u %d, v %d\n",u[0],v[0]); LOG_D(PHY,"pucch0: u %d, v %d\n",u[0],v[0]);
if (pucch_pdu->freq_hop_flag == 1) { if (pucch_pdu->freq_hop_flag == 1) {
nr_group_sequence_hopping(pucch_GroupHopping, pucch_pdu->hopping_id, 1, slot, &u[1], &v[1]); // calculating u and v value second hop nr_group_sequence_hopping(pucch_GroupHopping,
pucch_pdu->hopping_id,
1,
slot,
&u[1],
&v[1]); // calculating u and v value second hop
LOG_D(PHY,"pucch0 second hop: u %d, v %d\n",u[1],v[1]); LOG_D(PHY,"pucch0 second hop: u %d, v %d\n",u[1],v[1]);
prb_offset[1] = pucch_pdu->bwp_start + pucch_pdu->second_hop_prb; prb_offset[1] = pucch_pdu->bwp_start + pucch_pdu->second_hop_prb;
} }
...@@ -254,7 +258,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -254,7 +258,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int32_t rp[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][nb_re_pucch],*tmp_rp; int32_t rp[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][nb_re_pucch],*tmp_rp;
for (int l=0; l<pucch_pdu->nr_of_symbols; l++) { for (int l=0; l<pucch_pdu->nr_of_symbols; l++) {
uint8_t l2 = l+pucch_pdu->start_symbol_index; uint8_t l2 = l + pucch_pdu->start_symbol_index;
re_offset[l] = (12*prb_offset[l]) + frame_parms->first_carrier_offset; re_offset[l] = (12*prb_offset[l]) + frame_parms->first_carrier_offset;
if (re_offset[l]>= frame_parms->ofdm_symbol_size) if (re_offset[l]>= frame_parms->ofdm_symbol_size)
...@@ -420,10 +424,22 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -420,10 +424,22 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->harq->harq_confidence_level = no_conf; uci_pdu->harq->harq_confidence_level = no_conf;
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(sizeof *uci_pdu->harq->harq_list); uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(sizeof *uci_pdu->harq->harq_list);
uci_pdu->harq->harq_list[0].harq_value = !(index&0x01); uci_pdu->harq->harq_list[0].harq_value = !(index&0x01);
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f\n", LOG_D(PHY,
frame,slot,uci_pdu->harq->harq_list[0].harq_value==0?"ACK":"NACK", "[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, "
uci_pdu->harq->harq_confidence_level==0?"good":"bad", "cqi %d, SNRtimes10 %d, energy %f\n",
xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy)); frame,
slot,
uci_pdu->harq->harq_list[0].harq_value == 0 ? "ACK" : "NACK",
uci_pdu->harq->harq_confidence_level == 0 ? "good" : "bad",
xrtmag_dBtimes10,
xrtmag_next_dBtimes10,
max_n0,
uci_stats->pucch0_n00,
uci_stats->pucch0_n01,
uci_stats->pucch0_thres,
cqi,
SNRtimes10,
10 * log10((double)sigenergy));
if (pucch_pdu->sr_flag == 1) { if (pucch_pdu->sr_flag == 1) {
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
...@@ -444,13 +460,22 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -444,13 +460,22 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->harq->harq_list[1].harq_value = !(index&0x01); uci_pdu->harq->harq_list[1].harq_value = !(index&0x01);
uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01); uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01);
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d\n", LOG_D(PHY,
frame,slot, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) "
"pucch0_thres %d, cqi %d, SNRtimes10 %d\n",
frame,
slot,
uci_pdu->harq->harq_list[1].harq_value == 0 ? "ACK" : "NACK", uci_pdu->harq->harq_list[1].harq_value == 0 ? "ACK" : "NACK",
uci_pdu->harq->harq_list[0].harq_value == 0 ? "ACK" : "NACK", uci_pdu->harq->harq_list[0].harq_value == 0 ? "ACK" : "NACK",
uci_pdu->harq->harq_confidence_level == 0 ? "good" : "bad", uci_pdu->harq->harq_confidence_level == 0 ? "good" : "bad",
xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0, xrtmag_dBtimes10,
uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10); xrtmag_next_dBtimes10,
max_n0,
uci_stats->pucch0_n00,
uci_stats->pucch0_n01,
uci_stats->pucch0_thres,
cqi,
SNRtimes10);
if (pucch_pdu->sr_flag == 1) { if (pucch_pdu->sr_flag == 1) {
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0; uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
...@@ -463,11 +488,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -463,11 +488,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
} }
} }
void nr_decode_pucch1(c16_t **rxdataF,
void nr_decode_pucch1( c16_t **rxdataF,
pucch_GroupHopping_t pucch_GroupHopping, pucch_GroupHopping_t pucch_GroupHopping,
uint32_t n_id, // hoppingID higher layer parameter uint32_t n_id, // hoppingID higher layer parameter
uint64_t *payload, uint64_t *payload,
...@@ -480,7 +501,8 @@ void nr_decode_pucch1( c16_t **rxdataF, ...@@ -480,7 +501,8 @@ void nr_decode_pucch1( c16_t **rxdataF,
uint16_t startingPRB, uint16_t startingPRB,
uint16_t startingPRB_intraSlotHopping, uint16_t startingPRB_intraSlotHopping,
uint8_t timeDomainOCC, uint8_t timeDomainOCC,
uint8_t nr_bit) { uint8_t nr_bit)
{
#ifdef DEBUG_NR_PUCCH_RX #ifdef DEBUG_NR_PUCCH_RX
printf("\t [nr_generate_pucch1] start function at slot(nr_tti_tx)=%d payload=%lp m0=%d nrofSymbols=%d startingSymbolIndex=%d startingPRB=%d startingPRB_intraSlotHopping=%d timeDomainOCC=%d nr_bit=%d\n", printf("\t [nr_generate_pucch1] start function at slot(nr_tti_tx)=%d payload=%lp m0=%d nrofSymbols=%d startingSymbolIndex=%d startingPRB=%d startingPRB_intraSlotHopping=%d timeDomainOCC=%d nr_bit=%d\n",
nr_tti_tx,payload,m0,nrofSymbols,startingSymbolIndex,startingPRB,startingPRB_intraSlotHopping,timeDomainOCC,nr_bit); nr_tti_tx,payload,m0,nrofSymbols,startingSymbolIndex,startingPRB,startingPRB_intraSlotHopping,timeDomainOCC,nr_bit);
...@@ -1174,9 +1196,16 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1174,9 +1196,16 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
} }
} }
} }
LOG_D(PHY,"%d.%d Decoding pucch2 for %d symbols, %d PRB, nb_harq %d, nb_sr %d, nb_csi %d/%d\n", LOG_D(PHY,
frame, slot, pucch_pdu->nr_of_symbols,pucch_pdu->prb_size, "%d.%d Decoding pucch2 for %d symbols, %d PRB, nb_harq %d, nb_sr %d, nb_csi %d/%d\n",
pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,pucch_pdu->bit_len_csi_part1,pucch_pdu->bit_len_csi_part2); frame,
slot,
pucch_pdu->nr_of_symbols,
pucch_pdu->prb_size,
pucch_pdu->bit_len_harq,
pucch_pdu->sr_flag,
pucch_pdu->bit_len_csi_part1,
pucch_pdu->bit_len_csi_part2);
int nc_group_size=1; // 2 PRB int nc_group_size=1; // 2 PRB
int ngroup = prb_size_ext/nc_group_size/2; int ngroup = prb_size_ext/nc_group_size/2;
...@@ -1754,32 +1783,65 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1754,32 +1783,65 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
} }
void nr_dump_uci_stats(FILE *fd,PHY_VARS_gNB *gNB,int frame) { void nr_dump_uci_stats(FILE *fd,PHY_VARS_gNB *gNB,int frame) {
int strpos = 0;
int strpos=0;
char output[16384]; char output[16384];
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) { for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i]; NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
if (stats->active) { if (!stats->active)
return;
NR_gNB_UCI_STATS_t *uci_stats = &stats->uci_stats; NR_gNB_UCI_STATS_t *uci_stats = &stats->uci_stats;
if (uci_stats->pucch0_sr_trials > 0) if (uci_stats->pucch0_sr_trials > 0)
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch0_sr_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_sr_thres %d dB, current pucch1_stat0 %d dB, current pucch1_stat1 %d dB, positive SR count %d\n", strpos += sprintf(output + strpos,
i,stats->rnti,uci_stats->pucch0_sr_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_sr_thres,dB_fixed(uci_stats->current_pucch0_sr_stat0),dB_fixed(uci_stats->current_pucch0_sr_stat1),uci_stats->pucch0_positive_SR); "UCI %d RNTI %x: pucch0_sr_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_sr_thres %d dB, current "
"pucch1_stat0 %d dB, current pucch1_stat1 %d dB, positive SR count %d\n",
i,
stats->rnti,
uci_stats->pucch0_sr_trials,
uci_stats->pucch0_n00,
uci_stats->pucch0_n01,
uci_stats->pucch0_sr_thres,
dB_fixed(uci_stats->current_pucch0_sr_stat0),
dB_fixed(uci_stats->current_pucch0_sr_stat1),
uci_stats->pucch0_positive_SR);
if (uci_stats->pucch01_trials > 0) if (uci_stats->pucch01_trials > 0)
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch1_stat1 %d dB, pucch01_DTX %d\n", strpos += sprintf(output + strpos,
i,stats->rnti,uci_stats->pucch01_trials,uci_stats->pucch0_n01,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch01_DTX); "UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current "
"pucch0_stat0 %d dB, current pucch1_stat1 %d dB, pucch01_DTX %d\n",
i,
stats->rnti,
uci_stats->pucch01_trials,
uci_stats->pucch0_n01,
uci_stats->pucch0_n01,
uci_stats->pucch0_thres,
dB_fixed(uci_stats->current_pucch0_stat0),
dB_fixed(uci_stats->current_pucch0_stat1),
uci_stats->pucch01_DTX);
if (uci_stats->pucch02_trials > 0) if (uci_stats->pucch02_trials > 0)
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch0_stat1 %d dB, pucch01_DTX %d\n", strpos += sprintf(output + strpos,
i,stats->rnti,uci_stats->pucch02_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch02_DTX); "UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current "
"pucch0_stat0 %d dB, current pucch0_stat1 %d dB, pucch01_DTX %d\n",
i,
stats->rnti,
uci_stats->pucch02_trials,
uci_stats->pucch0_n00,
uci_stats->pucch0_n01,
uci_stats->pucch0_thres,
dB_fixed(uci_stats->current_pucch0_stat0),
dB_fixed(uci_stats->current_pucch0_stat1),
uci_stats->pucch02_DTX);
if (uci_stats->pucch2_trials > 0) if (uci_stats->pucch2_trials > 0)
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch2_trials %d, pucch2_DTX %d\n", strpos += sprintf(output + strpos,
i,stats->rnti, "UCI %d RNTI %x: pucch2_trials %d, pucch2_DTX %d\n",
i,
stats->rnti,
uci_stats->pucch2_trials, uci_stats->pucch2_trials,
uci_stats->pucch2_DTX); uci_stats->pucch2_DTX);
} }
} if (fd)
if (fd) fprintf(fd,"%s",output); fprintf(fd, "%s", output);
else printf("%s",output); else
printf("%s", output);
} }
...@@ -44,33 +44,17 @@ ...@@ -44,33 +44,17 @@
//#define SRS_DEBUG //#define SRS_DEBUG
NR_gNB_SRS_t *new_gNB_srs(void){ void nr_fill_srs(PHY_VARS_gNB *gNB, frame_t frame, slot_t slot, nfapi_nr_srs_pdu_t *srs_pdu)
NR_gNB_SRS_t *srs;
srs = (NR_gNB_SRS_t *)malloc16(sizeof(NR_gNB_SRS_t));
srs->active = 0;
return (srs);
}
void free_gNB_srs(NR_gNB_SRS_t *srs)
{
free_and_zero(srs);
}
void nr_fill_srs(PHY_VARS_gNB *gNB,
frame_t frame,
slot_t slot,
nfapi_nr_srs_pdu_t *srs_pdu)
{ {
bool found = false; bool found = false;
for (int i = 0; i < gNB->max_nb_srs; i++) { for (int i = 0; i < gNB->max_nb_srs; i++) {
if (gNB->srs[i]->active == 0) { NR_gNB_SRS_t *srs = &gNB->srs[i];
if (srs->active == 0) {
found = true; found = true;
NR_gNB_SRS_t *srs = gNB->srs[i];
srs->frame = frame; srs->frame = frame;
srs->slot = slot; srs->slot = slot;
srs->active = 1; srs->active = 1;
memcpy((void*)&srs->srs_pdu, (void*)srs_pdu, sizeof(nfapi_nr_srs_pdu_t)); memcpy((void *)&srs->srs_pdu, (void *)srs_pdu, sizeof(nfapi_nr_srs_pdu_t));
break; break;
} }
} }
......
...@@ -613,10 +613,10 @@ typedef struct PHY_VARS_gNB_s { ...@@ -613,10 +613,10 @@ typedef struct PHY_VARS_gNB_s {
NR_gNB_COMMON common_vars; NR_gNB_COMMON common_vars;
NR_gNB_PRACH prach_vars; NR_gNB_PRACH prach_vars;
NR_gNB_PRS prs_vars; NR_gNB_PRS prs_vars;
NR_gNB_PUSCH **pusch_vars; NR_gNB_PUSCH *pusch_vars;
NR_gNB_PUCCH_t **pucch; NR_gNB_PUCCH_t *pucch;
NR_gNB_SRS_t **srs; NR_gNB_SRS_t *srs;
NR_gNB_ULSCH_t **ulsch; NR_gNB_ULSCH_t *ulsch;
NR_gNB_PHY_STATS_t phy_stats[MAX_MOBILES_PER_GNB]; NR_gNB_PHY_STATS_t phy_stats[MAX_MOBILES_PER_GNB];
t_nrPolar_params **polarParams; t_nrPolar_params **polarParams;
...@@ -811,7 +811,7 @@ typedef struct processingData_L1tx { ...@@ -811,7 +811,7 @@ typedef struct processingData_L1tx {
nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS]; nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS]; nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
NR_gNB_CSIRS_t csirs_pdu[NR_SYMBOLS_PER_SLOT]; NR_gNB_CSIRS_t csirs_pdu[NR_SYMBOLS_PER_SLOT];
NR_gNB_DLSCH_t ***dlsch; NR_gNB_DLSCH_t **dlsch;
NR_gNB_SSB_t ssb[64]; NR_gNB_SSB_t ssb[64];
uint16_t num_pdsch_slot; uint16_t num_pdsch_slot;
int num_dl_pdcch; int num_dl_pdcch;
......
...@@ -100,10 +100,7 @@ void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,int frame,int slot, ...@@ -100,10 +100,7 @@ void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,int frame,int slot,
}*/ }*/
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, int frame, int slot, nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu)
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
int frame,int slot,
nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu)
{ {
int found = 0; int found = 0;
...@@ -121,7 +118,6 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, ...@@ -121,7 +118,6 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
LOG_E(MAC,"CSI-RS list is full\n"); LOG_E(MAC,"CSI-RS list is full\n");
} }
void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx, void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu) uint8_t *sdu)
...@@ -133,7 +129,6 @@ void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx, ...@@ -133,7 +129,6 @@ void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
{ {
// copy data from L2 interface into L1 structures // copy data from L2 interface into L1 structures
module_id_t Mod_id = Sched_INFO->module_id; module_id_t Mod_id = Sched_INFO->module_id;
nfapi_nr_dl_tti_request_t *DL_req = Sched_INFO->DL_req; nfapi_nr_dl_tti_request_t *DL_req = Sched_INFO->DL_req;
...@@ -202,8 +197,10 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) ...@@ -202,8 +197,10 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n", AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
pduIndex,TX_req->pdu_list[pduIndex].num_TLV); pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct; uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch,"Number of PDSCH PDUs %d exceeded the limit %d\n", AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch,
msgTx->num_pdsch_slot, gNB->max_nb_pdsch); "Number of PDSCH PDUs %d exceeded the limit %d\n",
msgTx->num_pdsch_slot,
gNB->max_nb_pdsch);
handle_nr_nfapi_pdsch_pdu(msgTx,&dl_tti_pdu->pdsch_pdu, sdu); handle_nr_nfapi_pdsch_pdu(msgTx,&dl_tti_pdu->pdsch_pdu, sdu);
} }
} }
......
...@@ -209,12 +209,11 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, ...@@ -209,12 +209,11 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req)
{ {
ldpcDecode_t *rdata = (ldpcDecode_t*) NotifiedFifoData(req); ldpcDecode_t *rdata = (ldpcDecode_t*) NotifiedFifoData(req);
NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq; NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
NR_gNB_ULSCH_t *ulsch = rdata->ulsch; NR_gNB_ULSCH_t *ulsch = rdata->ulsch;
int r = rdata->segment_r; int r = rdata->segment_r;
nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[rdata->ulsch_id]->harq_process->ulsch_pdu; nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[rdata->ulsch_id].harq_process->ulsch_pdu;
bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter); bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter);
ulsch_harq->processedSegments++; ulsch_harq->processedSegments++;
LOG_D(PHY, "processing result of segment: %d, processed %d/%d\n", LOG_D(PHY, "processing result of segment: %d, processed %d/%d\n",
...@@ -242,19 +241,35 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) ...@@ -242,19 +241,35 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req)
//int dumpsig=0; //int dumpsig=0;
// if all segments are done // if all segments are done
if (rdata->nbSegments == ulsch_harq->processedSegments) { if (rdata->nbSegments == ulsch_harq->processedSegments) {
if (decodeSuccess && !gNB->pusch_vars[rdata->ulsch_id]->DTX) { if (decodeSuccess && !gNB->pusch_vars[rdata->ulsch_id].DTX) {
LOG_D(PHY,"[gNB %d] ULSCH: Setting ACK for SFN/SF %d.%d (rnti %x, pid %d, ndi %d, status %d, round %d, TBS %d, Max interation (all seg) %d)\n", LOG_D(PHY,
gNB->Mod_id, ulsch->frame, ulsch->slot, ulsch->rnti, rdata->harq_pid, pusch_pdu->pusch_data.new_data_indicator, "[gNB %d] ULSCH: Setting ACK for SFN/SF %d.%d (rnti %x, pid %d, ndi %d, status %d, round %d, TBS %d, Max interation "
ulsch->active, ulsch_harq->round, ulsch_harq->TBS, rdata->decodeIterations); "(all seg) %d)\n",
gNB->Mod_id,
ulsch->frame,
ulsch->slot,
ulsch->rnti,
rdata->harq_pid,
pusch_pdu->pusch_data.new_data_indicator,
ulsch->active,
ulsch_harq->round,
ulsch_harq->TBS,
rdata->decodeIterations);
ulsch->active = false; ulsch->active = false;
ulsch_harq->round = 0; ulsch_harq->round = 0;
LOG_D(PHY, "ULSCH received ok \n"); LOG_D(PHY, "ULSCH received ok \n");
nr_fill_indication(gNB, ulsch->frame, ulsch->slot, rdata->ulsch_id, rdata->harq_pid, 0,0); nr_fill_indication(gNB, ulsch->frame, ulsch->slot, rdata->ulsch_id, rdata->harq_pid, 0, 0);
//dumpsig=1; //dumpsig=1;
} else { } else {
LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, ndi %d, status %d, round %d, RV %d, prb_start %d, prb_size %d, TBS %d) r %d\n", LOG_D(PHY,
gNB->Mod_id, ulsch->frame, ulsch->slot, "[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, ndi %d, status %d, round %d, RV %d, prb_start %d, prb_size %d, "
rdata->harq_pid, pusch_pdu->pusch_data.new_data_indicator, ulsch->active, "TBS %d) r %d\n",
gNB->Mod_id,
ulsch->frame,
ulsch->slot,
rdata->harq_pid,
pusch_pdu->pusch_data.new_data_indicator,
ulsch->active,
ulsch_harq->round, ulsch_harq->round,
ulsch_harq->ulsch_pdu.pusch_data.rv_index, ulsch_harq->ulsch_pdu.pusch_data.rv_index,
ulsch_harq->ulsch_pdu.rb_start, ulsch_harq->ulsch_pdu.rb_start,
...@@ -263,52 +278,55 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) ...@@ -263,52 +278,55 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req)
r); r);
ulsch->handled = 1; ulsch->handled = 1;
LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id); LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id);
nr_fill_indication(gNB, ulsch->frame, ulsch->slot, rdata->ulsch_id, rdata->harq_pid, 1,0); nr_fill_indication(gNB, ulsch->frame, ulsch->slot, rdata->ulsch_id, rdata->harq_pid, 1, 0);
// dumpsig=1; // dumpsig=1;
} }
/* /*
if (ulsch_harq->ulsch_pdu.mcs_index == 0 && dumpsig==1) { if (ulsch_harq->ulsch_pdu.mcs_index == 0 && dumpsig==1) {
int off = ((ulsch_harq->ulsch_pdu.rb_size&1) == 1)? 4:0; int off = ((ulsch_harq->ulsch_pdu.rb_size&1) == 1)? 4:0;
LOG_M("rxsigF0.m","rxsF0",&gNB->common_vars.rxdataF[0][(ulsch_harq->slot&3)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1); LOG_M("rxsigF0.m","rxsF0",&gNB->common_vars.rxdataF[0][(ulsch_harq->slot&3)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1);
LOG_M("rxsigF0_ext.m","rxsF0_ext", LOG_M("rxsigF0_ext.m","rxsF0_ext",
&gNB->pusch_vars[0]->rxdataF_ext[0][ulsch_harq->ulsch_pdu.start_symbol_index*NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size],ulsch_harq->ulsch_pdu.nr_of_symbols*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size)),1,1); &gNB->pusch_vars[0].rxdataF_ext[0][ulsch_harq->ulsch_pdu.start_symbol_index*NR_NB_SC_PER_RB *
LOG_M("chestF0.m","chF0", ulsch_harq->ulsch_pdu.rb_size],ulsch_harq->ulsch_pdu.nr_of_symbols*(off+(NR_NB_SC_PER_RB *
&gNB->pusch_vars[0]->ul_ch_estimates[0][ulsch_harq->ulsch_pdu.start_symbol_index*gNB->frame_parms.ofdm_symbol_size],gNB->frame_parms.ofdm_symbol_size,1,1); ulsch_harq->ulsch_pdu.rb_size)),1,1); LOG_M("chestF0.m","chF0",
&gNB->pusch_vars[0].ul_ch_estimates[0][ulsch_harq->ulsch_pdu.start_symbol_index*gNB->frame_parms.ofdm_symbol_size],gNB->frame_parms.ofdm_symbol_size,1,1);
LOG_M("chestF0_ext.m","chF0_ext", LOG_M("chestF0_ext.m","chF0_ext",
&gNB->pusch_vars[0]->ul_ch_estimates_ext[0][(ulsch_harq->ulsch_pdu.start_symbol_index+1)*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size))], &gNB->pusch_vars[0]->ul_ch_estimates_ext[0][(ulsch_harq->ulsch_pdu.start_symbol_index+1)*(off+(NR_NB_SC_PER_RB *
(ulsch_harq->ulsch_pdu.nr_of_symbols-1)*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size)),1,1); ulsch_harq->ulsch_pdu.rb_size))], (ulsch_harq->ulsch_pdu.nr_of_symbols-1)*(off+(NR_NB_SC_PER_RB *
LOG_M("rxsigF0_comp.m","rxsF0_comp", ulsch_harq->ulsch_pdu.rb_size)),1,1); LOG_M("rxsigF0_comp.m","rxsF0_comp",
&gNB->pusch_vars[0]->rxdataF_comp[0][ulsch_harq->ulsch_pdu.start_symbol_index*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size))],ulsch_harq->ulsch_pdu.nr_of_symbols*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size)),1,1); &gNB->pusch_vars[0].rxdataF_comp[0][ulsch_harq->ulsch_pdu.start_symbol_index*(off+(NR_NB_SC_PER_RB *
LOG_M("rxsigF0_llr.m","rxsF0_llr", ulsch_harq->ulsch_pdu.rb_size))],ulsch_harq->ulsch_pdu.nr_of_symbols*(off+(NR_NB_SC_PER_RB *
&gNB->pusch_vars[0]->llr[0],(ulsch_harq->ulsch_pdu.nr_of_symbols-1)*NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size * ulsch_harq->ulsch_pdu.qam_mod_order,1,0); ulsch_harq->ulsch_pdu.rb_size)),1,1); LOG_M("rxsigF0_llr.m","rxsF0_llr",
if (gNB->frame_parms.nb_antennas_rx > 1) { &gNB->pusch_vars[0].llr[0],(ulsch_harq->ulsch_pdu.nr_of_symbols-1)*NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size *
ulsch_harq->ulsch_pdu.qam_mod_order,1,0); if (gNB->frame_parms.nb_antennas_rx > 1) {
LOG_M("rxsigF1_ext.m","rxsF0_ext", LOG_M("rxsigF1_ext.m","rxsF0_ext",
&gNB->pusch_vars[0]->rxdataF_ext[1][ulsch_harq->ulsch_pdu.start_symbol_index*NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size],ulsch_harq->ulsch_pdu.nr_of_symbols*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size)),1,1); &gNB->pusch_vars[0].rxdataF_ext[1][ulsch_harq->ulsch_pdu.start_symbol_index*NR_NB_SC_PER_RB *
LOG_M("chestF1.m","chF1", ulsch_harq->ulsch_pdu.rb_size],ulsch_harq->ulsch_pdu.nr_of_symbols*(off+(NR_NB_SC_PER_RB *
&gNB->pusch_vars[0]->ul_ch_estimates[1][ulsch_harq->ulsch_pdu.start_symbol_index*gNB->frame_parms.ofdm_symbol_size],gNB->frame_parms.ofdm_symbol_size,1,1); ulsch_harq->ulsch_pdu.rb_size)),1,1); LOG_M("chestF1.m","chF1",
&gNB->pusch_vars[0].ul_ch_estimates[1][ulsch_harq->ulsch_pdu.start_symbol_index*gNB->frame_parms.ofdm_symbol_size],gNB->frame_parms.ofdm_symbol_size,1,1);
LOG_M("chestF1_ext.m","chF1_ext", LOG_M("chestF1_ext.m","chF1_ext",
&gNB->pusch_vars[0]->ul_ch_estimates_ext[1][(ulsch_harq->ulsch_pdu.start_symbol_index+1)*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size))], &gNB->pusch_vars[0].ul_ch_estimates_ext[1][(ulsch_harq->ulsch_pdu.start_symbol_index+1)*(off+(NR_NB_SC_PER_RB *
(ulsch_harq->ulsch_pdu.nr_of_symbols-1)*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size)),1,1); ulsch_harq->ulsch_pdu.rb_size))], (ulsch_harq->ulsch_pdu.nr_of_symbols-1)*(off+(NR_NB_SC_PER_RB *
LOG_M("rxsigF1_comp.m","rxsF1_comp", ulsch_harq->ulsch_pdu.rb_size)),1,1); LOG_M("rxsigF1_comp.m","rxsF1_comp",
&gNB->pusch_vars[0]->rxdataF_comp[1][ulsch_harq->ulsch_pdu.start_symbol_index*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size))],ulsch_harq->ulsch_pdu.nr_of_symbols*(off+(NR_NB_SC_PER_RB * ulsch_harq->ulsch_pdu.rb_size)),1,1); &gNB->pusch_vars[0].rxdataF_comp[1][ulsch_harq->ulsch_pdu.start_symbol_index*(off+(NR_NB_SC_PER_RB *
ulsch_harq->ulsch_pdu.rb_size))],ulsch_harq->ulsch_pdu.nr_of_symbols*(off+(NR_NB_SC_PER_RB *
ulsch_harq->ulsch_pdu.rb_size)),1,1);
} }
exit(-1); exit(-1);
} }
*/ */
ulsch->last_iteration_cnt = rdata->decodeIterations; ulsch->last_iteration_cnt = rdata->decodeIterations;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING,0);
} }
} }
void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH_id, uint8_t harq_pid) void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH_id, uint8_t harq_pid)
{ {
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id]->harq_process->ulsch_pdu; nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id].harq_process->ulsch_pdu;
uint16_t nb_re_dmrs; uint16_t nb_re_dmrs;
uint8_t enable_ldpc_offload = gNB->ldpc_offload_flag; uint8_t enable_ldpc_offload = gNB->ldpc_offload_flag;
...@@ -347,36 +365,24 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -347,36 +365,24 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
pusch_pdu->qam_mod_order, pusch_pdu->qam_mod_order,
pusch_pdu->nrOfLayers); pusch_pdu->nrOfLayers);
nr_ulsch_layer_demapping(gNB->pusch_vars[ULSCH_id].llr,
nr_ulsch_layer_demapping(gNB->pusch_vars[ULSCH_id]->llr,
pusch_pdu->nrOfLayers, pusch_pdu->nrOfLayers,
pusch_pdu->qam_mod_order, pusch_pdu->qam_mod_order,
G, G,
gNB->pusch_vars[ULSCH_id]->llr_layers); gNB->pusch_vars[ULSCH_id].llr_layers);
//---------------------------------------------------------- //----------------------------------------------------------
//------------------- ULSCH unscrambling ------------------- //------------------- ULSCH unscrambling -------------------
//---------------------------------------------------------- //----------------------------------------------------------
start_meas(&gNB->ulsch_unscrambling_stats); start_meas(&gNB->ulsch_unscrambling_stats);
nr_ulsch_unscrambling(gNB->pusch_vars[ULSCH_id]->llr, nr_ulsch_unscrambling(gNB->pusch_vars[ULSCH_id].llr, G, pusch_pdu->data_scrambling_id, pusch_pdu->rnti);
G,
pusch_pdu->data_scrambling_id,
pusch_pdu->rnti);
stop_meas(&gNB->ulsch_unscrambling_stats); stop_meas(&gNB->ulsch_unscrambling_stats);
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- ULSCH decoding --------------------- //--------------------- ULSCH decoding ---------------------
//---------------------------------------------------------- //----------------------------------------------------------
start_meas(&gNB->ulsch_decoding_stats); start_meas(&gNB->ulsch_decoding_stats);
nr_ulsch_decoding(gNB, nr_ulsch_decoding(gNB, ULSCH_id, gNB->pusch_vars[ULSCH_id].llr, frame_parms, pusch_pdu, frame_rx, slot_rx, harq_pid, G);
ULSCH_id,
gNB->pusch_vars[ULSCH_id]->llr,
frame_parms,
pusch_pdu,
frame_rx,
slot_rx,
harq_pid,
G);
if (enable_ldpc_offload == 0) { if (enable_ldpc_offload == 0) {
while (gNB->nbDecode > 0) { while (gNB->nbDecode > 0) {
notifiedFIFO_elt_t *req = pullTpool(&gNB->respDecode, &gNB->threadPool); notifiedFIFO_elt_t *req = pullTpool(&gNB->respDecode, &gNB->threadPool);
...@@ -389,13 +395,11 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -389,13 +395,11 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
stop_meas(&gNB->ulsch_decoding_stats); stop_meas(&gNB->ulsch_decoding_stats);
} }
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag, int dtx_flag) void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag, int dtx_flag)
{ {
pthread_mutex_lock(&gNB->UL_INFO_mutex); pthread_mutex_lock(&gNB->UL_INFO_mutex);
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; NR_gNB_ULSCH_t *ulsch = &gNB->ulsch[ULSCH_id];
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process;
NR_gNB_PHY_STATS_t *stats = get_phy_stats(gNB, ulsch->rnti); NR_gNB_PHY_STATS_t *stats = get_phy_stats(gNB, ulsch->rnti);
...@@ -413,7 +417,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, ...@@ -413,7 +417,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
sync_pos_rounded = sync_pos + (bw_scaling / 2) - 1; sync_pos_rounded = sync_pos + (bw_scaling / 2) - 1;
else else
sync_pos_rounded = sync_pos - (bw_scaling / 2) + 1; sync_pos_rounded = sync_pos - (bw_scaling / 2) + 1;
if (stats) stats->ulsch_stats.sync_pos = sync_pos; if (stats)
stats->ulsch_stats.sync_pos = sync_pos;
int timing_advance_update = sync_pos_rounded / bw_scaling; int timing_advance_update = sync_pos_rounded / bw_scaling;
...@@ -426,10 +431,17 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, ...@@ -426,10 +431,17 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
if (crc_flag == 0) LOG_D(PHY, "%d.%d : Received PUSCH : Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", frame,slot_rx,sync_pos,timing_advance_update); if (crc_flag == 0) LOG_D(PHY, "%d.%d : Received PUSCH : Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", frame,slot_rx,sync_pos,timing_advance_update);
// estimate UL_CQI for MAC // estimate UL_CQI for MAC
int SNRtimes10 = dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) - int SNRtimes10 =
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot); dB_fixed_x10(gNB->pusch_vars[ULSCH_id].ulsch_power_tot) - dB_fixed_x10(gNB->pusch_vars[ULSCH_id].ulsch_noise_power_tot);
LOG_D(PHY, "%d.%d: Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f) delay %d\n", frame, slot_rx, SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot)/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot)/10.0,sync_pos); LOG_D(PHY,
"%d.%d: Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f) delay %d\n",
frame,
slot_rx,
SNRtimes10 / 10.0,
dB_fixed_x10(gNB->pusch_vars[ULSCH_id].ulsch_power_tot) / 10.0,
dB_fixed_x10(gNB->pusch_vars[ULSCH_id].ulsch_noise_power_tot) / 10.0,
sync_pos);
int cqi; int cqi;
if (SNRtimes10 < -640) cqi=0; if (SNRtimes10 < -640) cqi=0;
...@@ -442,28 +454,64 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, ...@@ -442,28 +454,64 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
int off = ((pusch_pdu->rb_size&1) == 1)? 4:0; int off = ((pusch_pdu->rb_size&1) == 1)? 4:0;
LOG_M("rxsigF0.m","rxsF0",&gNB->common_vars.rxdataF[0][(slot_rx&3)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1); LOG_M("rxsigF0.m","rxsF0",&gNB->common_vars.rxdataF[0][(slot_rx&3)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1);
LOG_M("rxsigF0_ext.m","rxsF0_ext", LOG_M("rxsigF0_ext.m",
&gNB->pusch_vars[0]->rxdataF_ext[0][pusch_pdu->start_symbol_index*NR_NB_SC_PER_RB * pusch_pdu->rb_size],pusch_pdu->nr_of_symbols*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1); "rxsF0_ext",
LOG_M("chestF0.m","chF0", &gNB->pusch_vars[0].rxdataF_ext[0][pusch_pdu->start_symbol_index * NR_NB_SC_PER_RB * pusch_pdu->rb_size],
&gNB->pusch_vars[0]->ul_ch_estimates[0][pusch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size],gNB->frame_parms.ofdm_symbol_size,1,1); pusch_pdu->nr_of_symbols * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
LOG_M("chestF0_ext.m","chF0_ext", 1,
&gNB->pusch_vars[0]->ul_ch_estimates_ext[0][(pusch_pdu->start_symbol_index+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))], 1);
(pusch_pdu->nr_of_symbols-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1); LOG_M("chestF0.m",
LOG_M("rxsigF0_comp.m","rxsF0_comp", "chF0",
&gNB->pusch_vars[0]->rxdataF_comp[0][pusch_pdu->start_symbol_index*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],pusch_pdu->nr_of_symbols*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1); &gNB->pusch_vars[0].ul_ch_estimates[0][pusch_pdu->start_symbol_index * gNB->frame_parms.ofdm_symbol_size],
LOG_M("rxsigF0_llr.m","rxsF0_llr", gNB->frame_parms.ofdm_symbol_size,
&gNB->pusch_vars[0]->llr[0],(pusch_pdu->nr_of_symbols-1)*NR_NB_SC_PER_RB *pusch_pdu->rb_size * pusch_pdu->qam_mod_order,1,0); 1,
1);
LOG_M("chestF0_ext.m",
"chF0_ext",
&gNB->pusch_vars[0]
.ul_ch_estimates_ext[0][(pusch_pdu->start_symbol_index + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
(pusch_pdu->nr_of_symbols - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1,
1);
LOG_M("rxsigF0_comp.m",
"rxsF0_comp",
&gNB->pusch_vars[0].rxdataF_comp[0][pusch_pdu->start_symbol_index * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
pusch_pdu->nr_of_symbols * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1,
1);
LOG_M("rxsigF0_llr.m",
"rxsF0_llr",
&gNB->pusch_vars[0].llr[0],
(pusch_pdu->nr_of_symbols - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * pusch_pdu->qam_mod_order,
1,
0);
if (gNB->frame_parms.nb_antennas_rx > 1) { if (gNB->frame_parms.nb_antennas_rx > 1) {
LOG_M("rxsigF1.m","rxsF1",&gNB->common_vars.rxdataF[1][(slot_rx&3)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1); LOG_M("rxsigF1.m","rxsF1",&gNB->common_vars.rxdataF[1][(slot_rx&3)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1);
LOG_M("rxsigF1_ext.m","rxsF1_ext", LOG_M("rxsigF1_ext.m",
&gNB->pusch_vars[0]->rxdataF_ext[1][pusch_pdu->start_symbol_index*NR_NB_SC_PER_RB * pusch_pdu->rb_size],pusch_pdu->nr_of_symbols*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1); "rxsF1_ext",
LOG_M("chestF1.m","chF1", &gNB->pusch_vars[0].rxdataF_ext[1][pusch_pdu->start_symbol_index * NR_NB_SC_PER_RB * pusch_pdu->rb_size],
&gNB->pusch_vars[0]->ul_ch_estimates[1][pusch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size],gNB->frame_parms.ofdm_symbol_size,1,1); pusch_pdu->nr_of_symbols * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
LOG_M("chestF1_ext.m","chF1_ext", 1,
&gNB->pusch_vars[0]->ul_ch_estimates_ext[1][(pusch_pdu->start_symbol_index+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))], 1);
(pusch_pdu->nr_of_symbols-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1); LOG_M("chestF1.m",
LOG_M("rxsigF1_comp.m","rxsF1_comp", "chF1",
&gNB->pusch_vars[0]->rxdataF_comp[1][pusch_pdu->start_symbol_index*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],pusch_pdu->nr_of_symbols*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1); &gNB->pusch_vars[0].ul_ch_estimates[1][pusch_pdu->start_symbol_index * gNB->frame_parms.ofdm_symbol_size],
gNB->frame_parms.ofdm_symbol_size,
1,
1);
LOG_M("chestF1_ext.m",
"chF1_ext",
&gNB->pusch_vars[0]
.ul_ch_estimates_ext[1][(pusch_pdu->start_symbol_index + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
(pusch_pdu->nr_of_symbols - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1,
1);
LOG_M("rxsigF1_comp.m",
"rxsF1_comp",
&gNB->pusch_vars[0].rxdataF_comp[1][pusch_pdu->start_symbol_index * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
pusch_pdu->nr_of_symbols * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1,
1);
} }
exit(-1); exit(-1);
...@@ -483,7 +531,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, ...@@ -483,7 +531,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
gNB->crc_pdu_list[num_crc].ul_cqi = cqi; gNB->crc_pdu_list[num_crc].ul_cqi = cqi;
gNB->crc_pdu_list[num_crc].timing_advance = timing_advance_update; gNB->crc_pdu_list[num_crc].timing_advance = timing_advance_update;
// in terms of dBFS range -128 to 0 with 0.1 step // in terms of dBFS range -128 to 0 with 0.1 step
gNB->crc_pdu_list[num_crc].rssi = (dtx_flag==0) ? 1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0])) : 0; gNB->crc_pdu_list[num_crc].rssi =
(dtx_flag == 0) ? 1280 - (10 * dB_fixed(32767 * 32767) - dB_fixed_times10(gNB->pusch_vars[ULSCH_id].ulsch_power[0])) : 0;
gNB->UL_INFO.crc_ind.number_crcs++; gNB->UL_INFO.crc_ind.number_crcs++;
...@@ -508,7 +557,6 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, ...@@ -508,7 +557,6 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
gNB->UL_INFO.rx_ind.number_of_pdus++; gNB->UL_INFO.rx_ind.number_of_pdus++;
pthread_mutex_unlock(&gNB->UL_INFO_mutex); pthread_mutex_unlock(&gNB->UL_INFO_mutex);
} }
// Function to fill UL RB mask to be used for N0 measurements // Function to fill UL RB mask to be used for N0 measurements
...@@ -530,7 +578,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -530,7 +578,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
} }
for (int i = 0; i < gNB->max_nb_pucch; i++){ for (int i = 0; i < gNB->max_nb_pucch; i++){
NR_gNB_PUCCH_t *pucch = gNB->pucch[i]; NR_gNB_PUCCH_t *pucch = &gNB->pucch[i];
if (pucch) { if (pucch) {
if ((pucch->active == 1) && if ((pucch->active == 1) &&
(pucch->frame == frame_rx) && (pucch->frame == frame_rx) &&
...@@ -553,22 +601,23 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -553,22 +601,23 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
} }
for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) { for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) {
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; NR_gNB_ULSCH_t *ulsch = &gNB->ulsch[ULSCH_id];
int harq_pid; int harq_pid;
NR_UL_gNB_HARQ_t *ulsch_harq = ulsch->harq_process; NR_UL_gNB_HARQ_t *ulsch_harq = ulsch->harq_process;
AssertFatal(ulsch_harq != NULL,"harq_pid %d is not allocated\n",harq_pid); AssertFatal(ulsch_harq != NULL, "harq_pid %d is not allocated\n", harq_pid);
if ((ulsch->active == true) && if ((ulsch->active == true) && (ulsch->frame == frame_rx) && (ulsch->slot == slot_rx) && (ulsch->handled == 0)) {
(ulsch->frame == frame_rx) &&
(ulsch->slot == slot_rx) &&
(ulsch->handled == 0)) {
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index; uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols; uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
for (int symbol = symbol_start ; symbol < symbol_end ; symbol++) { for (int symbol = symbol_start; symbol < symbol_end; symbol++) {
if(gNB->frame_parms.frame_type == FDD || if (gNB->frame_parms.frame_type == FDD
(gNB->frame_parms.frame_type == TDD && gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx].max_num_of_symbol_per_slot_list[symbol].slot_config.value==1)) { || (gNB->frame_parms.frame_type == TDD
LOG_D(PHY,"symbol %d Filling rb_mask_ul rb_size %d\n",symbol,ulsch_harq->ulsch_pdu.rb_size); && gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx]
for (rb=0; rb<ulsch_harq->ulsch_pdu.rb_size; rb++) { .max_num_of_symbol_per_slot_list[symbol]
rb2 = rb+ulsch_harq->ulsch_pdu.rb_start+ulsch_harq->ulsch_pdu.bwp_start; .slot_config.value
== 1)) {
LOG_D(PHY, "symbol %d Filling rb_mask_ul rb_size %d\n", symbol, ulsch_harq->ulsch_pdu.rb_size);
for (rb = 0; rb < ulsch_harq->ulsch_pdu.rb_size; rb++) {
rb2 = rb + ulsch_harq->ulsch_pdu.rb_start + ulsch_harq->ulsch_pdu.bwp_start;
gNB->rb_mask_ul[symbol][rb2 >> 5] |= 1U << (rb2 & 31); gNB->rb_mask_ul[symbol][rb2 >> 5] |= 1U << (rb2 & 31);
} }
} }
...@@ -577,7 +626,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -577,7 +626,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
} }
for (int i = 0; i < gNB->max_nb_srs; i++) { for (int i = 0; i < gNB->max_nb_srs; i++) {
NR_gNB_SRS_t *srs = gNB->srs[i]; NR_gNB_SRS_t *srs = &gNB->srs[i];
if (srs) { if (srs) {
if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) { if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) {
nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu; nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu;
...@@ -680,7 +729,6 @@ int check_srs_pdu(const nfapi_nr_srs_pdu_t *srs_pdu, nfapi_nr_srs_pdu_t *saved_s ...@@ -680,7 +729,6 @@ int check_srs_pdu(const nfapi_nr_srs_pdu_t *srs_pdu, nfapi_nr_srs_pdu_t *saved_s
int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
{ {
/* those variables to log T_GNB_PHY_PUCCH_PUSCH_IQ only when we try to decode */ /* those variables to log T_GNB_PHY_PUCCH_PUSCH_IQ only when we try to decode */
int pucch_decode_done = 0; int pucch_decode_done = 0;
int pusch_decode_done = 0; int pusch_decode_done = 0;
...@@ -700,7 +748,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -700,7 +748,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
} }
} }
else else
num_symb=NR_NUMBER_OF_SYMBOLS_PER_SLOT; num_symb = NR_NUMBER_OF_SYMBOLS_PER_SLOT;
gNB_I0_measurements(gNB,slot_rx,first_symb,num_symb); gNB_I0_measurements(gNB,slot_rx,first_symb,num_symb);
const int soffset = (slot_rx & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size; const int soffset = (slot_rx & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size;
...@@ -711,7 +759,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -711,7 +759,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
start_meas(&gNB->phy_proc_rx); start_meas(&gNB->phy_proc_rx);
for (int i = 0; i < gNB->max_nb_pucch; i++) { for (int i = 0; i < gNB->max_nb_pucch; i++) {
NR_gNB_PUCCH_t *pucch = gNB->pucch[i]; NR_gNB_PUCCH_t *pucch = &gNB->pucch[i];
if (pucch) { if (pucch) {
if (NFAPI_MODE == NFAPI_MODE_PNF) if (NFAPI_MODE == NFAPI_MODE_PNF)
pucch->frame = frame_rx; pucch->frame = frame_rx;
...@@ -755,7 +803,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -755,7 +803,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t); gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t);
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4; nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4;
LOG_D(PHY,"%d.%d Calling nr_decode_pucch2\n", frame_rx, slot_rx); LOG_D(PHY, "%d.%d Calling nr_decode_pucch2\n", frame_rx, slot_rx);
nr_decode_pucch2(gNB, nr_decode_pucch2(gNB,
frame_rx, frame_rx,
slot_rx, slot_rx,
...@@ -766,25 +814,19 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -766,25 +814,19 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
pucch->active = 0; pucch->active = 0;
break; break;
default: default:
AssertFatal(1==0,"Only PUCCH formats 0 and 2 are currently supported\n"); AssertFatal(1 == 0, "Only PUCCH formats 0 and 2 are currently supported\n");
} }
} }
} }
} }
for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) { for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) {
NR_gNB_ULSCH_t *ulsch = &gNB->ulsch[ULSCH_id];
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id];
NR_UL_gNB_HARQ_t *ulsch_harq = ulsch->harq_process; NR_UL_gNB_HARQ_t *ulsch_harq = ulsch->harq_process;
AssertFatal(ulsch_harq != NULL, "harq_pid %d is not allocated\n", ulsch->harq_pid); AssertFatal(ulsch_harq != NULL, "harq_pid %d is not allocated\n", ulsch->harq_pid);
if ((ulsch->active == true) && if ((ulsch->active == true) && (ulsch->frame == frame_rx) && (ulsch->slot == slot_rx) && (ulsch->handled == 0)) {
(ulsch->frame == frame_rx) && LOG_D(PHY, "PUSCH ID %d with RNTI %x detection started in frame %d slot %d\n", ULSCH_id, ulsch->rnti, frame_rx, slot_rx);
(ulsch->slot == slot_rx) &&
(ulsch->handled == 0)) {
LOG_D(PHY, "PUSCH ID %d with RNTI %x detection started in frame %d slot %d\n",
ULSCH_id, ulsch->rnti, frame_rx, slot_rx);
int num_dmrs = 0; int num_dmrs = 0;
for (int s = 0; s < NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++) for (int s = 0; s < NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++)
num_dmrs += (ulsch_harq->ulsch_pdu.ul_dmrs_symb_pos >> s) & 1; num_dmrs += (ulsch_harq->ulsch_pdu.ul_dmrs_symb_pos >> s) & 1;
...@@ -792,25 +834,32 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -792,25 +834,32 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
#ifdef DEBUG_RXDATA #ifdef DEBUG_RXDATA
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
RU_t *ru = gNB->RU_list[0]; RU_t *ru = gNB->RU_list[0];
int slot_offset = frame_parms->get_samples_slot_timestamp(slot_rx,frame_parms,0); int slot_offset = frame_parms->get_samples_slot_timestamp(slot_rx, frame_parms, 0);
slot_offset -= ru->N_TA_offset; slot_offset -= ru->N_TA_offset;
int32_t sample_offset = gNB->common_vars.debugBuff_sample_offset; int32_t sample_offset = gNB->common_vars.debugBuff_sample_offset;
nfapi_nr_pusch_pdu_t *pdu = &ulsch_harq->ulsch_pdu; nfapi_nr_pusch_pdu_t *pdu = &ulsch_harq->ulsch_pdu;
int16_t *buf = (int16_t*)&gNB->common_vars.debugBuff[offset]; int16_t *buf = (int16_t *)&gNB->common_vars.debugBuff[offset];
buf[0]=(int16_t)ulsch->rnti; buf[0] = (int16_t)ulsch->rnti;
buf[1]=(int16_t)pdu->rb_size; buf[1] = (int16_t)pdu->rb_size;
buf[2]=(int16_t)pdu->rb_start; buf[2] = (int16_t)pdu->rb_start;
buf[3]=(int16_t)pdu->nr_of_symbols; buf[3] = (int16_t)pdu->nr_of_symbols;
buf[4]=(int16_t)pdu->start_symbol_index; buf[4] = (int16_t)pdu->start_symbol_index;
buf[5]=(int16_t)pdu->mcs_index; buf[5] = (int16_t)pdu->mcs_index;
buf[6]=(int16_t)pdu->pusch_data.rv_index; buf[6] = (int16_t)pdu->pusch_data.rv_index;
buf[7]=(int16_t)ulsch->harq_pid; buf[7] = (int16_t)ulsch->harq_pid;
memcpy(&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset+4],&ru->common.rxdata[0][slot_offset],frame_parms->get_samples_per_slot(slot_rx,frame_parms)*sizeof(int32_t)); memcpy(&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset + 4],
gNB->common_vars.debugBuff_sample_offset+=(frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+4); &ru->common.rxdata[0][slot_offset],
if(gNB->common_vars.debugBuff_sample_offset>((frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+2)*20)) { frame_parms->get_samples_per_slot(slot_rx, frame_parms) * sizeof(int32_t));
gNB->common_vars.debugBuff_sample_offset += (frame_parms->get_samples_per_slot(slot_rx, frame_parms) + 1000 + 4);
if (gNB->common_vars.debugBuff_sample_offset > ((frame_parms->get_samples_per_slot(slot_rx, frame_parms) + 1000 + 2) * 20)) {
FILE *f; FILE *f;
f = fopen("rxdata_buff.raw", "w"); if (f == NULL) exit(1); f = fopen("rxdata_buff.raw", "w");
fwrite((int16_t*)gNB->common_vars.debugBuff,2,(frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+4)*20*2, f); if (f == NULL)
exit(1);
fwrite((int16_t *)gNB->common_vars.debugBuff,
2,
(frame_parms->get_samples_per_slot(slot_rx, frame_parms) + 1000 + 4) * 20 * 2,
f);
fclose(f); fclose(f);
exit(-1); exit(-1);
} }
...@@ -818,28 +867,32 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -818,28 +867,32 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
pusch_decode_done = 1; pusch_decode_done = 1;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH, 1);
start_meas(&gNB->rx_pusch_stats); start_meas(&gNB->rx_pusch_stats);
nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid); nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid);
NR_gNB_PUSCH *pusch_vars = gNB->pusch_vars[ULSCH_id]; NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ULSCH_id];
pusch_vars->ulsch_power_tot = 0; pusch_vars->ulsch_power_tot = 0;
pusch_vars->ulsch_noise_power_tot = 0; pusch_vars->ulsch_noise_power_tot = 0;
for (int aarx=0;aarx<gNB->frame_parms.nb_antennas_rx;aarx++) { for (int aarx = 0; aarx < gNB->frame_parms.nb_antennas_rx; aarx++) {
pusch_vars->ulsch_power[aarx] /= num_dmrs; pusch_vars->ulsch_power[aarx] /= num_dmrs;
pusch_vars->ulsch_power_tot += pusch_vars->ulsch_power[aarx]; pusch_vars->ulsch_power_tot += pusch_vars->ulsch_power[aarx];
pusch_vars->ulsch_noise_power[aarx] /= num_dmrs; pusch_vars->ulsch_noise_power[aarx] /= num_dmrs;
pusch_vars->ulsch_noise_power_tot += pusch_vars->ulsch_noise_power[aarx]; pusch_vars->ulsch_noise_power_tot += pusch_vars->ulsch_noise_power[aarx];
} }
if (dB_fixed_x10(pusch_vars->ulsch_power_tot) < if (dB_fixed_x10(pusch_vars->ulsch_power_tot) < dB_fixed_x10(pusch_vars->ulsch_noise_power_tot) + gNB->pusch_thres) {
dB_fixed_x10(pusch_vars->ulsch_noise_power_tot) + gNB->pusch_thres) {
NR_gNB_PHY_STATS_t *stats = get_phy_stats(gNB, ulsch->rnti); NR_gNB_PHY_STATS_t *stats = get_phy_stats(gNB, ulsch->rnti);
LOG_D(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx, LOG_D(PHY,
"PUSCH not detected in %d.%d (%d,%d,%d)\n",
frame_rx,
slot_rx,
dB_fixed_x10(pusch_vars->ulsch_power_tot), dB_fixed_x10(pusch_vars->ulsch_power_tot),
dB_fixed_x10(pusch_vars->ulsch_noise_power_tot),gNB->pusch_thres); dB_fixed_x10(pusch_vars->ulsch_noise_power_tot),
gNB->pusch_thres);
pusch_vars->ulsch_power_tot = pusch_vars->ulsch_noise_power_tot; pusch_vars->ulsch_power_tot = pusch_vars->ulsch_noise_power_tot;
pusch_vars->DTX = 1; pusch_vars->DTX = 1;
if (stats) stats->ulsch_stats.DTX++; if (stats)
stats->ulsch_stats.DTX++;
if (!get_softmodem_params()->phy_test) { if (!get_softmodem_params()->phy_test) {
/* in case of phy_test mode, we still want to decode to measure execution time. /* in case of phy_test mode, we still want to decode to measure execution time.
Therefore, we don't yet call nr_fill_indication, it will be called later */ Therefore, we don't yet call nr_fill_indication, it will be called later */
...@@ -848,24 +901,28 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -848,24 +901,28 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
continue; continue;
} }
} else { } else {
LOG_D(PHY, "PUSCH detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx, LOG_D(PHY,
"PUSCH detected in %d.%d (%d,%d,%d)\n",
frame_rx,
slot_rx,
dB_fixed_x10(pusch_vars->ulsch_power_tot), dB_fixed_x10(pusch_vars->ulsch_power_tot),
dB_fixed_x10(pusch_vars->ulsch_noise_power_tot),gNB->pusch_thres); dB_fixed_x10(pusch_vars->ulsch_noise_power_tot),
gNB->pusch_thres);
pusch_vars->DTX=0; pusch_vars->DTX = 0;
} }
stop_meas(&gNB->rx_pusch_stats); stop_meas(&gNB->rx_pusch_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH, 0);
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1); // LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1);
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1); // LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX, 1);
nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, ulsch->harq_pid); nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, ulsch->harq_pid);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX, 0);
} }
} }
for (int i = 0; i < gNB->max_nb_srs; i++) { for (int i = 0; i < gNB->max_nb_srs; i++) {
NR_gNB_SRS_t *srs = gNB->srs[i]; NR_gNB_SRS_t *srs = &gNB->srs[i];
if (srs) { if (srs) {
if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) { if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) {
LOG_D(NR_PHY, "(%d.%d) gNB is waiting for SRS, id = %i\n", frame_rx, slot_rx, i); LOG_D(NR_PHY, "(%d.%d) gNB is waiting for SRS, id = %i\n", frame_rx, slot_rx, i);
......
...@@ -422,7 +422,7 @@ int main(int argc, char **argv) ...@@ -422,7 +422,7 @@ int main(int argc, char **argv)
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe]; unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
processingData_L1tx_t msgDataTx; processingData_L1tx_t msgDataTx;
init_DLSCH_struct(gNB, &msgDataTx); init_DLSCH_struct(gNB, &msgDataTx);
NR_gNB_DLSCH_t *dlsch = msgDataTx.dlsch[0][0]; NR_gNB_DLSCH_t *dlsch = &msgDataTx.dlsch[0][0];
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
//time_stats_t *rm_stats, *te_stats, *i_stats; //time_stats_t *rm_stats, *te_stats, *i_stats;
unsigned int TBS = 8424; unsigned int TBS = 8424;
......
...@@ -983,7 +983,7 @@ int main(int argc, char **argv) ...@@ -983,7 +983,7 @@ int main(int argc, char **argv)
int harq_pid = slot; int harq_pid = slot;
NR_DL_UE_HARQ_t *UE_harq_process = &UE->dl_harq_processes[0][harq_pid]; NR_DL_UE_HARQ_t *UE_harq_process = &UE->dl_harq_processes[0][harq_pid];
NR_gNB_DLSCH_t *gNB_dlsch = msgDataTx->dlsch[0][0]; NR_gNB_DLSCH_t *gNB_dlsch = &msgDataTx->dlsch[0][0];
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
UE_harq_process->ack = 0; UE_harq_process->ack = 0;
...@@ -1245,8 +1245,10 @@ int main(int argc, char **argv) ...@@ -1245,8 +1245,10 @@ int main(int argc, char **argv)
if (print_perf==1) { if (print_perf==1) {
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, block %d)\n", printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, block %d)\n",
1000>>*scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex, 1000 >> *scc->ssbSubcarrierSpacing,
msgDataTx->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3); g_rbSize,
g_mcsIndex,
msgDataTx->dlsch[0][0].harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0] << 3);
printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx"); printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx");
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time"); printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time"); printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time");
......
...@@ -455,7 +455,7 @@ int main(int argc, char **argv) ...@@ -455,7 +455,7 @@ int main(int argc, char **argv)
uint8_t rvidx = 0; uint8_t rvidx = 0;
uint8_t UE_id = 0; uint8_t UE_id = 0;
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id]; NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id];
NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_process; NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_process;
nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu; nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu;
...@@ -614,7 +614,7 @@ int main(int argc, char **argv) ...@@ -614,7 +614,7 @@ int main(int argc, char **argv)
errors_bit = 0; errors_bit = 0;
for (i = 0; i < TBS; i++) { for (i = 0; i < TBS; i++) {
estimated_output_bit[i] = (ulsch_gNB->harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7); estimated_output_bit[i] = (ulsch_gNB->harq_process->b[i / 8] & (1 << (i & 7))) >> (i & 7);
test_input_bit[i] = (test_input[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments test_input_bit[i] = (test_input[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
if (estimated_output_bit[i] != test_input_bit[i]) { if (estimated_output_bit[i] != test_input_bit[i]) {
......
...@@ -752,9 +752,9 @@ int main(int argc, char **argv) ...@@ -752,9 +752,9 @@ int main(int argc, char **argv)
unsigned char harq_pid = 0; unsigned char harq_pid = 0;
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id]; NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id];
//nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_process->ulsch_pdu; // nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_process->ulsch_pdu;
nfapi_nr_ul_tti_request_t *UL_tti_req = malloc(sizeof(*UL_tti_req)); nfapi_nr_ul_tti_request_t *UL_tti_req = malloc(sizeof(*UL_tti_req));
NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO)); NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO));
memset((void*)Sched_INFO,0,sizeof(*Sched_INFO)); memset((void*)Sched_INFO,0,sizeof(*Sched_INFO));
...@@ -1302,140 +1302,196 @@ int main(int argc, char **argv) ...@@ -1302,140 +1302,196 @@ int main(int argc, char **argv)
} }
} }
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[UE_id];
if (n_trials == 1 && round == 0) { if (n_trials == 1 && round == 0) {
__attribute__((unused)) int off = ((nb_rb & 1) == 1) ? 4 : 0; __attribute__((unused)) int off = ((nb_rb & 1) == 1) ? 4 : 0;
LOG_M("rxsigF0_ext.m", LOG_M("rxsigF0_ext.m",
"rxsF0_ext", "rxsF0_ext",
&gNB->pusch_vars[0]->rxdataF_ext[0][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size], &pusch_vars->rxdataF_ext[0][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("chestF0.m", "chF0", &gNB->pusch_vars[0]->ul_ch_estimates[0][start_symbol * frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1); LOG_M("chestF0.m",
LOG_M("chestT0.m", "chT0", &gNB->pusch_vars[0]->ul_ch_estimates_time[0][0], frame_parms->ofdm_symbol_size, 1, 1); "chF0",
&pusch_vars->ul_ch_estimates[0][start_symbol * frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size,
1,
1);
LOG_M("chestT0.m", "chT0", &pusch_vars->ul_ch_estimates_time[0][0], frame_parms->ofdm_symbol_size, 1, 1);
LOG_M("chestF0_ext.m", LOG_M("chestF0_ext.m",
"chF0_ext", "chF0_ext",
&gNB->pusch_vars[0]->ul_ch_estimates_ext[0][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->ul_ch_estimates_ext[0][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
(nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), (nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF0_comp.m", LOG_M("rxsigF0_comp.m",
"rxsF0_comp", "rxsF0_comp",
&gNB->pusch_vars[0]->rxdataF_comp[0][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->rxdataF_comp[0][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("chmagF0.m", LOG_M("chmagF0.m",
"chmF0", "chmF0",
&gNB->pusch_vars[0]->ul_ch_mag[0][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->ul_ch_mag[0][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("chmagbF0.m", LOG_M("chmagbF0.m",
"chmbF0", "chmbF0",
&gNB->pusch_vars[0]->ul_ch_magb[0][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->ul_ch_magb[0][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF0_llrlayers0.m", "rxsF0_llrlayers0", &gNB->pusch_vars[0]->llr_layers[0][0], (nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order, 1, 0); LOG_M("rxsigF0_llrlayers0.m",
"rxsF0_llrlayers0",
&pusch_vars->llr_layers[0][0],
(nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,
1,
0);
if (precod_nbr_layers == 2) { if (precod_nbr_layers == 2) {
LOG_M("rxsigF1_ext.m", LOG_M("rxsigF1_ext.m",
"rxsF1_ext", "rxsF1_ext",
&gNB->pusch_vars[0]->rxdataF_ext[1][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size], &pusch_vars->rxdataF_ext[1][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("chestF3.m", "chF3", &gNB->pusch_vars[0]->ul_ch_estimates[3][start_symbol * frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1); LOG_M("chestF3.m",
"chF3",
&pusch_vars->ul_ch_estimates[3][start_symbol * frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size,
1,
1);
LOG_M("chestF3_ext.m", LOG_M("chestF3_ext.m",
"chF3_ext", "chF3_ext",
&gNB->pusch_vars[0]->ul_ch_estimates_ext[3][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->ul_ch_estimates_ext[3][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
(nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), (nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF2_comp.m", LOG_M("rxsigF2_comp.m",
"rxsF2_comp", "rxsF2_comp",
&gNB->pusch_vars[0]->rxdataF_comp[2][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->rxdataF_comp[2][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF0_llrlayers1.m", "rxsF0_llrlayers1", &gNB->pusch_vars[0]->llr_layers[1][0], (nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order, 1, 0); LOG_M("rxsigF0_llrlayers1.m",
"rxsF0_llrlayers1",
&pusch_vars->llr_layers[1][0],
(nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,
1,
0);
} }
if (precod_nbr_layers == 4) { if (precod_nbr_layers == 4) {
LOG_M("rxsigF1_ext.m", LOG_M("rxsigF1_ext.m",
"rxsF1_ext", "rxsF1_ext",
&gNB->pusch_vars[0]->rxdataF_ext[1][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size], &pusch_vars->rxdataF_ext[1][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF2_ext.m", LOG_M("rxsigF2_ext.m",
"rxsF2_ext", "rxsF2_ext",
&gNB->pusch_vars[0]->rxdataF_ext[2][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size], &pusch_vars->rxdataF_ext[2][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF3_ext.m", LOG_M("rxsigF3_ext.m",
"rxsF3_ext", "rxsF3_ext",
&gNB->pusch_vars[0]->rxdataF_ext[3][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size], &pusch_vars->rxdataF_ext[3][start_symbol * NR_NB_SC_PER_RB * pusch_pdu->rb_size],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("chestF5.m", "chF5", &gNB->pusch_vars[0]->ul_ch_estimates[5][start_symbol * frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1); LOG_M("chestF5.m",
LOG_M("chestF10.m", "chF10", &gNB->pusch_vars[0]->ul_ch_estimates[10][start_symbol * frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1); "chF5",
LOG_M("chestF15.m", "chF15", &gNB->pusch_vars[0]->ul_ch_estimates[15][start_symbol * frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1); &pusch_vars->ul_ch_estimates[5][start_symbol * frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size,
1,
1);
LOG_M("chestF10.m",
"chF10",
&pusch_vars->ul_ch_estimates[10][start_symbol * frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size,
1,
1);
LOG_M("chestF15.m",
"chF15",
&pusch_vars->ul_ch_estimates[15][start_symbol * frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size,
1,
1);
LOG_M("chestF5_ext.m", LOG_M("chestF5_ext.m",
"chF5_ext", "chF5_ext",
&gNB->pusch_vars[0]->ul_ch_estimates_ext[5][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->ul_ch_estimates_ext[5][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
(nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), (nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("chestF10_ext.m", LOG_M("chestF10_ext.m",
"chF10_ext", "chF10_ext",
&gNB->pusch_vars[0]->ul_ch_estimates_ext[10][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->ul_ch_estimates_ext[10][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
(nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), (nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("chestF15_ext.m", LOG_M("chestF15_ext.m",
"chF15_ext", "chF15_ext",
&gNB->pusch_vars[0]->ul_ch_estimates_ext[15][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->ul_ch_estimates_ext[15][(start_symbol + 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
(nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), (nb_symb_sch - 1) * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF4_comp.m", LOG_M("rxsigF4_comp.m",
"rxsF4_comp", "rxsF4_comp",
&gNB->pusch_vars[0]->rxdataF_comp[4][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->rxdataF_comp[4][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF8_comp.m", LOG_M("rxsigF8_comp.m",
"rxsF8_comp", "rxsF8_comp",
&gNB->pusch_vars[0]->rxdataF_comp[8][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->rxdataF_comp[8][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF12_comp.m", LOG_M("rxsigF12_comp.m",
"rxsF12_comp", "rxsF12_comp",
&gNB->pusch_vars[0]->rxdataF_comp[12][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))], &pusch_vars->rxdataF_comp[12][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)), nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1, 1,
1); 1);
LOG_M("rxsigF0_llrlayers1.m", "rxsF0_llrlayers1", &gNB->pusch_vars[0]->llr_layers[1][0], (nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order, 1, 0); LOG_M("rxsigF0_llrlayers1.m",
LOG_M("rxsigF0_llrlayers2.m", "rxsF0_llrlayers2", &gNB->pusch_vars[0]->llr_layers[2][0], (nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order, 1, 0); "rxsF0_llrlayers1",
LOG_M("rxsigF0_llrlayers3.m", "rxsF0_llrlayers3", &gNB->pusch_vars[0]->llr_layers[3][0], (nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order, 1, 0); &pusch_vars->llr_layers[1][0],
(nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,
1,
0);
LOG_M("rxsigF0_llrlayers2.m",
"rxsF0_llrlayers2",
&pusch_vars->llr_layers[2][0],
(nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,
1,
0);
LOG_M("rxsigF0_llrlayers3.m",
"rxsF0_llrlayers3",
&pusch_vars->llr_layers[3][0],
(nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,
1,
0);
} }
LOG_M("rxsigF0_llr.m", "rxsF0_llr", &gNB->pusch_vars[0]->llr[0], precod_nbr_layers * (nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order, 1, 0); LOG_M("rxsigF0_llr.m",
"rxsF0_llr",
&pusch_vars->llr[0],
precod_nbr_layers * (nb_symb_sch - 1) * NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,
1,
0);
} }
if ((gNB->ulsch[0]->last_iteration_cnt >= gNB->ulsch[0]->max_ldpc_iterations + 1) || ul_proc_error == 1) { if ((ulsch_gNB->last_iteration_cnt >= ulsch_gNB->max_ldpc_iterations + 1) || ul_proc_error == 1) {
error_flag = 1; error_flag = 1;
n_errors[round]++; n_errors[round]++;
crc_status = 1; crc_status = 1;
...@@ -1451,7 +1507,7 @@ int main(int argc, char **argv) ...@@ -1451,7 +1507,7 @@ int main(int argc, char **argv)
if ((pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) && (SNR == snr0) && (trial == 0) && (round == 0)) { if ((pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) && (SNR == snr0) && (trial == 0) && (round == 0)) {
ptrs_symbols = 0; ptrs_symbols = 0;
for (int i = pusch_pdu->start_symbol_index; i < pusch_pdu->start_symbol_index + pusch_pdu->nr_of_symbols; i++) for (int i = pusch_pdu->start_symbol_index; i < pusch_pdu->start_symbol_index + pusch_pdu->nr_of_symbols; i++)
ptrs_symbols += ((gNB->pusch_vars[UE_id]->ptrs_symbols) >> i) & 1; ptrs_symbols += ((pusch_vars->ptrs_symbols) >> i) & 1;
/* 2*5*(50/2), for RB = 50,K = 2 for 5 OFDM PTRS symbols */ /* 2*5*(50/2), for RB = 50,K = 2 for 5 OFDM PTRS symbols */
available_bits -= 2 * ptrs_symbols * ((nb_rb + ptrs_freq_density - 1) / ptrs_freq_density); available_bits -= 2 * ptrs_symbols * ((nb_rb + ptrs_freq_density - 1) / ptrs_freq_density);
...@@ -1459,8 +1515,8 @@ int main(int argc, char **argv) ...@@ -1459,8 +1515,8 @@ int main(int argc, char **argv)
} }
for (i = 0; i < available_bits; i++) { for (i = 0; i < available_bits; i++) {
if (((UE->ul_harq_processes[harq_pid].f[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) if (((UE->ul_harq_processes[harq_pid].f[i] == 0) && (pusch_vars->llr[i] <= 0))
|| ((UE->ul_harq_processes[harq_pid].f[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0))) { || ((UE->ul_harq_processes[harq_pid].f[i] == 1) && (pusch_vars->llr[i] >= 0))) {
/*if(errors_scrambling == 0) /*if(errors_scrambling == 0)
printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/ printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/
errors_scrambling[round]++; errors_scrambling[round]++;
...@@ -1474,7 +1530,6 @@ int main(int argc, char **argv) ...@@ -1474,7 +1530,6 @@ int main(int argc, char **argv)
} }
for (i = 0; i < TBS; i++) { for (i = 0; i < TBS; i++) {
estimated_output_bit[i] = (ulsch_gNB->harq_process->b[i / 8] & (1 << (i & 7))) >> (i & 7); estimated_output_bit[i] = (ulsch_gNB->harq_process->b[i / 8] & (1 << (i & 7))) >> (i & 7);
test_input_bit[i] = (UE->ul_harq_processes[harq_pid].b[i / 8] & (1 << (i & 7))) >> (i & 7); test_input_bit[i] = (UE->ul_harq_processes[harq_pid].b[i / 8] & (1 << (i & 7))) >> (i & 7);
......
...@@ -1981,7 +1981,6 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces ...@@ -1981,7 +1981,6 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces
void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia) void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia)
{ {
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
destroy_nr_list(&sched_ctrl->available_dl_harq); destroy_nr_list(&sched_ctrl->available_dl_harq);
destroy_nr_list(&sched_ctrl->feedback_dl_harq); destroy_nr_list(&sched_ctrl->feedback_dl_harq);
......
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