Commit 4c5d5ea4 authored by Hongzhi Wang's avatar Hongzhi Wang

ue switch to slot based processing

parent 682ca5eb
...@@ -54,7 +54,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -54,7 +54,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
//int i; //int i;
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10; unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
unsigned int rx_offset; unsigned int rx_offset;
NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[Ns>>1]][0]; NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[Ns]][0];
uint16_t coreset_start_subcarrier = frame_parms->first_carrier_offset;//+((int)floor(frame_parms->ssb_start_subcarrier/NR_NB_SC_PER_RB)+pdcch_vars->coreset[0].rb_offset)*NR_NB_SC_PER_RB; uint16_t coreset_start_subcarrier = frame_parms->first_carrier_offset;//+((int)floor(frame_parms->ssb_start_subcarrier/NR_NB_SC_PER_RB)+pdcch_vars->coreset[0].rb_offset)*NR_NB_SC_PER_RB;
uint16_t nb_rb_coreset = 24; uint16_t nb_rb_coreset = 24;
uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset;//+516; uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset;//+516;
...@@ -104,9 +104,9 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -104,9 +104,9 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
} }
if (no_prefix) { if (no_prefix) {
slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_slot*frame_parms->slots_per_subframe) * (Ns>>1); slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_slot) * (Ns);
} else { } else {
slot_offset = (frame_parms->samples_per_subframe) * (Ns>>1); slot_offset = (frame_parms->samples_per_slot) * (Ns);
} }
/*if (l<0 || l>=7-frame_parms->Ncp) { /*if (l<0 || l>=7-frame_parms->Ncp) {
...@@ -122,7 +122,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -122,7 +122,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int)); memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
rx_offset = sample_offset + slot_offset + nb_prefix_samples0 - SOFFSET; rx_offset = sample_offset + slot_offset + nb_prefix_samples0 - SOFFSET;
// Align with 256 bit // Align with 256 bit
...@@ -130,8 +130,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -130,8 +130,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
// if (ue->frame <100) // if (ue->frame <100)
/*LOG_I(PHY,*/printf("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol, /*LOG_I(PHY,*/printf("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", ue->proc.proc_rxtx[(Ns)&1].frame_rx,Ns, symbol,
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples); nb_prefix_samples,nb_prefix_samples0,slot_offset,sample_offset,rx_offset,frame_length_samples);
#endif #endif
if (l==0) { if (l==0) {
...@@ -146,14 +146,14 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -146,14 +146,14 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
(void *)&common_vars->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>>1]].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
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats); start_meas(&ue->rx_dft_stats);
#endif #endif
dft((int16_t *)&common_vars->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>>1]].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);
#endif #endif
...@@ -175,11 +175,11 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -175,11 +175,11 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
(void *)&common_vars->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>>1]].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 *)&common_vars->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>>1]].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);
......
...@@ -272,8 +272,8 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -272,8 +272,8 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
//uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1]; //uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
uint8_t nushift; uint8_t nushift;
int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset]; int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].dl_ch_estimates[eNB_offset];
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF; int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF;
nushift = 1; nushift = 1;
ue->frame_parms.nushift = nushift; ue->frame_parms.nushift = nushift;
...@@ -288,7 +288,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -288,7 +288,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
k = coreset_start_subcarrier; k = coreset_start_subcarrier;
#ifdef DEBUG_PDCCH #ifdef DEBUG_PDCCH
printf("PDCCH Channel Estimation : ThreadId %d, eNB_offset %d ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n",ue->current_thread_id[Ns>>1], eNB_offset,ch_offset,ue->frame_parms.ofdm_symbol_size, printf("PDCCH Channel Estimation : ThreadId %d, eNB_offset %d ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n",ue->current_thread_id[Ns], eNB_offset,ch_offset,ue->frame_parms.ofdm_symbol_size,
ue->frame_parms.Ncp,l,Ns,k, symbol); ue->frame_parms.Ncp,l,Ns,k, symbol);
#endif #endif
...@@ -460,16 +460,16 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -460,16 +460,16 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
break; break;
} }
if( (Ns== 2) && (l == 0)) if( (Ns== 1) && (l == 0))
{ {
// do ifft of channel estimate // do ifft of channel estimate
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++)
for (p=0; p<ue->frame_parms.nb_antenna_ports_eNB; p++) { for (p=0; p<ue->frame_parms.nb_antenna_ports_eNB; p++) {
if (ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset][(p<<1)+aarx]) if (ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].dl_ch_estimates[eNB_offset][(p<<1)+aarx])
{ {
LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d \n", Ns, ue->current_thread_id[Ns>>1], l); LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d \n", Ns, ue->current_thread_id[Ns], l);
idft((int16_t*) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset][(p<<1)+aarx][0], idft((int16_t*) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].dl_ch_estimates[eNB_offset][(p<<1)+aarx][0],
(int16_t*) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates_time[eNB_offset][(p<<1)+aarx],1); (int16_t*) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].dl_ch_estimates_time[eNB_offset][(p<<1)+aarx],1);
} }
} }
} }
...@@ -497,8 +497,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -497,8 +497,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
//uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1]; //uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
uint8_t nushift; uint8_t nushift;
int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset]; int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].dl_ch_estimates[eNB_offset];
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF; int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF;
nushift = (p>>1)&1; nushift = (p>>1)&1;
ue->frame_parms.nushift = nushift; ue->frame_parms.nushift = nushift;
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
//#define NR_LTE_PDCCH_DCI_SWITCH //#define NR_LTE_PDCCH_DCI_SWITCH
#define NR_PDCCH_DCI_RUN // activates new nr functions #define NR_PDCCH_DCI_RUN // activates new nr functions
#define NR_PDCCH_DCI_DEBUG // activates NR_PDCCH_DCI_DEBUG logs //#define NR_PDCCH_DCI_DEBUG // activates NR_PDCCH_DCI_DEBUG logs
#define NR_NBR_CORESET_ACT_BWP 3 // The number of CoreSets per BWP is limited to 3 (including initial CORESET: ControlResourceId 0) #define NR_NBR_CORESET_ACT_BWP 3 // The number of CoreSets per BWP is limited to 3 (including initial CORESET: ControlResourceId 0)
#define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0) #define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0)
#define PDCCH_TEST_POLAR_TEMP_FIX #define PDCCH_TEST_POLAR_TEMP_FIX
...@@ -1451,12 +1451,12 @@ void nr_dci_decoding_procedure0(int s, ...@@ -1451,12 +1451,12 @@ void nr_dci_decoding_procedure0(int s,
dci_alloc[*dci_cnt].dci_pdu[1] = dci_estimation[1]; dci_alloc[*dci_cnt].dci_pdu[1] = dci_estimation[1];
dci_alloc[*dci_cnt].dci_pdu[2] = dci_estimation[2]; dci_alloc[*dci_cnt].dci_pdu[2] = dci_estimation[2];
dci_alloc[*dci_cnt].dci_pdu[3] = dci_estimation[3]; dci_alloc[*dci_cnt].dci_pdu[3] = dci_estimation[3];
#ifdef NR_PDCCH_DCI_DEBUG //#ifdef NR_PDCCH_DCI_DEBUG
printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> rnti matches -> DCI FOUND !!! crc =>%x, sizeof_bits %d, sizeof_bytes %d \n", printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> rnti matches -> DCI FOUND !!! crc =>%x, sizeof_bits %d, sizeof_bytes %d \n",
dci_alloc[*dci_cnt].rnti, dci_alloc[*dci_cnt].dci_length, sizeof_bytes); dci_alloc[*dci_cnt].rnti, dci_alloc[*dci_cnt].dci_length, sizeof_bytes);
printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> dci_cnt %d (format_css %d crc_scrambled %d) L %d, firstCCE %d pdu[0] %x pdu[1] %x pdu[2] %x pdu[3] %x \n", printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> dci_cnt %d (format_css %d crc_scrambled %d) L %d, firstCCE %d pdu[0] %x pdu[1] %x pdu[2] %x pdu[3] %x \n",
*dci_cnt, format_css,*crc_scrambled,dci_alloc[*dci_cnt].L, dci_alloc[*dci_cnt].firstCCE,dci_alloc[*dci_cnt].dci_pdu[0],dci_alloc[*dci_cnt].dci_pdu[1],dci_alloc[*dci_cnt].dci_pdu[2],dci_alloc[*dci_cnt].dci_pdu[3]); *dci_cnt, format_css,*crc_scrambled,dci_alloc[*dci_cnt].L, dci_alloc[*dci_cnt].firstCCE,dci_alloc[*dci_cnt].dci_pdu[0],dci_alloc[*dci_cnt].dci_pdu[1],dci_alloc[*dci_cnt].dci_pdu[2],dci_alloc[*dci_cnt].dci_pdu[3]);
#endif //#endif
if ((format_css == cformat0_0_and_1_0) || (format_uss == uformat0_0_and_1_0)){ if ((format_css == cformat0_0_and_1_0) || (format_uss == uformat0_0_and_1_0)){
if ((*crc_scrambled == _p_rnti) || (*crc_scrambled == _si_rnti) || (*crc_scrambled == _ra_rnti)){ if ((*crc_scrambled == _p_rnti) || (*crc_scrambled == _si_rnti) || (*crc_scrambled == _ra_rnti)){
dci_alloc[*dci_cnt].format = format1_0; dci_alloc[*dci_cnt].format = format1_0;
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
//#define DEBUG_DCI //#define DEBUG_DCI
#define NR_PDCCH_DCI_TOOLS #define NR_PDCCH_DCI_TOOLS
#define NR_PDCCH_DCI_TOOLS_DEBUG //#define NR_PDCCH_DCI_TOOLS_DEBUG
typedef unsigned __int128 uint128_t; typedef unsigned __int128 uint128_t;
......
...@@ -1030,7 +1030,7 @@ typedef struct { ...@@ -1030,7 +1030,7 @@ typedef struct {
fapi_nr_dci_indication_t dci_ind; fapi_nr_dci_indication_t dci_ind;
// point to the current rxTx thread index // point to the current rxTx thread index
uint8_t current_thread_id[10]; uint8_t current_thread_id[40];
NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX+1]; // two RxTx Threads NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX+1]; // two RxTx Threads
NR_UE_PDSCH_FLP *pdsch_vars_flp[NUMBER_OF_CONNECTED_eNB_MAX+1]; NR_UE_PDSCH_FLP *pdsch_vars_flp[NUMBER_OF_CONNECTED_eNB_MAX+1];
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
//#define DEBUG_PHY_PROC //#define DEBUG_PHY_PROC
#define NR_PDCCH_SCHED #define NR_PDCCH_SCHED
#define NR_PDCCH_SCHED_DEBUG //#define NR_PDCCH_SCHED_DEBUG
//#define NR_PUCCH_SCHED //#define NR_PUCCH_SCHED
//#define NR_PUCCH_SCHED_DEBUG //#define NR_PUCCH_SCHED_DEBUG
...@@ -3081,6 +3081,8 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -3081,6 +3081,8 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
// Higher layers have updated the number of searchSpaces with are active in the current slot and this value is stored in variable nb_searchspace_total // Higher layers have updated the number of searchSpaces with are active in the current slot and this value is stored in variable nb_searchspace_total
int nb_searchspace_total = pdcch_vars2->nb_search_space; int nb_searchspace_total = pdcch_vars2->nb_search_space;
pdcch_vars[eNB_id]->crnti = 0x1234; //to be check how to set when using loop memory
uint16_t c_rnti=pdcch_vars[eNB_id]->crnti; uint16_t c_rnti=pdcch_vars[eNB_id]->crnti;
uint16_t cs_rnti,new_rnti,tc_rnti; uint16_t cs_rnti,new_rnti,tc_rnti;
uint16_t p_rnti=P_RNTI; uint16_t p_rnti=P_RNTI;
...@@ -5075,7 +5077,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN ...@@ -5075,7 +5077,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
#endif #endif
//printf("phy procedure pdcch start measurement l =%d\n",l); //printf("phy procedure pdcch start measurement l =%d\n",l);
nr_ue_measurement_procedures(l,ue,proc,eNB_id,(nr_tti_rx<<1),mode); nr_ue_measurement_procedures(l,ue,proc,eNB_id,(nr_tti_rx),mode);
} }
......
...@@ -442,9 +442,9 @@ static void *UE_thread_synch(void *arg) { ...@@ -442,9 +442,9 @@ static void *UE_thread_synch(void *arg) {
#endif #endif
if (nr_initial_sync( UE, UE->mode ) == 0) { if (nr_initial_sync( UE, UE->mode ) == 0) {
//write_output("txdata_sym.m", "txdata_sym", UE->common_vars.rxdata[0], (10*UE->frame_parms.samples_per_subframe), 1, 1); //write_output("txdata_sym.m", "txdata_sym", UE->common_vars.rxdata[0], (10*UE->frame_parms.samples_per_slot), 1, 1);
hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe; hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_slot;
printf("Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n", printf("Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n",
hw_slot_offset, hw_slot_offset,
freq_offset, freq_offset,
...@@ -794,6 +794,8 @@ void *UE_thread(void *arg) { ...@@ -794,6 +794,8 @@ void *UE_thread(void *arg) {
UE->proc.proc_rxtx[2].counter_decoder = 0; UE->proc.proc_rxtx[2].counter_decoder = 0;
static uint8_t thread_idx = 0; static uint8_t thread_idx = 0;
uint16_t table_sf_slot[20] = {0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9};
cpu_set_t cpuset; cpu_set_t cpuset;
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
...@@ -814,7 +816,8 @@ void *UE_thread(void *arg) { ...@@ -814,7 +816,8 @@ void *UE_thread(void *arg) {
//itti_send_msg_to_task (TASK_NAS_UE, UE->Mod_id + NB_eNB_INST, message_p); //itti_send_msg_to_task (TASK_NAS_UE, UE->Mod_id + NB_eNB_INST, message_p);
#endif #endif
int subframe_nr=-1; int nb_slot_frame = 10*UE->frame_parms.slots_per_subframe;
int slot_nr=-1;
//int cumulated_shift=0; //int cumulated_shift=0;
if ((oaisim_flag == 0) && (UE->mode != loop_through_memory)) if ((oaisim_flag == 0) && (UE->mode != loop_through_memory))
AssertFatal(UE->rfdevice.trx_start_func(&UE->rfdevice) == 0, "Could not start the device\n"); AssertFatal(UE->rfdevice.trx_start_func(&UE->rfdevice) == 0, "Could not start the device\n");
...@@ -917,11 +920,13 @@ void *UE_thread(void *arg) { ...@@ -917,11 +920,13 @@ void *UE_thread(void *arg) {
if(thread_idx>=RX_NB_TH) if(thread_idx>=RX_NB_TH)
thread_idx = 0; thread_idx = 0;
subframe_nr++; printf("slot_nr %d nb slot frame %d\n",slot_nr, nb_slot_frame);
subframe_nr %= NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
slot_nr++;
slot_nr %= nb_slot_frame;
UE_nr_rxtx_proc_t *proc = &UE->proc.proc_rxtx[thread_idx]; UE_nr_rxtx_proc_t *proc = &UE->proc.proc_rxtx[thread_idx];
// update thread index for received subframe // update thread index for received subframe
UE->current_thread_id[subframe_nr] = thread_idx; UE->current_thread_id[slot_nr] = thread_idx;
#if BASIC_SIMULATOR #if BASIC_SIMULATOR
{ {
...@@ -935,38 +940,38 @@ void *UE_thread(void *arg) { ...@@ -935,38 +940,38 @@ void *UE_thread(void *arg) {
} }
#endif #endif
LOG_D(PHY,"Process subframe %d thread Idx %d \n", subframe_nr, UE->current_thread_id[subframe_nr]); LOG_D(PHY,"Process slot %d thread Idx %d \n", slot_nr, UE->current_thread_id[slot_nr]);
if (UE->mode != loop_through_memory) { if (UE->mode != loop_through_memory) {
for (i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void*)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+ rxp[i] = (void*)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+
UE->frame_parms.nb_prefix_samples0+ UE->frame_parms.nb_prefix_samples0+
subframe_nr*UE->frame_parms.samples_per_subframe]; slot_nr*UE->frame_parms.samples_per_slot];
for (i=0; i<UE->frame_parms.nb_antennas_tx; i++) for (i=0; i<UE->frame_parms.nb_antennas_tx; i++)
txp[i] = (void*)&UE->common_vars.txdata[i][((subframe_nr+2)%NR_NUMBER_OF_SUBFRAMES_PER_FRAME)*UE->frame_parms.samples_per_subframe]; txp[i] = (void*)&UE->common_vars.txdata[i][((slot_nr+2)%NR_NUMBER_OF_SUBFRAMES_PER_FRAME)*UE->frame_parms.samples_per_slot];
int readBlockSize, writeBlockSize; int readBlockSize, writeBlockSize;
if (subframe_nr<(NR_NUMBER_OF_SUBFRAMES_PER_FRAME - 1)) { if (slot_nr<(nb_slot_frame - 1)) {
readBlockSize=UE->frame_parms.samples_per_subframe; readBlockSize=UE->frame_parms.samples_per_slot;
writeBlockSize=UE->frame_parms.samples_per_subframe; writeBlockSize=UE->frame_parms.samples_per_slot;
} else { } else {
// set TO compensation to zero // set TO compensation to zero
UE->rx_offset_diff = 0; UE->rx_offset_diff = 0;
// compute TO compensation that should be applied for this frame // compute TO compensation that should be applied for this frame
if ( UE->rx_offset < 5*UE->frame_parms.samples_per_subframe && if ( UE->rx_offset < 5*UE->frame_parms.samples_per_slot &&
UE->rx_offset > 0 ) UE->rx_offset > 0 )
UE->rx_offset_diff = -1 ; UE->rx_offset_diff = -1 ;
if ( UE->rx_offset > 5*UE->frame_parms.samples_per_subframe && if ( UE->rx_offset > 5*UE->frame_parms.samples_per_slot &&
UE->rx_offset < 10*UE->frame_parms.samples_per_subframe ) UE->rx_offset < 10*UE->frame_parms.samples_per_slot )
UE->rx_offset_diff = 1; UE->rx_offset_diff = 1;
LOG_D(PHY,"AbsSubframe %d.%d TTI SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,subframe_nr,UE->rx_offset_diff,UE->rx_offset); LOG_D(PHY,"AbsSubframe %d.%d TTI SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,slot_nr,UE->rx_offset_diff,UE->rx_offset);
readBlockSize=UE->frame_parms.samples_per_subframe - readBlockSize=UE->frame_parms.samples_per_slot -
UE->frame_parms.ofdm_symbol_size - UE->frame_parms.ofdm_symbol_size -
UE->frame_parms.nb_prefix_samples0 - UE->frame_parms.nb_prefix_samples0 -
UE->rx_offset_diff; UE->rx_offset_diff;
writeBlockSize=UE->frame_parms.samples_per_subframe - writeBlockSize=UE->frame_parms.samples_per_slot -
UE->rx_offset_diff; UE->rx_offset_diff;
} }
...@@ -979,7 +984,7 @@ void *UE_thread(void *arg) { ...@@ -979,7 +984,7 @@ void *UE_thread(void *arg) {
AssertFatal( writeBlockSize == AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice, UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+ timestamp+
(2*UE->frame_parms.samples_per_subframe) - (2*UE->frame_parms.samples_per_slot) -
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 - UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 -
openair0_cfg[0].tx_sample_advance, openair0_cfg[0].tx_sample_advance,
txp, txp,
...@@ -987,7 +992,7 @@ void *UE_thread(void *arg) { ...@@ -987,7 +992,7 @@ void *UE_thread(void *arg) {
UE->frame_parms.nb_antennas_tx, UE->frame_parms.nb_antennas_tx,
1),""); 1),"");
if( subframe_nr==(NR_NUMBER_OF_SUBFRAMES_PER_FRAME-1)) { if( slot_nr==(nb_slot_frame-1)) {
// read in first symbol of next frame and adjust for timing drift // read in first symbol of next frame and adjust for timing drift
int first_symbols=writeBlockSize-readBlockSize; int first_symbols=writeBlockSize-readBlockSize;
if ( first_symbols > 0 ) if ( first_symbols > 0 )
...@@ -1004,7 +1009,7 @@ void *UE_thread(void *arg) { ...@@ -1004,7 +1009,7 @@ void *UE_thread(void *arg) {
pickTime(gotIQs); pickTime(gotIQs);
// operate on thread sf mod 2 // operate on thread sf mod 2
AssertFatal(pthread_mutex_lock(&proc->mutex_rxtx) ==0,""); AssertFatal(pthread_mutex_lock(&proc->mutex_rxtx) ==0,"");
if(subframe_nr == 0) { if(slot_nr == 0) {
UE->proc.proc_rxtx[0].frame_rx++; UE->proc.proc_rxtx[0].frame_rx++;
//UE->proc.proc_rxtx[1].frame_rx++; //UE->proc.proc_rxtx[1].frame_rx++;
for (th_id=1; th_id < RX_NB_TH; th_id++) { for (th_id=1; th_id < RX_NB_TH; th_id++) {
...@@ -1026,18 +1031,18 @@ void *UE_thread(void *arg) { ...@@ -1026,18 +1031,18 @@ void *UE_thread(void *arg) {
UE->proc.proc_rxtx[th_id].gotIQs=readTime(gotIQs); UE->proc.proc_rxtx[th_id].gotIQs=readTime(gotIQs);
} }
proc->nr_tti_rx=subframe_nr; proc->nr_tti_rx=slot_nr;
proc->subframe_rx=subframe_nr; proc->subframe_rx=table_sf_slot[slot_nr];
proc->frame_tx = proc->frame_rx; proc->frame_tx = proc->frame_rx;
proc->nr_tti_tx= subframe_nr + DURATION_RX_TO_TX; proc->nr_tti_tx= slot_nr + DURATION_RX_TO_TX;
if (proc->nr_tti_tx > NR_NUMBER_OF_SUBFRAMES_PER_FRAME) { if (proc->nr_tti_tx > nb_slot_frame) {
proc->frame_tx = (proc->frame_tx + 1)%MAX_FRAME_NUMBER; proc->frame_tx = (proc->frame_tx + 1)%MAX_FRAME_NUMBER;
proc->nr_tti_tx %= NR_NUMBER_OF_SUBFRAMES_PER_FRAME; proc->nr_tti_tx %= nb_slot_frame;
} }
proc->subframe_tx=proc->nr_tti_rx; proc->subframe_tx=proc->nr_tti_rx;
proc->timestamp_tx = timestamp+ proc->timestamp_tx = timestamp+
(DURATION_RX_TO_TX*UE->frame_parms.samples_per_subframe)- (DURATION_RX_TO_TX*UE->frame_parms.samples_per_slot)-
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0; UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
proc->instance_cnt_rxtx++; proc->instance_cnt_rxtx++;
...@@ -1057,7 +1062,7 @@ void *UE_thread(void *arg) { ...@@ -1057,7 +1062,7 @@ void *UE_thread(void *arg) {
char exit_fun_string[256]; char exit_fun_string[256];
sprintf(exit_fun_string,"[SCHED][UE %d] !!! UE instance_cnt_rxtx > 2 (IC %d) (Proc %d)!!", sprintf(exit_fun_string,"[SCHED][UE %d] !!! UE instance_cnt_rxtx > 2 (IC %d) (Proc %d)!!",
UE->Mod_id, proc->instance_cnt_rxtx, UE->Mod_id, proc->instance_cnt_rxtx,
UE->current_thread_id[subframe_nr]); UE->current_thread_id[slot_nr]);
printf("%s\n",exit_fun_string); printf("%s\n",exit_fun_string);
fflush(stdout); fflush(stdout);
sleep(1); sleep(1);
...@@ -1073,20 +1078,20 @@ void *UE_thread(void *arg) { ...@@ -1073,20 +1078,20 @@ void *UE_thread(void *arg) {
// pickStaticTime(lastTime); // pickStaticTime(lastTime);
} //UE->mode != loop_through_memory } //UE->mode != loop_through_memory
else { else {
proc->nr_tti_rx=subframe_nr; proc->nr_tti_rx=slot_nr;
proc->subframe_rx=subframe_nr; proc->subframe_rx=table_sf_slot[slot_nr];
if(subframe_nr == 0) { if(slot_nr == 0) {
for (th_id=0; th_id < RX_NB_TH; th_id++) { for (th_id=0; th_id < RX_NB_TH; th_id++) {
UE->proc.proc_rxtx[th_id].frame_rx++; UE->proc.proc_rxtx[th_id].frame_rx++;
} }
} }
proc->frame_tx = proc->frame_rx; proc->frame_tx = proc->frame_rx;
proc->nr_tti_tx= subframe_nr + DURATION_RX_TO_TX; proc->nr_tti_tx= slot_nr + DURATION_RX_TO_TX;
if (proc->nr_tti_tx > NR_NUMBER_OF_SUBFRAMES_PER_FRAME) { if (proc->nr_tti_tx > nb_slot_frame) {
proc->frame_tx = (proc->frame_tx + 1)%MAX_FRAME_NUMBER; proc->frame_tx = (proc->frame_tx + 1)%MAX_FRAME_NUMBER;
proc->nr_tti_tx %= NR_NUMBER_OF_SUBFRAMES_PER_FRAME; proc->nr_tti_tx %= nb_slot_frame;
} }
proc->subframe_tx=proc->nr_tti_tx; proc->subframe_tx=table_sf_slot[proc->nr_tti_tx];
if (slot_select_nr(&UE->frame_parms, proc->frame_tx, proc->nr_tti_tx) & NR_DOWNLINK_SLOT) { if (slot_select_nr(&UE->frame_parms, proc->frame_tx, proc->nr_tti_tx) & NR_DOWNLINK_SLOT) {
...@@ -1107,8 +1112,9 @@ void *UE_thread(void *arg) { ...@@ -1107,8 +1112,9 @@ void *UE_thread(void *arg) {
UE_mac->scheduled_response.dl_config = &UE->dcireq.dl_config_req; UE_mac->scheduled_response.dl_config = &UE->dcireq.dl_config_req;
nr_ue_scheduled_response(&UE_mac->scheduled_response); nr_ue_scheduled_response(&UE_mac->scheduled_response);
//write_output("uerxdata_frame.m", "uerxdata_frame", UE->common_vars.rxdata[0], UE->frame_parms.samples_per_frame, 1, 1);
printf("Processing subframe %d\n",proc->subframe_rx); printf("Processing slot %d\n",proc->nr_tti_rx);
phy_procedures_nrUE_RX( UE, proc, 0, 1, UE->mode); phy_procedures_nrUE_RX( UE, proc, 0, 1, UE->mode);
} }
......
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