Commit b378acf2 authored by Rakesh Mundlamuri's avatar Rakesh Mundlamuri

Introduce SRS oversampling for better accuracy in estimating nanoseconds

parent 7846d83b
...@@ -37,12 +37,12 @@ ...@@ -37,12 +37,12 @@
#define I0_SKIP_DC 1 #define I0_SKIP_DC 1
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 c16_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]) const c16_t srs_estimated_channel_time[][NR_SRS_IDFT_OVERSAMP_FACTOR * frame_parms->ofdm_symbol_size])
{ {
int timing_advance = 0; int timing_advance = 0;
int max_val = 0; int max_val = 0;
for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) { for (int i = 0; i < NR_SRS_IDFT_OVERSAMP_FACTOR * frame_parms->ofdm_symbol_size; i++) {
int temp = 0; int temp = 0;
for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
int Re = ((c16_t*)srs_estimated_channel_time[aa])[i].r; int Re = ((c16_t*)srs_estimated_channel_time[aa])[i].r;
...@@ -55,9 +55,10 @@ int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms, ...@@ -55,9 +55,10 @@ int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms,
} }
} }
if (timing_advance > frame_parms->ofdm_symbol_size/2) { if (timing_advance > (NR_SRS_IDFT_OVERSAMP_FACTOR * frame_parms->ofdm_symbol_size) / 2) {
timing_advance = timing_advance - frame_parms->ofdm_symbol_size; timing_advance = timing_advance - (NR_SRS_IDFT_OVERSAMP_FACTOR * frame_parms->ofdm_symbol_size);
} }
timing_advance = timing_advance / NR_SRS_IDFT_OVERSAMP_FACTOR;
LOG_I(NR_PHY, "Estimated SRS ToA %d\n", timing_advance); LOG_I(NR_PHY, "Estimated SRS ToA %d\n", timing_advance);
......
...@@ -780,8 +780,8 @@ int nr_srs_channel_estimation(int ant, ...@@ -780,8 +780,8 @@ int nr_srs_channel_estimation(int ant,
c16_t srs_received_signal[ofdm_symbol_size * N_symb_SRS], c16_t srs_received_signal[ofdm_symbol_size * N_symb_SRS],
c16_t srs_received_noise[ofdm_symbol_size * N_symb_SRS], c16_t srs_received_noise[ofdm_symbol_size * N_symb_SRS],
c16_t srs_estimated_channel_freq[ofdm_symbol_size * N_symb_SRS], c16_t srs_estimated_channel_freq[ofdm_symbol_size * N_symb_SRS],
c16_t srs_estimated_channel_time[ofdm_symbol_size], c16_t srs_estimated_channel_time[NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size],
c16_t srs_estimated_channel_time_shifted[ofdm_symbol_size], c16_t srs_estimated_channel_time_shifted[NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size],
uint32_t *signal_power, uint32_t *signal_power,
uint32_t *noise_power, uint32_t *noise_power,
int16_t *noise_power_per_rb) int16_t *noise_power_per_rb)
...@@ -959,15 +959,27 @@ int nr_srs_channel_estimation(int ant, ...@@ -959,15 +959,27 @@ int nr_srs_channel_estimation(int ant,
#endif #endif
// Convert to time domain // Convert to time domain
freq2time(ofdm_symbol_size, (int16_t *)srs_estimated_channel_freq, (int16_t *)srs_estimated_channel_time); int16_t ofdm_symbol_size_half = ofdm_symbol_size >> 1;
int16_t ofdm_os_size = NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size;
int16_t ofdm_os_size_half = ofdm_os_size >> 1;
int16_t start_offset = ofdm_os_size - ofdm_symbol_size_half;
memcpy(srs_estimated_channel_time_shifted, c16_t chF_interpol[ofdm_os_size] __attribute__((aligned(32)));
&srs_estimated_channel_time[ofdm_symbol_size >> 1], memset(chF_interpol, 0, sizeof(chF_interpol));
(ofdm_symbol_size >> 1) * sizeof(c16_t));
memcpy(&srs_estimated_channel_time_shifted[ofdm_symbol_size >> 1], // Place SRS channel estimates in FFT shifted format for oversampling
srs_estimated_channel_time, memcpy(&chF_interpol[0], &srs_estimated_channel_freq[0], ofdm_symbol_size_half * sizeof(c16_t));
(ofdm_symbol_size >> 1) * sizeof(c16_t)); memcpy(&chF_interpol[start_offset],
&srs_estimated_channel_freq[ofdm_symbol_size_half],
ofdm_symbol_size_half * sizeof(c16_t));
// Convert to time domain oversampled
freq2time(ofdm_os_size, (int16_t *)chF_interpol, (int16_t *)srs_estimated_channel_time);
// Do FFT shift
memcpy(srs_estimated_channel_time_shifted, &srs_estimated_channel_time[ofdm_os_size_half], ofdm_os_size_half * sizeof(c16_t));
memcpy(&srs_estimated_channel_time_shifted[ofdm_os_size_half], srs_estimated_channel_time, ofdm_os_size_half * sizeof(c16_t));
// Compute wideband SNR // Compute wideband SNR
int tot_subcarriers = m_SRS_b * NR_NB_SC_PER_RB; int tot_subcarriers = m_SRS_b * NR_NB_SC_PER_RB;
......
...@@ -59,8 +59,9 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB); ...@@ -59,8 +59,9 @@ 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, uint32_t rb_mask_ul[14][9]); void gNB_I0_measurements(PHY_VARS_gNB *gNB, int slot, int first_symb, int num_symb, uint32_t rb_mask_ul[14][9]);
int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms, int nr_est_timing_advance_srs(
const c16_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]); const NR_DL_FRAME_PARMS *frame_parms,
const c16_t srs_estimated_channel_time[][NR_SRS_IDFT_OVERSAMP_FACTOR * frame_parms->ofdm_symbol_size]);
void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
...@@ -81,8 +82,8 @@ int nr_srs_channel_estimation(int ant, ...@@ -81,8 +82,8 @@ int nr_srs_channel_estimation(int ant,
c16_t srs_received_signal[ofdm_symbol_size * N_symb_SRS], c16_t srs_received_signal[ofdm_symbol_size * N_symb_SRS],
c16_t srs_received_noise[ofdm_symbol_size * N_symb_SRS], c16_t srs_received_noise[ofdm_symbol_size * N_symb_SRS],
c16_t srs_estimated_channel_freq[ofdm_symbol_size * N_symb_SRS], c16_t srs_estimated_channel_freq[ofdm_symbol_size * N_symb_SRS],
c16_t srs_estimated_channel_time[ofdm_symbol_size], c16_t srs_estimated_channel_time[NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size],
c16_t srs_estimated_channel_time_shifted[ofdm_symbol_size], c16_t srs_estimated_channel_time_shifted[NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size],
uint32_t *signal_power, uint32_t *signal_power,
uint32_t *noise_power, uint32_t *noise_power,
int16_t *noise_power_per_rb); int16_t *noise_power_per_rb);
......
...@@ -242,7 +242,7 @@ void nr_srs_rx_procedures(PHY_VARS_gNB *gNB, ...@@ -242,7 +242,7 @@ void nr_srs_rx_procedures(PHY_VARS_gNB *gNB,
nr_srs_info_t *nr_srs_info, nr_srs_info_t *nr_srs_info,
int *srs_est, int *srs_est,
c16_t srs_estimated_channel_freq[][N_ap][ofdm_symbol_size * N_symb_SRS], c16_t srs_estimated_channel_freq[][N_ap][ofdm_symbol_size * N_symb_SRS],
c16_t srs_estimated_channel_time[][N_ap][ofdm_symbol_size], c16_t srs_estimated_channel_time[][N_ap][NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size],
int16_t *snr_per_rb); int16_t *snr_per_rb);
int get_nr_prach_duration(uint8_t prach_format); int get_nr_prach_duration(uint8_t prach_format);
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#define MAX_NUM_RU_PER_gNB 8 #define MAX_NUM_RU_PER_gNB 8
#define MAX_PUCCH0_NID 8 #define MAX_PUCCH0_NID 8
#define NR_SRS_IDFT_OVERSAMP_FACTOR 2
typedef struct { typedef struct {
int nb_id; int nb_id;
......
...@@ -868,14 +868,14 @@ void nr_srs_rx_procedures(PHY_VARS_gNB *gNB, ...@@ -868,14 +868,14 @@ void nr_srs_rx_procedures(PHY_VARS_gNB *gNB,
nr_srs_info_t *nr_srs_info, nr_srs_info_t *nr_srs_info,
int *srs_est, int *srs_est,
c16_t srs_estimated_channel_freq[][N_ap][ofdm_symbol_size * N_symb_SRS], c16_t srs_estimated_channel_freq[][N_ap][ofdm_symbol_size * N_symb_SRS],
c16_t srs_estimated_channel_time[][N_ap][ofdm_symbol_size], c16_t srs_estimated_channel_time[][N_ap][NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size],
int16_t *snr_per_rb) int16_t *snr_per_rb)
{ {
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu; nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu;
c16_t srs_received_signal[nb_antennas_rx][ofdm_symbol_size * N_symb_SRS]; c16_t srs_received_signal[nb_antennas_rx][ofdm_symbol_size * N_symb_SRS];
c16_t srs_received_noise[nb_antennas_rx][ofdm_symbol_size * N_symb_SRS]; c16_t srs_received_noise[nb_antennas_rx][ofdm_symbol_size * N_symb_SRS];
c16_t srs_estimated_channel_time_shifted[nb_antennas_rx][N_ap][ofdm_symbol_size]; c16_t srs_estimated_channel_time_shifted[nb_antennas_rx][N_ap][NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size];
start_meas(&gNB->generate_srs_stats); start_meas(&gNB->generate_srs_stats);
...@@ -946,7 +946,7 @@ void nr_srs_rx_procedures(PHY_VARS_gNB *gNB, ...@@ -946,7 +946,7 @@ void nr_srs_rx_procedures(PHY_VARS_gNB *gNB,
T_INT(frame_rx), T_INT(frame_rx),
T_INT(0), T_INT(0),
T_INT(0), T_INT(0),
T_BUFFER(srs_estimated_channel_time_shifted[0][0], ofdm_symbol_size * sizeof(int32_t))); T_BUFFER(srs_estimated_channel_time_shifted[0][0], NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size * sizeof(int32_t)));
T(T_GNB_PHY_UL_SNR_ESTIMATE, T(T_GNB_PHY_UL_SNR_ESTIMATE,
T_INT(0), T_INT(0),
...@@ -1171,7 +1171,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, N ...@@ -1171,7 +1171,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, N
int srs_est; int srs_est;
c16_t srs_estimated_channel_freq[nb_antennas_rx][N_ap][ofdm_symbol_size * N_symb_SRS] __attribute__((aligned(32))); c16_t srs_estimated_channel_freq[nb_antennas_rx][N_ap][ofdm_symbol_size * N_symb_SRS] __attribute__((aligned(32)));
c16_t srs_estimated_channel_time[nb_antennas_rx][N_ap][ofdm_symbol_size] __attribute__((aligned(32))); c16_t srs_estimated_channel_time[nb_antennas_rx][N_ap][NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size]
__attribute__((aligned(32)));
nr_srs_rx_procedures(gNB, nr_srs_rx_procedures(gNB,
frame_rx, frame_rx,
......
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