Commit 09cca538 authored by Francesco Mani's avatar Francesco Mani

using only one structure for rxdata

parent f5d6aa4c
...@@ -442,7 +442,7 @@ void readFrames(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { ...@@ -442,7 +442,7 @@ void readFrames(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
for(int x=0; x<20; x++) { // two frames for initial sync for(int x=0; x<20; x++) { // two frames for initial sync
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = ((void *)&UE->common_vars.rxdata_is[i][0]) + 4*x*UE->frame_parms.samples_per_subframe; rxp[i] = ((void *)&UE->common_vars.rxdata[i][0]) + 4*x*UE->frame_parms.samples_per_subframe;
AssertFatal( UE->frame_parms.samples_per_subframe == AssertFatal( UE->frame_parms.samples_per_subframe ==
UE->rfdevice.trx_read_func(&UE->rfdevice, UE->rfdevice.trx_read_func(&UE->rfdevice,
......
...@@ -710,15 +710,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -710,15 +710,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
} }
// init RX buffers // init RX buffers
common_vars->rxdata_is= (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
common_vars->rxdata = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); common_vars->rxdata = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
common_vars->common_vars_rx_data_per_thread[th_id].rxdataF = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); common_vars->common_vars_rx_data_per_thread[th_id].rxdataF = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
} }
for (i=0; i<fp->nb_antennas_rx; i++) { for (i=0; i<fp->nb_antennas_rx; i++) {
common_vars->rxdata_is[i] = (int32_t*) malloc16_clear( (fp->samples_per_frame*2+2048)*sizeof(int32_t) ); common_vars->rxdata[i] = (int32_t*) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) );
common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_frame+2048)*sizeof(int32_t) );
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) ); common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
} }
......
...@@ -46,14 +46,11 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -46,14 +46,11 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
unsigned char aa; unsigned char aa;
unsigned int nb_prefix_samples; unsigned int nb_prefix_samples;
unsigned int nb_prefix_samples0; unsigned int nb_prefix_samples0;
int **rxdata = NULL;
if (ue->is_synchronized) { if (ue->is_synchronized) {
rxdata = common_vars->rxdata;
nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0); nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
} }
else { else {
rxdata = common_vars->rxdata_is;
nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples); nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
} }
...@@ -149,13 +146,13 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -149,13 +146,13 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
if (symbol==0) { if (symbol==0) {
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
memcpy((short*) &(rxdata[aa][frame_length_samples]), memcpy((short*) &common_vars->rxdata[aa][frame_length_samples],
(short*) &(rxdata[aa][0]), (short*) &common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int)); frame_parms->ofdm_symbol_size*sizeof(int));
if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs
memcpy((void *)tmp_dft_in, memcpy((void *)tmp_dft_in,
(void *) &(rxdata[aa][rx_offset % frame_length_samples]), (void *) &common_vars->rxdata[aa][rx_offset % frame_length_samples],
frame_parms->ofdm_symbol_size*sizeof(int)); frame_parms->ofdm_symbol_size*sizeof(int));
dft((int16_t *)tmp_dft_in, dft((int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); (int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
...@@ -164,7 +161,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -164,7 +161,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
start_meas(&ue->rx_dft_stats); start_meas(&ue->rx_dft_stats);
#endif #endif
dft((int16_t *) &(rxdata[aa][(rx_offset) % frame_length_samples]), dft((int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); (int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats); stop_meas(&ue->rx_dft_stats);
...@@ -174,8 +171,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -174,8 +171,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*symbol; rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*symbol;
// + (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1); // + (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
memcpy((void *) &(rxdata[aa][frame_length_samples]), memcpy((void *) &common_vars->rxdata[aa][frame_length_samples],
(void *) &(rxdata[aa][0]), (void *) &common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int)); frame_parms->ofdm_symbol_size*sizeof(int));
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats); start_meas(&ue->rx_dft_stats);
...@@ -183,13 +180,13 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -183,13 +180,13 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
memcpy((void *)tmp_dft_in, memcpy((void *)tmp_dft_in,
(void *) &(rxdata[aa][(rx_offset) % frame_length_samples]), (void *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
frame_parms->ofdm_symbol_size*sizeof(int)); frame_parms->ofdm_symbol_size*sizeof(int));
dft((int16_t *)tmp_dft_in, dft((int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); (int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} else { // use dft input from RX buffer directly } else { // use dft input from RX buffer directly
dft((int16_t *) &(rxdata[aa][(rx_offset) % frame_length_samples]), dft((int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); (int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} }
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
......
...@@ -269,10 +269,10 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode, ...@@ -269,10 +269,10 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
for(int n=start; n<end; n++){ for(int n=start; n<end; n++){
for (int ar=0; ar<fp->nb_antennas_rx; ar++) { for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
re = ((double)(((short *)ue->common_vars.rxdata_is[ar]))[2*n]); re = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n]);
im = ((double)(((short *)ue->common_vars.rxdata_is[ar]))[2*n+1]); im = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n+1]);
((short *)ue->common_vars.rxdata_is[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle))); ((short *)ue->common_vars.rxdata[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle)));
((short *)ue->common_vars.rxdata_is[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle))); ((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle)));
} }
} }
} }
...@@ -286,7 +286,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode, ...@@ -286,7 +286,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
/* symbol number are from beginning of SS/PBCH blocks as below: */ /* symbol number are from beginning of SS/PBCH blocks as below: */
/* Signal PSS PBCH SSS PBCH */ /* Signal PSS PBCH SSS PBCH */
/* symbol number 0 1 2 3 */ /* symbol number 0 1 2 3 */
/* time samples in buffer rxdata_is are used as input of FFT -> FFT results are stored in the frequency buffer rxdataF */ /* time samples in buffer rxdata are used as input of FFT -> FFT results are stored in the frequency buffer rxdataF */
/* rxdataF stores SS/PBCH from beginning of buffers in the same symbol order as in time domain */ /* rxdataF stores SS/PBCH from beginning of buffers in the same symbol order as in time domain */
for(int i=0; i<4;i++) for(int i=0; i<4;i++)
...@@ -436,13 +436,13 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode, ...@@ -436,13 +436,13 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
// do a measurement on the best guess of the PSS // do a measurement on the best guess of the PSS
//for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) //for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
// rx_power += signal_energy(&ue->common_vars.rxdata_is[aarx][sync_pos2], // rx_power += signal_energy(&ue->common_vars.rxdata[aarx][sync_pos2],
// frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); // frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
/* /*
// do a measurement on the full frame // do a measurement on the full frame
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
rx_power += signal_energy(&ue->common_vars.rxdata_is[aarx][0], rx_power += signal_energy(&ue->common_vars.rxdata[aarx][0],
frame_parms->samples_per_subframe*10); frame_parms->samples_per_subframe*10);
*/ */
......
...@@ -626,11 +626,11 @@ void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int **r ...@@ -626,11 +626,11 @@ void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int **r
/* build with cic filter does not work properly. Performances are significantly deteriorated */ /* build with cic filter does not work properly. Performances are significantly deteriorated */
#ifdef CIC_DECIMATOR #ifdef CIC_DECIMATOR
cic_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata_is[0][0]), (int16_t *)&(rxdata[0][0]), cic_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata[0][0]), (int16_t *)&(rxdata[0][0]),
samples_for_frame, rate_change, CIC_FILTER_STAGE_NUMBER, 0, FIR_RATE_CHANGE); samples_for_frame, rate_change, CIC_FILTER_STAGE_NUMBER, 0, FIR_RATE_CHANGE);
#else #else
fir_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata_is[0][0]), (int16_t *)&(rxdata[0][0]), fir_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata[0][0]), (int16_t *)&(rxdata[0][0]),
samples_for_frame, rate_change, 0); samples_for_frame, rate_change, 0);
#endif #endif
...@@ -667,7 +667,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change) ...@@ -667,7 +667,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change)
#ifdef DBG_PSS_NR #ifdef DBG_PSS_NR
LOG_M("rxdata0_rand.m","rxd0_rand", &PHY_vars_UE->common_vars.rxdata_is[0][0], frame_parms->samples_per_frame, 1, 1); LOG_M("rxdata0_rand.m","rxd0_rand", &PHY_vars_UE->common_vars.rxdata[0][0], frame_parms->samples_per_frame, 1, 1);
#endif #endif
...@@ -686,7 +686,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change) ...@@ -686,7 +686,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change)
} }
else { else {
rxdata = PHY_vars_UE->common_vars.rxdata_is; rxdata = PHY_vars_UE->common_vars.rxdata;
} }
#ifdef DBG_PSS_NR #ifdef DBG_PSS_NR
......
...@@ -303,14 +303,9 @@ typedef struct { ...@@ -303,14 +303,9 @@ typedef struct {
/// \brief Holds the received data in time domain. /// \brief Holds the received data in time domain.
/// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
/// - first index: rx antenna [0..nb_antennas_rx[ /// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES+2048[ /// - second index: sample [0..2*FRAME_LENGTH_COMPLEX_SAMPLES+2048[
int32_t **rxdata; int32_t **rxdata;
/// \brief Holds the received data in time domain for initial sync.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: sample [0..2*FRAME_LENGTH_COMPLEX_SAMPLES+...[
int32_t **rxdata_is;
NR_UE_COMMON_PER_THREAD common_vars_rx_data_per_thread[RX_NB_TH_MAX]; NR_UE_COMMON_PER_THREAD common_vars_rx_data_per_thread[RX_NB_TH_MAX];
/// holds output of the sync correlator /// holds output of the sync correlator
......
...@@ -587,15 +587,15 @@ int main(int argc, char **argv) ...@@ -587,15 +587,15 @@ int main(int argc, char **argv)
for (i=0; i<frame_length_complex_samples; i++) { for (i=0; i<frame_length_complex_samples; i++) {
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
((short*) UE->common_vars.rxdata_is[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); ((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
((short*) UE->common_vars.rxdata_is[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); ((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
} }
} }
if (n_trials==1) { if (n_trials==1) {
LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata_is[0],frame_parms->samples_per_frame,1,1); LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0],frame_parms->samples_per_frame,1,1);
if (gNB->frame_parms.nb_antennas_tx>1) if (gNB->frame_parms.nb_antennas_tx>1)
LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata_is[1],frame_parms->samples_per_frame,1,1); LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1],frame_parms->samples_per_frame,1,1);
} }
if (UE->is_synchronized == 0) { if (UE->is_synchronized == 0) {
...@@ -605,7 +605,6 @@ int main(int argc, char **argv) ...@@ -605,7 +605,6 @@ int main(int argc, char **argv)
if (ret<0) n_errors++; if (ret<0) n_errors++;
} }
else { else {
UE->common_vars.rxdata = UE->common_vars.rxdata_is;
UE->rx_offset=0; UE->rx_offset=0;
uint8_t ssb_index = 0; uint8_t ssb_index = 0;
while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb
......
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