NR UE: fix and improve PHY layer debugging
This commit is contained in:
@@ -28,13 +28,6 @@
|
|||||||
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
|
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
|
||||||
#include <common/utils/LOG/log.h>
|
#include <common/utils/LOG/log.h>
|
||||||
|
|
||||||
//#define DEBUG_FEP
|
|
||||||
|
|
||||||
/*#ifdef LOG_I
|
|
||||||
#undef LOG_I
|
|
||||||
#define LOG_I(A,B...) printf(A)
|
|
||||||
#endif*/
|
|
||||||
|
|
||||||
int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
||||||
const NR_DL_FRAME_PARMS *frame_parms,
|
const NR_DL_FRAME_PARMS *frame_parms,
|
||||||
unsigned int slot,
|
unsigned int slot,
|
||||||
@@ -44,7 +37,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
|||||||
uint32_t sample_offset,
|
uint32_t sample_offset,
|
||||||
c16_t **rxdata)
|
c16_t **rxdata)
|
||||||
{
|
{
|
||||||
|
|
||||||
AssertFatal(symbol < frame_parms->symbols_per_slot, "slot_fep: symbol must be between 0 and %d\n", frame_parms->symbols_per_slot-1);
|
AssertFatal(symbol < frame_parms->symbols_per_slot, "slot_fep: symbol must be between 0 and %d\n", frame_parms->symbols_per_slot-1);
|
||||||
AssertFatal(slot < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame - 1);
|
AssertFatal(slot < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame - 1);
|
||||||
|
|
||||||
@@ -81,12 +73,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
|||||||
// use OFDM symbol from within 1/8th of the CP to avoid ISI
|
// use OFDM symbol from within 1/8th of the CP to avoid ISI
|
||||||
rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
|
rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
|
||||||
|
|
||||||
#ifdef DEBUG_FEP
|
|
||||||
// if (ue->frame <100)
|
|
||||||
LOG_D(PHY,"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d\n",
|
|
||||||
Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy((int32_t *)&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size)));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||||
int16_t *rxdata_ptr = (int16_t *)&rxdata[aa][rx_offset];
|
int16_t *rxdata_ptr = (int16_t *)&rxdata[aa][rx_offset];
|
||||||
|
|
||||||
@@ -129,10 +115,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
|||||||
apply_nr_rotation_RX(frame_parms, rxdataF[aa], frame_parms->symbol_rotation[linktype], slot, N_RB, 0, symbol, 1);
|
apply_nr_rotation_RX(frame_parms, rxdataF[aa], frame_parms->symbol_rotation[linktype], slot, N_RB, 0, symbol, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_FEP
|
|
||||||
printf("slot_fep: done\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1081,7 +1081,6 @@ void NFAPI_NR_DMRS_TYPE1_linear_interp(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
c16_t *dl_ch,
|
c16_t *dl_ch,
|
||||||
unsigned short bwp_start_subcarrier,
|
unsigned short bwp_start_subcarrier,
|
||||||
unsigned short nb_rb_pdsch,
|
unsigned short nb_rb_pdsch,
|
||||||
int8_t delta,
|
|
||||||
delay_t *delay,
|
delay_t *delay,
|
||||||
uint32_t *nvar)
|
uint32_t *nvar)
|
||||||
{
|
{
|
||||||
@@ -1094,30 +1093,23 @@ void NFAPI_NR_DMRS_TYPE1_linear_interp(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
int nest_count = 0;
|
int nest_count = 0;
|
||||||
uint64_t noise_amp2 = 0;
|
uint64_t noise_amp2 = 0;
|
||||||
|
|
||||||
for (int pilot_cnt = 0; pilot_cnt < 6 * nb_rb_pdsch; pilot_cnt++) {
|
for (int pilot_cnt = 0; pilot_cnt < 6 * nb_rb_pdsch; pilot_cnt += 2) {
|
||||||
if (pilot_cnt % 2 == 0) {
|
c16_t ch_l = c16mulShift(*pil, rxF[re_offset], 15);
|
||||||
c16_t ch = c16mulShift(*pil, rxF[re_offset], 15);
|
|
||||||
pil++;
|
|
||||||
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
|
|
||||||
ch = c16maddShift(*pil, rxF[re_offset], ch, 15);
|
|
||||||
ch = c16Shift(ch, 1);
|
|
||||||
pil++;
|
|
||||||
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
|
|
||||||
for (int k = pilot_cnt << 1; k < (pilot_cnt << 1) + 4; k++) {
|
|
||||||
dl_ls_est[k] = ch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_PDSCH
|
#ifdef DEBUG_PDSCH
|
||||||
printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n",
|
printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_l.r, ch_l.i);
|
||||||
pilot_cnt,
|
|
||||||
pil->r,
|
|
||||||
pil->i,
|
|
||||||
rxF[re_offset].r,
|
|
||||||
rxF[re_offset].i,
|
|
||||||
dl_ls_est[pilot_cnt << 1].r,
|
|
||||||
dl_ls_est[pilot_cnt << 1].i);
|
|
||||||
#endif
|
#endif
|
||||||
|
pil++;
|
||||||
|
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
|
||||||
|
c16_t ch_r = c16mulShift(*pil, rxF[re_offset], 15);
|
||||||
|
#ifdef DEBUG_PDSCH
|
||||||
|
printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt + 1, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_r.r, ch_r.i);
|
||||||
|
#endif
|
||||||
|
c16_t ch = c16addShift(ch_l, ch_r, 1);
|
||||||
|
pil++;
|
||||||
|
re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size;
|
||||||
|
for (int k = pilot_cnt << 1; k < (pilot_cnt << 1) + 4; k++) {
|
||||||
|
dl_ls_est[k] = ch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c16_t ch_estimates_time[frame_parms->ofdm_symbol_size] __attribute__((aligned(32)));
|
c16_t ch_estimates_time[frame_parms->ofdm_symbol_size] __attribute__((aligned(32)));
|
||||||
@@ -1247,8 +1239,6 @@ void NFAPI_NR_DMRS_TYPE2_linear_interp(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
c16_t *dl_ch,
|
c16_t *dl_ch,
|
||||||
unsigned short bwp_start_subcarrier,
|
unsigned short bwp_start_subcarrier,
|
||||||
unsigned short nb_rb_pdsch,
|
unsigned short nb_rb_pdsch,
|
||||||
int8_t delta,
|
|
||||||
unsigned short p,
|
|
||||||
delay_t *delay,
|
delay_t *delay,
|
||||||
uint32_t *nvar)
|
uint32_t *nvar)
|
||||||
{
|
{
|
||||||
@@ -1270,7 +1260,7 @@ void NFAPI_NR_DMRS_TYPE2_linear_interp(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
re_offset = (re_offset + 1) % frame_parms->ofdm_symbol_size;
|
re_offset = (re_offset + 1) % frame_parms->ofdm_symbol_size;
|
||||||
c16_t ch_r = c16mulShift(*pil, rxF[re_offset], 15);
|
c16_t ch_r = c16mulShift(*pil, rxF[re_offset], 15);
|
||||||
#ifdef DEBUG_PDSCH
|
#ifdef DEBUG_PDSCH
|
||||||
printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_r.r, ch_r.i);
|
printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt + 1, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_r.r, ch_r.i);
|
||||||
#endif
|
#endif
|
||||||
c16_t ch = c16addShift(ch_l, ch_r, 1);
|
c16_t ch = c16addShift(ch_l, ch_r, 1);
|
||||||
for (int k = 3 * pilot_cnt; k < (3 * pilot_cnt) + 6; k++) {
|
for (int k = 3 * pilot_cnt; k < (3 * pilot_cnt) + 6; k++) {
|
||||||
@@ -1427,9 +1417,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
#ifdef DEBUG_PDSCH
|
#ifdef DEBUG_PDSCH
|
||||||
printf(
|
printf(
|
||||||
"PDSCH Channel Estimation : gNB_id %d ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, Ns=%d, bwp_start_subcarrier=%d "
|
"PDSCH Channel Estimation : ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, Ns=%d, bwp_start_subcarrier=%d "
|
||||||
"symbol %d\n",
|
"symbol %d\n",
|
||||||
gNB_id,
|
|
||||||
ch_offset,
|
ch_offset,
|
||||||
symbol_offset,
|
symbol_offset,
|
||||||
fp->ofdm_symbol_size,
|
fp->ofdm_symbol_size,
|
||||||
@@ -1467,7 +1456,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
dl_ch,
|
dl_ch,
|
||||||
bwp_start_subcarrier,
|
bwp_start_subcarrier,
|
||||||
nb_rb_pdsch,
|
nb_rb_pdsch,
|
||||||
delta,
|
|
||||||
&delay,
|
&delay,
|
||||||
nvar);
|
nvar);
|
||||||
|
|
||||||
@@ -1478,8 +1466,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
dl_ch,
|
dl_ch,
|
||||||
bwp_start_subcarrier,
|
bwp_start_subcarrier,
|
||||||
nb_rb_pdsch,
|
nb_rb_pdsch,
|
||||||
delta,
|
|
||||||
p,
|
|
||||||
&delay,
|
&delay,
|
||||||
nvar);
|
nvar);
|
||||||
|
|
||||||
|
|||||||
@@ -576,6 +576,25 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
*log2_maxh,
|
*log2_maxh,
|
||||||
ue->phy_cpu_stats.cpu_time_stats[DLSCH_CHANNEL_COMPENSATION_STATS].p_time / (cpuf * 1000.0));
|
ue->phy_cpu_stats.cpu_time_stats[DLSCH_CHANNEL_COMPENSATION_STATS].p_time / (cpuf * 1000.0));
|
||||||
}
|
}
|
||||||
|
// Please keep it: useful for debugging
|
||||||
|
#ifdef DEBUG_PDSCH_RX
|
||||||
|
char filename[50];
|
||||||
|
|
||||||
|
snprintf(filename, 50, "rxdataF0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx);
|
||||||
|
write_output(filename, "rxdataF0", &rxdataF[0][symbol * frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1);
|
||||||
|
|
||||||
|
snprintf(filename, 50, "dl_ch_estimates0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx);
|
||||||
|
write_output(filename, "dl_ch_estimates0", &dl_ch_estimates[0][symbol * frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1);
|
||||||
|
|
||||||
|
snprintf(filename, 50, "rxdataF_ext0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx);
|
||||||
|
write_output(filename, "rxdataF_ext0", &rxdataF_ext[0][0], rx_size_symbol, 1, 1);
|
||||||
|
|
||||||
|
snprintf(filename, 50, "dl_ch_estimates_ext0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx);
|
||||||
|
write_output(filename, "dl_ch_estimates_ext0", &dl_ch_estimates_ext[0][0], rx_size_symbol, 1, 1);
|
||||||
|
|
||||||
|
snprintf(filename, 50, "rxdataF_comp00_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx);
|
||||||
|
write_output(filename, "rxdataF_comp00", &rxdataF_comp[0][0][symbol * rx_size_symbol], rx_size_symbol, 1, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
start_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS);
|
start_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS);
|
||||||
@@ -694,32 +713,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
rx_llr_layer_size,
|
rx_llr_layer_size,
|
||||||
layer_llr);
|
layer_llr);
|
||||||
stop_meas_nr_ue_phy(ue, DLSCH_LAYER_DEMAPPING);
|
stop_meas_nr_ue_phy(ue, DLSCH_LAYER_DEMAPPING);
|
||||||
// Please keep it: useful for debugging
|
|
||||||
#ifdef DEBUG_PDSCH_RX
|
|
||||||
char filename[50];
|
|
||||||
uint8_t aa = 0;
|
|
||||||
|
|
||||||
snprintf(filename, 50, "rxdataF0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx);
|
|
||||||
write_output(filename, "rxdataF0", &rxdataF[0][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1);
|
|
||||||
|
|
||||||
snprintf(filename, 50, "dl_ch_estimates0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx);
|
|
||||||
write_output(filename, "dl_ch_estimates", &dl_ch_estimates[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1);
|
|
||||||
|
|
||||||
snprintf(filename, 50, "rxdataF_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx);
|
|
||||||
write_output(filename, "rxdataF_ext", &rxdataF_ext[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1);
|
|
||||||
|
|
||||||
snprintf(filename, 50, "dl_ch_estimates_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx);
|
|
||||||
write_output(filename, "dl_ch_estimates_ext00", &dl_ch_estimates_ext[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1);
|
|
||||||
|
|
||||||
snprintf(filename, 50, "rxdataF_comp0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx);
|
|
||||||
write_output(filename, "rxdataF_comp00", &rxdataF_comp[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1);
|
|
||||||
/*
|
/*
|
||||||
for (int i=0; i < 2; i++){
|
for (int i=0; i < 2; i++){
|
||||||
snprintf(filename, 50, "llr%d_symb_%d_nr_slot_rx_%d.m", i, symbol, nr_slot_rx);
|
snprintf(filename, 50, "llr%d_symb_%d_nr_slot_rx_%d.m", i, symbol, nr_slot_rx);
|
||||||
write_output(filename,"llr", &llr[i][0], (NR_SYMBOLS_PER_SLOT*nb_rb_pdsch*NR_NB_SC_PER_RB*dlsch1_harq->Qm) - 4*(nb_rb_pdsch*4*dlsch1_harq->Qm), 1, 0);
|
write_output(filename,"llr", &llr[i][0], (NR_SYMBOLS_PER_SLOT*nb_rb_pdsch*NR_NB_SC_PER_RB*dlsch1_harq->Qm) - 4*(nb_rb_pdsch*4*dlsch1_harq->Qm), 1, 0);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
#endif
|
|
||||||
if (UEScopeHasTryLock(ue)) {
|
if (UEScopeHasTryLock(ue)) {
|
||||||
metadata mt = {.frame = proc->frame_rx, .slot = proc->nr_slot_rx };
|
metadata mt = {.frame = proc->frame_rx, .slot = proc->nr_slot_rx };
|
||||||
int total_valid_res = 0;
|
int total_valid_res = 0;
|
||||||
|
|||||||
@@ -485,6 +485,7 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||||
int G)
|
int G)
|
||||||
{
|
{
|
||||||
|
int frame_rx = proc->frame_rx;
|
||||||
int nr_slot_rx = proc->nr_slot_rx;
|
int nr_slot_rx = proc->nr_slot_rx;
|
||||||
|
|
||||||
// We handle only one CW now
|
// We handle only one CW now
|
||||||
@@ -496,9 +497,10 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
NR_DL_UE_HARQ_t *dlsch0_harq = &ue->dl_harq_processes[0][harq_pid];
|
NR_DL_UE_HARQ_t *dlsch0_harq = &ue->dl_harq_processes[0][harq_pid];
|
||||||
|
|
||||||
LOG_D(PHY,
|
LOG_D(PHY,
|
||||||
"[UE %d] nr_slot_rx %d, harq_pid %d (%d), BWP start %d, rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask "
|
"[UE %d] frame_rx %d, nr_slot_rx %d, harq_pid %d (%d), BWP start %d, rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask "
|
||||||
"%x, Nl %d\n",
|
"%x, Nl %d\n",
|
||||||
ue->Mod_id,
|
ue->Mod_id,
|
||||||
|
frame_rx,
|
||||||
nr_slot_rx,
|
nr_slot_rx,
|
||||||
harq_pid,
|
harq_pid,
|
||||||
dlsch0_harq->status,
|
dlsch0_harq->status,
|
||||||
@@ -558,10 +560,9 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
nvar += nvar_tmp;
|
nvar += nvar_tmp;
|
||||||
#if 0
|
#if 0
|
||||||
///LOG_M: the channel estimation
|
///LOG_M: the channel estimation
|
||||||
int nr_frame_rx = proc->frame_rx;
|
|
||||||
char filename[100];
|
char filename[100];
|
||||||
for (uint8_t aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
for (uint8_t aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||||
sprintf(filename,"PDSCH_CHANNEL_frame%d_slot%d_sym%d_port%d_rx%d.m", nr_frame_rx, nr_slot_rx, m, nl, aarx);
|
sprintf(filename,"PDSCH_CHANNEL_frame%d_slot%d_sym%d_port%d_rx%d.m", frame_rx, nr_slot_rx, m, nl, aarx);
|
||||||
int **dl_ch_estimates = ue->pdsch_vars[gNB_id]->dl_ch_estimates;
|
int **dl_ch_estimates = ue->pdsch_vars[gNB_id]->dl_ch_estimates;
|
||||||
LOG_M(filename,"channel_F",&dl_ch_estimates[nl*ue->frame_parms.nb_antennas_rx+aarx][ue->frame_parms.ofdm_symbol_size*m],ue->frame_parms.ofdm_symbol_size, 1, 1);
|
LOG_M(filename,"channel_F",&dl_ch_estimates[nl*ue->frame_parms.nb_antennas_rx+aarx][ue->frame_parms.ofdm_symbol_size*m],ue->frame_parms.ofdm_symbol_size, 1, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user