Commit 6e936198 authored by Robert Schmidt's avatar Robert Schmidt Committed by francescomani

review comments

parent 77974857
...@@ -93,9 +93,9 @@ NR_gNB_PHY_STATS_t *get_phy_stats(PHY_VARS_gNB *gNB, uint16_t rnti) ...@@ -93,9 +93,9 @@ NR_gNB_PHY_STATS_t *get_phy_stats(PHY_VARS_gNB *gNB, uint16_t rnti)
stats = &gNB->phy_stats[first_free]; stats = &gNB->phy_stats[first_free];
stats->active = true; stats->active = true;
stats->rnti = rnti; stats->rnti = rnti;
memset((void*)&stats->dlsch_stats, 0, sizeof(stats->dlsch_stats)); memset(&stats->dlsch_stats, 0, sizeof(stats->dlsch_stats));
memset((void*)&stats->ulsch_stats, 0, sizeof(stats->ulsch_stats)); memset(&stats->ulsch_stats, 0, sizeof(stats->ulsch_stats));
memset((void*)&stats->uci_stats, 0, sizeof(stats->uci_stats)); memset(&stats->uci_stats, 0, sizeof(stats->uci_stats));
return(stats); return(stats);
} }
...@@ -1016,10 +1016,10 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) ...@@ -1016,10 +1016,10 @@ 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 = (NR_gNB_DLSCH_t ***)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_I(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);
...@@ -1079,8 +1079,6 @@ void init_nr_transport(PHY_VARS_gNB *gNB) ...@@ -1079,8 +1079,6 @@ 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->measurements.ulsch_measurements = (ULSCH_MEASUREMENTS_gNB *) malloc16(gNB->max_nb_pusch * sizeof(ULSCH_MEASUREMENTS_gNB));
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); LOG_D(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n", i, gNB->max_nb_pucch);
...@@ -1097,7 +1095,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) ...@@ -1097,7 +1095,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB)
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_I(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]) { if (!gNB->ulsch[i]) {
LOG_E(PHY,"Can't get gNB ulsch structures\n"); LOG_E(PHY,"Can't get gNB ulsch structures\n");
...@@ -1125,6 +1123,4 @@ void reset_nr_transport(PHY_VARS_gNB *gNB) ...@@ -1125,6 +1123,4 @@ void reset_nr_transport(PHY_VARS_gNB *gNB)
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); free(gNB->ulsch);
free(gNB->measurements.ulsch_measurements);
} }
...@@ -221,6 +221,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq ...@@ -221,6 +221,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
int ch_offset = fp->ofdm_symbol_size * symbol; int ch_offset = fp->ofdm_symbol_size * symbol;
int N_RB_UL = gNB->ulsch[ulsch_id]->harq_process->ulsch_pdu.rb_size; int N_RB_UL = gNB->ulsch[ulsch_id]->harq_process->ulsch_pdu.rb_size;
ulsch_measurements_gNB *ulsch_measurements = &gNB->ulsch[ulsch_id]->ulsch_measurements;
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++){
...@@ -229,14 +230,14 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq ...@@ -229,14 +230,14 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq
for (int aatx = 0; aatx < nrOfLayers; aatx++){ for (int aatx = 0; aatx < nrOfLayers; aatx++){
meas->ulsch_measurements[ulsch_id].rx_spatial_power[aatx][aarx] = (signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aatx*fp->nb_antennas_rx+aarx][ch_offset], N_RB_UL * NR_NB_SC_PER_RB)); ulsch_measurements->rx_spatial_power[aatx][aarx] = (signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aatx*fp->nb_antennas_rx+aarx][ch_offset], N_RB_UL * NR_NB_SC_PER_RB));
if (meas->ulsch_measurements[ulsch_id].rx_spatial_power[aatx][aarx] < 0) { if (ulsch_measurements->rx_spatial_power[aatx][aarx] < 0) {
meas->ulsch_measurements[ulsch_id].rx_spatial_power[aatx][aarx] = 0; ulsch_measurements->rx_spatial_power[aatx][aarx] = 0;
} }
meas->ulsch_measurements[ulsch_id].rx_spatial_power_dB[aatx][aarx] = (unsigned short) dB_fixed(meas->ulsch_measurements[ulsch_id].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] += meas->ulsch_measurements[ulsch_id].rx_spatial_power[aatx][aarx]; rx_power[aarx] += ulsch_measurements->rx_spatial_power[aatx][aarx];
} }
LOG_D(PHY, "[ULSCH ID %d] RX power in antenna %d = %d\n", ulsch_id, aarx, rx_power[aarx]); LOG_D(PHY, "[ULSCH ID %d] RX power in antenna %d = %d\n", ulsch_id, aarx, rx_power[aarx]);
...@@ -248,15 +249,15 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq ...@@ -248,15 +249,15 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq
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;
meas->ulsch_measurements[ulsch_id].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);
meas->ulsch_measurements[ulsch_id].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, "[ULSCH %d] 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, "[ULSCH %d] 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_id, ulsch_id,
meas->ulsch_measurements[ulsch_id].rx_rssi_dBm, ulsch_measurements->rx_rssi_dBm,
rx_power_avg_dB, rx_power_avg_dB,
N_RB_UL, N_RB_UL,
meas->ulsch_measurements[ulsch_id].wideband_cqi_tot, ulsch_measurements->wideband_cqi_tot,
meas->n0_power_tot, meas->n0_power_tot,
rx_power_tot); rx_power_tot);
......
...@@ -85,7 +85,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, ...@@ -85,7 +85,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
else else
harq->round++; harq->round++;
memcpy((void*)&ulsch->harq_process->ulsch_pdu, (void*)ulsch_pdu, sizeof(nfapi_nr_pusch_pdu_t)); memcpy(&ulsch->harq_process->ulsch_pdu, ulsch_pdu, sizeof(ulsch->harq_process->ulsch_pdu));
LOG_D(PHY,"Initializing nFAPI for ULSCH, UE %d, harq_pid %d\n", ulsch_id, harq_pid); LOG_D(PHY,"Initializing nFAPI for ULSCH, UE %d, harq_pid %d\n", ulsch_id, harq_pid);
} }
...@@ -141,15 +141,15 @@ void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB) ...@@ -141,15 +141,15 @@ void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB)
aa, stats->ulsch_stats.power[aa]/10, stats->ulsch_stats.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); aa, stats->ulsch_stats.noise_power[aa]/10, stats->ulsch_stats.noise_power[aa]%10);
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",
stats->ulsch_stats.round_trials[0], rt[0],
(double)stats->ulsch_stats.round_trials[1]/stats->ulsch_stats.round_trials[0], (double)rt[1]/rt[0],
stats->ulsch_stats.round_trials[1], rt[1],
(double)stats->ulsch_stats.round_trials[2]/stats->ulsch_stats.round_trials[0], (double)rt[2]/rt[0],
stats->ulsch_stats.round_trials[2], rt[2],
(double)stats->ulsch_stats.round_trials[3]/stats->ulsch_stats.round_trials[0], (double)rt[3]/rt[0],
stats->ulsch_stats.round_trials[3], rt[3],
stats->ulsch_stats.DTX, stats->ulsch_stats.DTX,
stats->ulsch_stats.current_Qm, stats->ulsch_stats.current_Qm,
stats->ulsch_stats.current_RI, stats->ulsch_stats.current_RI,
......
...@@ -95,19 +95,19 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL) ...@@ -95,19 +95,19 @@ 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 = (NR_gNB_ULSCH_t *)malloc16_clear(sizeof(NR_gNB_ULSCH_t)); NR_gNB_ULSCH_t *ulsch = malloc16_clear(sizeof(*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;
ulsch->harq_process = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t)); ulsch->harq_process = malloc16_clear(sizeof(ulsch->harq_process));
ulsch->harq_process->b = (uint8_t*)malloc16_clear(ulsch_bytes); ulsch->harq_process->b = malloc16_clear(ulsch_bytes);
ulsch->harq_process->c = (uint8_t**)malloc16_clear(a_segments*sizeof(uint8_t *)); ulsch->harq_process->c = malloc16_clear(a_segments*sizeof(uint8_t *));
ulsch->harq_process->d = (int16_t**)malloc16_clear(a_segments*sizeof(int16_t *)); ulsch->harq_process->d = malloc16_clear(a_segments*sizeof(int16_t *));
for (int r = 0; r < a_segments; r++) { for (int r = 0; r < a_segments; r++) {
ulsch->harq_process->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t)); ulsch->harq_process->c[r] = malloc16_clear(8448*sizeof(uint8_t));
ulsch->harq_process->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t)); ulsch->harq_process->d[r] = malloc16_clear((68*384)*sizeof(int16_t));
} }
return(ulsch); return(ulsch);
} }
......
...@@ -57,10 +57,9 @@ ...@@ -57,10 +57,9 @@
NR_gNB_PUCCH_t *new_gNB_pucch(void) NR_gNB_PUCCH_t *new_gNB_pucch(void)
{ {
NR_gNB_PUCCH_t *pucch; NR_gNB_PUCCH_t *pucch = malloc16(sizeof(*pucch));
pucch = (NR_gNB_PUCCH_t *)malloc16(sizeof(NR_gNB_PUCCH_t)); memset(pucch, 0, sizeof(*pucch));
pucch->active = 0; return pucch;
return (pucch);
} }
void free_gNB_pucch(NR_gNB_PUCCH_t *pucch) void free_gNB_pucch(NR_gNB_PUCCH_t *pucch)
......
...@@ -224,6 +224,32 @@ typedef struct { ...@@ -224,6 +224,32 @@ typedef struct {
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
} NR_UL_gNB_HARQ_t; } NR_UL_gNB_HARQ_t;
typedef struct {
//! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NB_ANTENNAS_TX][NB_ANTENNAS_RX];
//! estimated received spatial signal power (dB)
unsigned int rx_spatial_power_dB[NB_ANTENNAS_TX][NB_ANTENNAS_RX];
//! estimated rssi (dBm)
int rx_rssi_dBm;
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
int rx_correlation[2];
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
int rx_correlation_dB[2];
/// Wideband CQI (= SINR)
int wideband_cqi[MAX_NUM_RU_PER_gNB];
/// Wideband CQI in dB (= SINR dB)
int wideband_cqi_dB[MAX_NUM_RU_PER_gNB];
/// Wideband CQI (sum of all RX antennas, in dB)
char wideband_cqi_tot;
/// Subband CQI per RX antenna and RB (= SINR)
int subband_cqi[MAX_NUM_RU_PER_gNB][275];
/// Total Subband CQI and RB (= SINR)
int subband_cqi_tot[275];
/// Subband CQI in dB and RB (= SINR dB)
int subband_cqi_dB[MAX_NUM_RU_PER_gNB][275];
/// Total Subband CQI and RB
int subband_cqi_tot_dB[275];
} ulsch_measurements_gNB;
typedef struct { typedef struct {
/// Time shift in number of samples estimated based on DMRS-PUSCH /// Time shift in number of samples estimated based on DMRS-PUSCH
...@@ -250,6 +276,7 @@ typedef struct { ...@@ -250,6 +276,7 @@ typedef struct {
/// Flag to indicate that the UL configuration has been handled. Used to remove a stale ULSCH when frame wraps around /// Flag to indicate that the UL configuration has been handled. Used to remove a stale ULSCH when frame wraps around
uint8_t handled; uint8_t handled;
NR_ULSCH_delay_t delay; NR_ULSCH_delay_t delay;
ulsch_measurements_gNB ulsch_measurements;
} NR_gNB_ULSCH_t; } NR_gNB_ULSCH_t;
typedef struct { typedef struct {
...@@ -503,33 +530,6 @@ typedef struct gNB_L1_proc_t_s { ...@@ -503,33 +530,6 @@ typedef struct gNB_L1_proc_t_s {
gNB_L1_rxtx_proc_t L1_proc, L1_proc_tx; gNB_L1_rxtx_proc_t L1_proc, L1_proc_tx;
} gNB_L1_proc_t; } gNB_L1_proc_t;
typedef struct {
//! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NB_ANTENNAS_TX][NB_ANTENNAS_RX];
//! estimated received spatial signal power (dB)
unsigned int rx_spatial_power_dB[NB_ANTENNAS_TX][NB_ANTENNAS_RX];
//! estimated rssi (dBm)
int rx_rssi_dBm;
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
int rx_correlation[2];
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
int rx_correlation_dB[2];
/// Wideband CQI (= SINR)
int wideband_cqi[MAX_NUM_RU_PER_gNB];
/// Wideband CQI in dB (= SINR dB)
int wideband_cqi_dB[MAX_NUM_RU_PER_gNB];
/// Wideband CQI (sum of all RX antennas, in dB)
char wideband_cqi_tot;
/// Subband CQI per RX antenna and RB (= SINR)
int subband_cqi[MAX_NUM_RU_PER_gNB][275];
/// Total Subband CQI and RB (= SINR)
int subband_cqi_tot[275];
/// Subband CQI in dB and RB (= SINR dB)
int subband_cqi_dB[MAX_NUM_RU_PER_gNB][275];
/// Total Subband CQI and RB
int subband_cqi_tot_dB[275];
} ULSCH_MEASUREMENTS_gNB;
typedef struct { typedef struct {
// common measurements // common measurements
//! estimated noise power (linear) //! estimated noise power (linear)
...@@ -553,9 +553,6 @@ typedef struct { ...@@ -553,9 +553,6 @@ typedef struct {
//! estimated avg noise power per RB (dBm) //! estimated avg noise power per RB (dBm)
int n0_subband_power_tot_dBm[275]; int n0_subband_power_tot_dBm[275];
// gNB measurements (per user)
ULSCH_MEASUREMENTS_gNB *ulsch_measurements;
/// PRACH background noise level /// PRACH background noise level
int prach_I0; int prach_I0;
......
...@@ -105,7 +105,6 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, ...@@ -105,7 +105,6 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
int frame,int slot, int frame,int slot,
nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu) nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu)
{ {
int found = 0; int found = 0;
for (int id = 0; id < NR_SYMBOLS_PER_SLOT; id++) { for (int id = 0; id < NR_SYMBOLS_PER_SLOT; id++) {
......
...@@ -555,7 +555,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -555,7 +555,7 @@ 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 = 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_harq->frame == frame_rx) && (ulsch_harq->frame == frame_rx) &&
...@@ -794,14 +794,17 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -794,14 +794,17 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
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;
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[0]=(int16_t)ulsch->rnti; int32_t sample_offset = gNB->common_vars.debugBuff_sample_offset;
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[1]=(int16_t)ulsch_harq->ulsch_pdu.rb_size; nfapi_nr_pusch_pdu_t *pdu = &ulsch_harq->ulsch_pdu;
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[2]=(int16_t)ulsch_harq->ulsch_pdu.rb_start; int16_t *buf = (int16_t*)&gNB->common_vars.debugBuff[offset];
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[3]=(int16_t)ulsch_harq->ulsch_pdu.nr_of_symbols; buf[0]=(int16_t)ulsch->rnti;
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[4]=(int16_t)ulsch_harq->ulsch_pdu.start_symbol_index; buf[1]=(int16_t)pdu->rb_size;
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[5]=(int16_t)ulsch_harq->ulsch_pdu.mcs_index; buf[2]=(int16_t)pdu->rb_start;
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[6]=(int16_t)ulsch_harq->ulsch_pdu.pusch_data.rv_index; buf[3]=(int16_t)pdu->nr_of_symbols;
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[7]=(int16_t)ulsch->harq_pid; buf[4]=(int16_t)pdu->start_symbol_index;
buf[5]=(int16_t)pdu->mcs_index;
buf[6]=(int16_t)pdu->pusch_data.rv_index;
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],&ru->common.rxdata[0][slot_offset],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); 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)) { if(gNB->common_vars.debugBuff_sample_offset>((frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+2)*20)) {
...@@ -818,23 +821,24 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -818,23 +821,24 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
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);
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot = 0; NR_gNB_PUSCH *pusch_vars = gNB->pusch_vars[ULSCH_id];
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot = 0; pusch_vars->ulsch_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++) {
gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx] /= num_dmrs; pusch_vars->ulsch_power[aarx] /= num_dmrs;
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx]; pusch_vars->ulsch_power_tot += pusch_vars->ulsch_power[aarx];
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx] /= num_dmrs; pusch_vars->ulsch_noise_power[aarx] /= num_dmrs;
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx]; pusch_vars->ulsch_noise_power_tot += pusch_vars->ulsch_noise_power[aarx];
} }
if (dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) < if (dB_fixed_x10(pusch_vars->ulsch_power_tot) <
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->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(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot), dB_fixed_x10(pusch_vars->ulsch_power_tot),
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres); dB_fixed_x10(pusch_vars->ulsch_noise_power_tot),gNB->pusch_thres);
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot = gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot; pusch_vars->ulsch_power_tot = pusch_vars->ulsch_noise_power_tot;
gNB->pusch_vars[ULSCH_id]->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.
...@@ -845,10 +849,10 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -845,10 +849,10 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
} }
} 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(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot), dB_fixed_x10(pusch_vars->ulsch_power_tot),
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres); dB_fixed_x10(pusch_vars->ulsch_noise_power_tot),gNB->pusch_thres);
gNB->pusch_vars[ULSCH_id]->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);
......
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