Commit b51beff9 authored by Francesco Mani's avatar Francesco Mani

Merge branch 'NR_gNB_SCF_Indication' into NR_RRC_harq_hacks

parents c4e284a3 b651cae0
...@@ -161,7 +161,7 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t ...@@ -161,7 +161,7 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
oai_subframe_ind(frame_rx, slot_rx); oai_subframe_ind(frame_rx, slot_rx);
stop_meas(&nfapi_meas); stop_meas(&nfapi_meas);
if (gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus|| /*if (gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus||
gNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs || gNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs ||
gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs || gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs ||
gNB->UL_INFO.rach_ind.number_of_pdus || gNB->UL_INFO.rach_ind.number_of_pdus ||
...@@ -175,7 +175,7 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t ...@@ -175,7 +175,7 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
gNB->UL_INFO.cqi_ind.number_of_cqis, gNB->UL_INFO.cqi_ind.number_of_cqis,
frame_rx, slot_rx, frame_rx, slot_rx,
frame_tx, slot_tx); frame_tx, slot_tx);
} }*/
} }
// **************************************** // ****************************************
...@@ -970,12 +970,13 @@ void init_gNB(int single_thread_flag,int wait_for_sync) { ...@@ -970,12 +970,13 @@ void init_gNB(int single_thread_flag,int wait_for_sync) {
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO)); memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO));
LOG_I(PHY,"Setting indication lists\n"); LOG_I(PHY,"Setting indication lists\n");
gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list = calloc(NFAPI_RX_IND_MAX_PDU,sizeof(nfapi_rx_indication_pdu_t));
gNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list = calloc(NFAPI_CRC_IND_MAX_PDU,sizeof(nfapi_crc_indication_pdu_t)); gNB->UL_INFO.rx_ind.pdu_list = gNB->rx_pdu_list;
gNB->UL_INFO.sr_ind.sr_indication_body.sr_pdu_list = calloc(NFAPI_SR_IND_MAX_PDU,sizeof(nfapi_sr_indication_pdu_t)); gNB->UL_INFO.crc_ind.crc_list = gNB->crc_pdu_list;
gNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = calloc(NFAPI_HARQ_IND_MAX_PDU,sizeof(nfapi_harq_indication_pdu_t)); /*gNB->UL_INFO.sr_ind.sr_indication_body.sr_pdu_list = gNB->sr_pdu_list;
gNB->UL_INFO.cqi_ind.cqi_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU,sizeof(nfapi_cqi_indication_pdu_t)); gNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = gNB->harq_pdu_list;
gNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU,sizeof(nfapi_cqi_indication_raw_pdu_t)); gNB->UL_INFO.cqi_ind.cqi_pdu_list = gNB->cqi_pdu_list;
gNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = gNB->cqi_raw_pdu_list;*/
gNB->prach_energy_counter = 0; gNB->prach_energy_counter = 0;
} }
......
...@@ -1388,7 +1388,7 @@ typedef struct ...@@ -1388,7 +1388,7 @@ typedef struct
uint16_t timing_advance;//Timing advance 𝑇𝐴 measured for the UE [TS 38.213, Section 4.2] NTA_new = NTA_old + (TA − 31) ⋅ 16 ⋅ 64⁄2μ Value: 0 → 63 0xffff should be set if this field is invalid uint16_t timing_advance;//Timing advance 𝑇𝐴 measured for the UE [TS 38.213, Section 4.2] NTA_new = NTA_old + (TA − 31) ⋅ 16 ⋅ 64⁄2μ Value: 0 → 63 0xffff should be set if this field is invalid
uint16_t rssi; uint16_t rssi;
//variable ! fixme //variable ! fixme
uint32_t pdu; //MAC PDU uint8_t *pdu; //MAC PDU
} nfapi_nr_rx_data_pdu_t; } nfapi_nr_rx_data_pdu_t;
......
...@@ -458,9 +458,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -458,9 +458,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
for (r=0; r<harq_process->C; r++) { for (r=0; r<harq_process->C; r++) {
E = nr_get_E(G, harq_process->C, Qm, n_layers, r); E = nr_get_E(G, harq_process->C, Qm, n_layers, r);
#if gNB_TIMING_TRACE
start_meas(ulsch_deinterleaving_stats); start_meas(&phy_vars_gNB->ulsch_deinterleaving_stats);
#endif
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// nr_deinterleaving_ldpc /////////////////////////////////// ///////////////////////////////// nr_deinterleaving_ldpc ///////////////////////////////////
...@@ -476,13 +475,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -476,13 +475,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
//for (int i =0; i<16; i++) //for (int i =0; i<16; i++)
// printf("rx output deinterleaving w[%d]= %d r_offset %d\n", i,harq_process->w[r][i], r_offset); // printf("rx output deinterleaving w[%d]= %d r_offset %d\n", i,harq_process->w[r][i], r_offset);
#if gNB_TIMING_TRACE stop_meas(&phy_vars_gNB->ulsch_deinterleaving_stats);
stop_meas(ulsch_deinterleaving_stats);
#endif
#if gNB_TIMING_TRACE
start_meas(ulsch_rate_unmatching_stats);
#endif
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n", LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
...@@ -504,6 +498,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -504,6 +498,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
///////////////////////// harq_process->e =====> harq_process->d ///////////////////////// ///////////////////////// harq_process->e =====> harq_process->d /////////////////////////
start_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats);
Tbslbrm = nr_compute_tbslbrm(0,nb_rb,n_layers,harq_process->C); Tbslbrm = nr_compute_tbslbrm(0,nb_rb,n_layers,harq_process->C);
if (nr_rate_matching_ldpc_rx(Ilbrm, if (nr_rate_matching_ldpc_rx(Ilbrm,
...@@ -518,15 +514,13 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -518,15 +514,13 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
E, E,
harq_process->F, harq_process->F,
Kr-harq_process->F-2*(p_decParams->Z))==-1) { Kr-harq_process->F-2*(p_decParams->Z))==-1) {
#if gNB_TIMING_TRACE
stop_meas(ulsch_rate_unmatching_stats); stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats);
#endif
LOG_E(PHY,"ulsch_decoding.c: Problem in rate_matching\n"); LOG_E(PHY,"ulsch_decoding.c: Problem in rate_matching\n");
return (ulsch->max_ldpc_iterations + 1); return (ulsch->max_ldpc_iterations + 1);
} else { } else {
#if gNB_TIMING_TRACE stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats);
stop_meas(ulsch_rate_unmatching_stats);
#endif
} }
r_offset += E; r_offset += E;
...@@ -564,9 +558,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -564,9 +558,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
if (err_flag == 0) { if (err_flag == 0) {
#if gNB_TIMING_TRACE start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
start_meas(ulsch_turbo_decoding_stats);
#endif
//LOG_E(PHY,"AbsSubframe %d.%d Start LDPC segment %d/%d A %d ",frame%1024,nr_tti_rx,r,harq_process->C-1, A); //LOG_E(PHY,"AbsSubframe %d.%d Start LDPC segment %d/%d A %d ",frame%1024,nr_tti_rx,r,harq_process->C-1, A);
...@@ -636,9 +628,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -636,9 +628,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
//write_output("dec_output.m","dec0",harq_process->c[0],Kr_bytes,1,4); //write_output("dec_output.m","dec0",harq_process->c[0],Kr_bytes,1,4);
#endif #endif
#if gNB_TIMING_TRACE stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
stop_meas(ulsch_turbo_decoding_stats);
#endif
} }
if ((err_flag == 0) && (ret >= (ulsch->max_ldpc_iterations + 1))) { if ((err_flag == 0) && (ret >= (ulsch->max_ldpc_iterations + 1))) {
......
...@@ -1092,7 +1092,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1092,7 +1092,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- Channel estimation --------------------- //--------------------- Channel estimation ---------------------
//---------------------------------------------------------- //----------------------------------------------------------
start_meas(&gNB->ulsch_channel_estimation_stats);
if (dmrs_symbol_flag == 1) if (dmrs_symbol_flag == 1)
nr_pusch_channel_estimation(gNB, nr_pusch_channel_estimation(gNB,
nr_tti_rx, nr_tti_rx,
...@@ -1100,19 +1100,22 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1100,19 +1100,22 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
symbol, symbol,
bwp_start_subcarrier, bwp_start_subcarrier,
rel15_ul); rel15_ul);
stop_meas(&gNB->ulsch_channel_estimation_stats);
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- RBs extraction --------------------- //--------------------- RBs extraction ---------------------
//---------------------------------------------------------- //----------------------------------------------------------
if (nb_re_pusch > 0) { if (nb_re_pusch > 0) {
start_meas(&gNB->ulsch_rbs_extraction_stats);
nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF, nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
gNB->pusch_vars[UE_id], gNB->pusch_vars[UE_id],
symbol, symbol,
dmrs_symbol_flag, dmrs_symbol_flag,
rel15_ul, rel15_ul,
frame_parms); frame_parms);
stop_meas(&gNB->ulsch_rbs_extraction_stats);
nr_ulsch_scale_channel(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext, nr_ulsch_scale_channel(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
frame_parms, frame_parms,
...@@ -1141,7 +1144,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1141,7 +1144,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
gNB->pusch_vars[UE_id]->log2_maxh = (log2_approx(avgs)/2)+1; gNB->pusch_vars[UE_id]->log2_maxh = (log2_approx(avgs)/2)+1;
gNB->pusch_vars[UE_id]->cl_done = 1; gNB->pusch_vars[UE_id]->cl_done = 1;
} }
start_meas(&gNB->ulsch_channel_compensation_stats);
nr_ulsch_channel_compensation(gNB->pusch_vars[UE_id]->rxdataF_ext, nr_ulsch_channel_compensation(gNB->pusch_vars[UE_id]->rxdataF_ext,
gNB->pusch_vars[UE_id]->ul_ch_estimates_ext, gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
gNB->pusch_vars[UE_id]->ul_ch_mag0, gNB->pusch_vars[UE_id]->ul_ch_mag0,
...@@ -1154,6 +1157,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1154,6 +1157,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
rel15_ul->qam_mod_order, rel15_ul->qam_mod_order,
rel15_ul->rb_size, rel15_ul->rb_size,
gNB->pusch_vars[UE_id]->log2_maxh); gNB->pusch_vars[UE_id]->log2_maxh);
stop_meas(&gNB->ulsch_channel_compensation_stats);
#ifdef NR_SC_FDMA #ifdef NR_SC_FDMA
nr_idft(&((uint32_t*)gNB->pusch_vars[UE_id]->rxdataF_ext[0])[symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], nb_re_pusch); nr_idft(&((uint32_t*)gNB->pusch_vars[UE_id]->rxdataF_ext[0])[symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], nb_re_pusch);
...@@ -1163,6 +1167,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1163,6 +1167,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
//-------------------- LLRs computation -------------------- //-------------------- LLRs computation --------------------
//---------------------------------------------------------- //----------------------------------------------------------
start_meas(&gNB->ulsch_llr_stats);
nr_ulsch_compute_llr(&gNB->pusch_vars[UE_id]->rxdataF_comp[0][symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], nr_ulsch_compute_llr(&gNB->pusch_vars[UE_id]->rxdataF_comp[0][symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB],
gNB->pusch_vars[UE_id]->ul_ch_mag0, gNB->pusch_vars[UE_id]->ul_ch_mag0,
gNB->pusch_vars[UE_id]->ul_ch_magb0, gNB->pusch_vars[UE_id]->ul_ch_magb0,
...@@ -1171,6 +1176,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1171,6 +1176,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
nb_re_pusch, nb_re_pusch,
symbol, symbol,
rel15_ul->qam_mod_order); rel15_ul->qam_mod_order);
stop_meas(&gNB->ulsch_llr_stats);
} }
......
...@@ -356,11 +356,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -356,11 +356,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
#endif #endif
///////////
/////////////////////////////////////////////////////////////////////////////////////
opp_enabled=0;
///////////////////////// c---->| LDCP coding |---->d ///////////////////////// ///////////////////////// c---->| LDCP coding |---->d /////////////////////////
/////////// ///////////
...@@ -386,6 +381,12 @@ opp_enabled=0; ...@@ -386,6 +381,12 @@ opp_enabled=0;
//for (int i=0;i<68*384;i++) //for (int i=0;i<68*384;i++)
// printf("channel_input[%d]=%d\n",i,channel_input[i]); // printf("channel_input[%d]=%d\n",i,channel_input[i]);
int temp_opp = 0;
if (opp_enabled) {
opp_enabled = 0;
temp_opp = 1;
}
/*printf("output %d %d %d %d %d \n", harq_process->d[0][0], harq_process->d[0][1], harq_process->d[r][2],harq_process->d[0][3], harq_process->d[0][4]); /*printf("output %d %d %d %d %d \n", harq_process->d[0][0], harq_process->d[0][1], harq_process->d[r][2],harq_process->d[0][3], harq_process->d[0][4]);
...@@ -406,6 +407,8 @@ opp_enabled=0; ...@@ -406,6 +407,8 @@ opp_enabled=0;
write_output("ulsch_enc_output0.m","enc0",&harq_process->d[0][0],(3*8*Kr_bytes)+12,1,4); write_output("ulsch_enc_output0.m","enc0",&harq_process->d[0][0],(3*8*Kr_bytes)+12,1,4);
#endif #endif
if (temp_opp) opp_enabled = 1;
/////////// ///////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
......
...@@ -619,6 +619,9 @@ typedef struct { ...@@ -619,6 +619,9 @@ typedef struct {
#define MAX_NUM_NR_RX_RACH_PDUS 4 #define MAX_NUM_NR_RX_RACH_PDUS 4
#define MAX_NUM_NR_RX_PRACH_PREAMBLES 4 #define MAX_NUM_NR_RX_PRACH_PREAMBLES 4
#define MAX_UL_PDUS_PER_SLOT 100
#define MAX_NUM_NR_SRS_PDUS 100
#define MAX_NUM_NR_UCI_PDUS 100
/// Top-level PHY Data Structure for gNB /// Top-level PHY Data Structure for gNB
typedef struct PHY_VARS_gNB_s { typedef struct PHY_VARS_gNB_s {
...@@ -646,17 +649,13 @@ typedef struct PHY_VARS_gNB_s { ...@@ -646,17 +649,13 @@ typedef struct PHY_VARS_gNB_s {
pthread_mutex_t UL_INFO_mutex; pthread_mutex_t UL_INFO_mutex;
/// NFAPI RX ULSCH information /// NFAPI RX ULSCH information
nfapi_rx_indication_pdu_t rx_pdu_list[NFAPI_RX_IND_MAX_PDU]; nfapi_nr_rx_data_pdu_t rx_pdu_list[MAX_UL_PDUS_PER_SLOT];
/// NFAPI RX ULSCH CRC information /// NFAPI RX ULSCH CRC information
nfapi_crc_indication_pdu_t crc_pdu_list[NFAPI_CRC_IND_MAX_PDU]; nfapi_nr_crc_t crc_pdu_list[MAX_UL_PDUS_PER_SLOT];
/// NFAPI HARQ information /// NFAPI SRS information
nfapi_harq_indication_pdu_t harq_pdu_list[NFAPI_HARQ_IND_MAX_PDU]; nfapi_nr_srs_indication_pdu_t srs_pdu_list[MAX_NUM_NR_SRS_PDUS];
/// NFAPI SR information /// NFAPI UCI information
nfapi_sr_indication_pdu_t sr_pdu_list[NFAPI_SR_IND_MAX_PDU]; nfapi_nr_uci_t uci_pdu_list[MAX_NUM_NR_UCI_PDUS];
/// NFAPI CQI information
nfapi_cqi_indication_pdu_t cqi_pdu_list[NFAPI_CQI_IND_MAX_PDU];
/// NFAPI CQI information (raw component)
nfapi_cqi_indication_raw_pdu_t cqi_raw_pdu_list[NFAPI_CQI_IND_MAX_PDU];
/// NFAPI PRACH information /// NFAPI PRACH information
nfapi_nr_prach_indication_pdu_t prach_pdu_indication_list[MAX_NUM_NR_RX_RACH_PDUS]; nfapi_nr_prach_indication_pdu_t prach_pdu_indication_list[MAX_NUM_NR_RX_RACH_PDUS];
/// NFAPI PRACH information /// NFAPI PRACH information
...@@ -741,9 +740,7 @@ typedef struct PHY_VARS_gNB_s { ...@@ -741,9 +740,7 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t phy_proc; time_stats_t phy_proc;
*/ */
time_stats_t phy_proc_tx; time_stats_t phy_proc_tx;
/*
time_stats_t phy_proc_rx; time_stats_t phy_proc_rx;
*/
time_stats_t rx_prach; time_stats_t rx_prach;
/* /*
time_stats_t ofdm_mod_stats; time_stats_t ofdm_mod_stats;
...@@ -759,18 +756,21 @@ typedef struct PHY_VARS_gNB_s { ...@@ -759,18 +756,21 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t dlsch_rate_matching_stats; time_stats_t dlsch_rate_matching_stats;
time_stats_t dlsch_interleaving_stats; time_stats_t dlsch_interleaving_stats;
time_stats_t dlsch_segmentation_stats; time_stats_t dlsch_segmentation_stats;
/*
time_stats_t rx_dft_stats;
time_stats_t ulsch_channel_estimation_stats;
time_stats_t ulsch_freq_offset_estimation_stats;
time_stats_t ulsch_decoding_stats; time_stats_t ulsch_decoding_stats;
time_stats_t ulsch_demodulation_stats;
time_stats_t ulsch_rate_unmatching_stats; time_stats_t ulsch_rate_unmatching_stats;
time_stats_t ulsch_turbo_decoding_stats; time_stats_t ulsch_ldpc_decoding_stats;
time_stats_t ulsch_deinterleaving_stats; time_stats_t ulsch_deinterleaving_stats;
time_stats_t ulsch_demultiplexing_stats; time_stats_t ulsch_unscrambling_stats;
time_stats_t ulsch_channel_estimation_stats;
time_stats_t ulsch_channel_compensation_stats;
time_stats_t ulsch_rbs_extraction_stats;
time_stats_t ulsch_llr_stats; time_stats_t ulsch_llr_stats;
/*
time_stats_t rx_dft_stats;
time_stats_t ulsch_freq_offset_estimation_stats;
*/ */
} PHY_VARS_gNB; } PHY_VARS_gNB;
#endif #endif
...@@ -46,6 +46,5 @@ void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot, ...@@ -46,6 +46,5 @@ void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu); uint8_t *sdu);
void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t harq_pid);
void nr_fill_crc_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t crc_flag); void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t harq_pid, uint8_t crc_flag);
...@@ -136,3 +136,4 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot, ...@@ -136,3 +136,4 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
} }
...@@ -244,16 +244,18 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -244,16 +244,18 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
//------------------- ULSCH unscrambling ------------------- //------------------- ULSCH unscrambling -------------------
//---------------------------------------------------------- //----------------------------------------------------------
start_meas(&gNB->ulsch_unscrambling_stats);
nr_ulsch_unscrambling(gNB->pusch_vars[ULSCH_id]->llr, nr_ulsch_unscrambling(gNB->pusch_vars[ULSCH_id]->llr,
G, G,
0, 0,
pusch_pdu->data_scrambling_id, pusch_pdu->data_scrambling_id,
pusch_pdu->rnti); pusch_pdu->rnti);
stop_meas(&gNB->ulsch_unscrambling_stats);
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- ULSCH decoding --------------------- //--------------------- ULSCH decoding ---------------------
//---------------------------------------------------------- //----------------------------------------------------------
start_meas(&gNB->ulsch_decoding_stats);
ret = nr_ulsch_decoding(gNB, ret = nr_ulsch_decoding(gNB,
ULSCH_id, ULSCH_id,
gNB->pusch_vars[ULSCH_id]->llr, gNB->pusch_vars[ULSCH_id]->llr,
...@@ -263,56 +265,30 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -263,56 +265,30 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
slot_rx, slot_rx,
harq_pid, harq_pid,
G); G);
stop_meas(&gNB->ulsch_decoding_stats);
if (ret > gNB->ulsch[ULSCH_id][0]->max_ldpc_iterations) if (ret > gNB->ulsch[ULSCH_id][0]->max_ldpc_iterations){
LOG_I(PHY, "ULSCH %d in error\n",ULSCH_id); LOG_I(PHY, "ULSCH %d in error\n",ULSCH_id);
//gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1);
}
else if(gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->b!=NULL){ else if(gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->b!=NULL){
LOG_I(PHY, "ULSCH received ok \n"); LOG_I(PHY, "ULSCH received ok \n");
if(IS_SOFTMODEM_NOS1){ //&& gNB->ulsch[ULSCH_id][0]->rnti == 0x1234 nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 0);
nr_fill_crc_indication(gNB,frame_rx, slot_rx, ULSCH_id, 0);
nr_fill_rx_indication(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid);
}
} }
} }
void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid) void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag) {
{
// --------------------
// [hna] TO BE CLEANED
// --------------------
nfapi_rx_indication_pdu_t *pdu; pthread_mutex_lock(&gNB->UL_INFO_mutex);
int timing_advance_update; int timing_advance_update, cqi;
int sync_pos; int sync_pos;
uint16_t mu = gNB->frame_parms.numerology_index; uint16_t mu = gNB->frame_parms.numerology_index;
// pthread_mutex_lock(&gNB->UL_INFO_mutex);
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
pthread_mutex_lock(&gNB->UL_INFO_mutex); nfapi_nr_pusch_pdu_t *pusch_pdu = &harq_process->ulsch_pdu;
gNB->UL_INFO.rx_ind.sfn_sf = frame<<4| slot_rx;
gNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list->rx_indication_rel8.length = gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->TBS;
pdu = &gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
//pdu->rx_ue_information.handle = gNB->ulsch[ULSCH_id+1][0]->handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = gNB->ulsch[ULSCH_id][0]->rnti;
pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation
pdu->data = harq_process->b;//gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b;
// estimate timing advance for MAC
sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id);
timing_advance_update = sync_pos; // - gNB->frame_parms.nb_prefix_samples/4; //to check
// printf("\x1B[33m" "timing_advance_update = %d\n" "\x1B[0m", timing_advance_update);
// pdu->data = gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b; // pdu->data = gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b;
sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id); // estimate timing advance for MAC sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id); // estimate timing advance for MAC
...@@ -336,39 +312,50 @@ void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_ ...@@ -336,39 +312,50 @@ void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_
LOG_D(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update); LOG_D(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update);
pdu->rx_indication_rel8.timing_advance = timing_advance_update;
// estimate UL_CQI for MAC (from antenna port 0 only) // estimate UL_CQI for MAC (from antenna port 0 only)
int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - 300;//(10*gNB->measurements.n0_power_dB[0]); int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - 300;//(10*gNB->measurements.n0_power_dB[0]);
if (SNRtimes10 < -640) pdu->rx_indication_rel8.ul_cqi=0; if (SNRtimes10 < -640) cqi=0;
else if (SNRtimes10 > 635) pdu->rx_indication_rel8.ul_cqi=255; else if (SNRtimes10 > 635) cqi=255;
else pdu->rx_indication_rel8.ul_cqi=(640+SNRtimes10)/5; else cqi=(640+SNRtimes10)/5;
// LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d), timing_advance %d (update %d)\n", // crc indication
// harq_pid,frame,slot_rx,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,pdu->rx_indication_rel8.timing_advance, uint16_t num_crc = gNB->UL_INFO.crc_ind.number_crcs;
// timing_advance_update); gNB->UL_INFO.crc_ind.crc_list = &gNB->crc_pdu_list[0];
gNB->UL_INFO.crc_ind.sfn = frame;
gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++; gNB->UL_INFO.crc_ind.slot = slot_rx;
gNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | slot_rx;
gNB->crc_pdu_list[num_crc].handle = pusch_pdu->handle;
gNB->crc_pdu_list[num_crc].rnti = pusch_pdu->rnti;
gNB->crc_pdu_list[num_crc].harq_id = harq_pid;
gNB->crc_pdu_list[num_crc].tb_crc_status = crc_flag;
gNB->crc_pdu_list[num_crc].num_cb = pusch_pdu->pusch_data.num_cb;
gNB->crc_pdu_list[num_crc].ul_cqi = cqi;
gNB->crc_pdu_list[num_crc].timing_advance = timing_advance_update;
gNB->crc_pdu_list[num_crc].rssi = 0xffff; // invalid value as this is not yet computed
gNB->UL_INFO.crc_ind.number_crcs++;
// rx indication
uint16_t num_rx = gNB->UL_INFO.rx_ind.number_of_pdus;
gNB->UL_INFO.rx_ind.pdu_list = &gNB->rx_pdu_list[0];
gNB->UL_INFO.rx_ind.sfn = frame;
gNB->UL_INFO.rx_ind.slot = slot_rx;
gNB->rx_pdu_list[num_rx].handle = pusch_pdu->handle;
gNB->rx_pdu_list[num_rx].rnti = pusch_pdu->rnti;
gNB->rx_pdu_list[num_rx].harq_id = harq_pid;
gNB->rx_pdu_list[num_rx].ul_cqi = cqi;
gNB->rx_pdu_list[num_rx].timing_advance = timing_advance_update;
gNB->rx_pdu_list[num_rx].rssi = 0xffff; // invalid value as this is not yet computed
if (crc_flag)
gNB->rx_pdu_list[num_rx].pdu_length = 0;
else {
gNB->rx_pdu_list[num_rx].pdu_length = harq_process->TBS;
gNB->rx_pdu_list[num_rx].pdu = harq_process->b;
}
pthread_mutex_unlock(&gNB->UL_INFO_mutex); gNB->UL_INFO.rx_ind.number_of_pdus++;
}
void nr_fill_crc_indication (PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t crc_flag) {
pthread_mutex_lock(&gNB->UL_INFO_mutex);
nfapi_crc_indication_pdu_t *pdu = &gNB->UL_INFO. crc_ind.crc_indication_body.crc_pdu_list[gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
gNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | slot_rx;
gNB->UL_INFO.crc_ind.header.message_id = NFAPI_CRC_INDICATION;
gNB->UL_INFO.crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
pdu->instance_length = 0; // don't know what to do with this
// pdu->rx_ue_information.handle = handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = gNB->ulsch[ULSCH_id][0]->rnti;
pdu->crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
pdu->crc_indication_rel8.crc_flag = crc_flag;
gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs++;
//LOG_D(PHY, "%s() rnti:%04x crcs:%d crc_flag:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, crc_flag);
pthread_mutex_unlock(&gNB->UL_INFO_mutex); pthread_mutex_unlock(&gNB->UL_INFO_mutex);
} }
...@@ -421,8 +408,6 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -421,8 +408,6 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1); //LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1);
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1); //LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1);
nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid); nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid);
nr_fill_rx_indication(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid); // indicate SDU to MAC
nr_fill_crc_indication(gNB, frame_rx, slot_rx, ULSCH_id, 0);
break; break;
} }
} }
......
...@@ -411,6 +411,7 @@ int main(int argc, char **argv) ...@@ -411,6 +411,7 @@ int main(int argc, char **argv)
printf("-c Start symbol for PDSCH (fixed for now)\n"); printf("-c Start symbol for PDSCH (fixed for now)\n");
printf("-j Number of symbols for PDSCH (fixed for now)\n"); printf("-j Number of symbols for PDSCH (fixed for now)\n");
printf("-e MSC index\n"); printf("-e MSC index\n");
printf("-P Print DLSCH performances\n");
exit (-1); exit (-1);
break; break;
} }
...@@ -900,7 +901,6 @@ int main(int argc, char **argv) ...@@ -900,7 +901,6 @@ int main(int argc, char **argv)
break; break;
} }
if (print_perf==1) { if (print_perf==1) {
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))\n", printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))\n",
1000>>*scc->ssbSubcarrierSpacing,dlsch_config.rbSize,dlsch_config.mcsIndex[0], 1000>>*scc->ssbSubcarrierSpacing,dlsch_config.rbSize,dlsch_config.mcsIndex[0],
......
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
#include "SIMULATION/LTE_PHY/common_sim.h"
//#define DEBUG_ULSIM //#define DEBUG_ULSIM
...@@ -143,7 +145,7 @@ int main(int argc, char **argv) ...@@ -143,7 +145,7 @@ int main(int argc, char **argv)
int start_rb = 0; int start_rb = 0;
int UE_id =0; // [hna] only works for UE_id = 0 because NUMBER_OF_NR_UE_MAX is set to 1 (phy_init_nr_gNB causes segmentation fault) int UE_id =0; // [hna] only works for UE_id = 0 because NUMBER_OF_NR_UE_MAX is set to 1 (phy_init_nr_gNB causes segmentation fault)
float target_error_rate = 0.01; float target_error_rate = 0.01;
int print_perf = 0;
cpuf = get_cpu_freq_GHz(); cpuf = get_cpu_freq_GHz();
...@@ -158,7 +160,7 @@ int main(int argc, char **argv) ...@@ -158,7 +160,7 @@ int main(int argc, char **argv)
//logInit(); //logInit();
randominit(0); randominit(0);
while ((c = getopt(argc, argv, "d:f:g:h:i:j:l:m:n:p:r:s:y:z:F:M:N:P:R:S:L:")) != -1) { while ((c = getopt(argc, argv, "d:f:g:h:i:j:l:m:n:p:r:s:y:z:F:M:N:PR:S:L:")) != -1) {
switch (c) { switch (c) {
/*case 'd': /*case 'd':
...@@ -312,6 +314,11 @@ int main(int argc, char **argv) ...@@ -312,6 +314,11 @@ int main(int argc, char **argv)
printf("Setting SNR1 to %f\n", snr1); printf("Setting SNR1 to %f\n", snr1);
break; break;
case 'P':
print_perf=1;
opp_enabled=1;
break;
case 'L': case 'L':
loglvl = atoi(optarg); loglvl = atoi(optarg);
break; break;
...@@ -343,6 +350,7 @@ int main(int argc, char **argv) ...@@ -343,6 +350,7 @@ int main(int argc, char **argv)
printf("-O oversampling factor (1,2,4,8,16)\n"); printf("-O oversampling factor (1,2,4,8,16)\n");
printf("-R N_RB_DL\n"); printf("-R N_RB_DL\n");
printf("-S Ending SNR, runs from SNR0 to SNR1\n"); printf("-S Ending SNR, runs from SNR0 to SNR1\n");
printf("-P Print ULSCH performances\n");
exit(-1); exit(-1);
break; break;
} }
...@@ -374,10 +382,10 @@ int main(int argc, char **argv) ...@@ -374,10 +382,10 @@ int main(int argc, char **argv)
//gNB_config = &gNB->gNB_config; //gNB_config = &gNB->gNB_config;
//memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO)); //memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO));
gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list = (nfapi_rx_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_rx_indication_pdu_t)); gNB->UL_INFO.rx_ind.pdu_list = (nfapi_nr_rx_data_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_nr_rx_data_pdu_t));
gNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list = (nfapi_crc_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_crc_indication_pdu_t)); gNB->UL_INFO.crc_ind.crc_list = (nfapi_nr_crc_t *)malloc(NB_UE_INST*sizeof(nfapi_nr_crc_t));
gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus = 0; gNB->UL_INFO.rx_ind.number_of_pdus = 0;
gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs = 0; gNB->UL_INFO.crc_ind.number_crcs = 0;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx; frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx; frame_parms->nb_antennas_rx = n_rx;
...@@ -523,6 +531,18 @@ int main(int argc, char **argv) ...@@ -523,6 +531,18 @@ int main(int argc, char **argv)
for (SNR = snr0; SNR < snr1; SNR += snr_step) { for (SNR = snr0; SNR < snr1; SNR += snr_step) {
varArray_t *table_rx=initVarArray(1000,sizeof(double));
reset_meas(&gNB->phy_proc_rx);
reset_meas(&gNB->ulsch_decoding_stats);
reset_meas(&gNB->ulsch_deinterleaving_stats);
reset_meas(&gNB->ulsch_rate_unmatching_stats);
reset_meas(&gNB->ulsch_ldpc_decoding_stats);
reset_meas(&gNB->ulsch_unscrambling_stats);
reset_meas(&gNB->ulsch_channel_estimation_stats);
reset_meas(&gNB->ulsch_llr_stats);
reset_meas(&gNB->ulsch_channel_compensation_stats);
reset_meas(&gNB->ulsch_rbs_extraction_stats);
UE_proc.nr_tti_tx = slot; UE_proc.nr_tti_tx = slot;
UE_proc.frame_tx = frame; UE_proc.frame_tx = frame;
...@@ -652,15 +672,17 @@ int main(int argc, char **argv) ...@@ -652,15 +672,17 @@ int main(int argc, char **argv)
//---------------------------------------------------------- //----------------------------------------------------------
//------------------- gNB phy procedures ------------------- //------------------- gNB phy procedures -------------------
//---------------------------------------------------------- //----------------------------------------------------------
gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus = 0; gNB->UL_INFO.rx_ind.number_of_pdus = 0;
gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs = 0; gNB->UL_INFO.crc_ind.number_crcs = 0;
start_meas(&gNB->phy_proc_rx);
phy_procedures_gNB_common_RX(gNB, frame, slot); phy_procedures_gNB_common_RX(gNB, frame, slot);
if (n_trials==1) if (n_trials==1)
LOG_M("rxsigF0.m","rxsF0",gNB->common_vars.rxdataF[0],frame_length_complex_samples_no_prefix,1,1); LOG_M("rxsigF0.m","rxsF0",gNB->common_vars.rxdataF[0],frame_length_complex_samples_no_prefix,1,1);
phy_procedures_gNB_uespec_RX(gNB, frame, slot); phy_procedures_gNB_uespec_RX(gNB, frame, slot);
start_meas(&gNB->phy_proc_rx);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
if (gNB->ulsch[0][0]->last_iteration_cnt >= if (gNB->ulsch[0][0]->last_iteration_cnt >=
...@@ -714,6 +736,20 @@ int main(int argc, char **argv) ...@@ -714,6 +736,20 @@ int main(int argc, char **argv)
printf("*****************************************\n"); printf("*****************************************\n");
printf("\n"); printf("\n");
if (print_perf==1) {
printDistribution(&gNB->phy_proc_rx,table_rx,"Total PHY proc rx");
printStatIndent(&gNB->ulsch_channel_estimation_stats,"ULSCH channel estimation time");
printStatIndent(&gNB->ulsch_rbs_extraction_stats,"ULSCH rbs extraction time");
printStatIndent(&gNB->ulsch_channel_compensation_stats,"ULSCH channel compensation time");
printStatIndent(&gNB->ulsch_llr_stats,"ULSCH llr computation");
printStatIndent(&gNB->ulsch_unscrambling_stats,"ULSCH unscrambling");
printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time");
printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving");
printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx");
printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding");
printf("\n");
}
if(n_trials==1) if(n_trials==1)
break; break;
......
...@@ -261,7 +261,7 @@ void nr_process_mac_pdu( ...@@ -261,7 +261,7 @@ void nr_process_mac_pdu(
void nr_rx_sdu(const module_id_t gnb_mod_idP, void nr_rx_sdu(const module_id_t gnb_mod_idP,
const int CC_idP, const int CC_idP,
const frame_t frameP, const frame_t frameP,
const sub_frame_t subframeP, const sub_frame_t slotP,
const rnti_t rntiP, const rnti_t rntiP,
uint8_t *sduP, uint8_t *sduP,
const uint16_t sdu_lenP, const uint16_t sdu_lenP,
...@@ -285,7 +285,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -285,7 +285,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
harq_pid, harq_pid,
CC_idP, CC_idP,
frameP, frameP,
subframeP, slotP,
UE_scheduling_control->round_UL[CC_idP][harq_pid], UE_scheduling_control->round_UL[CC_idP][harq_pid],
current_rnti, current_rnti,
UE_id, UE_id,
......
...@@ -59,7 +59,6 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { ...@@ -59,7 +59,6 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) {
UL_info->rach_ind.number_of_pdus=0; UL_info->rach_ind.number_of_pdus=0;
LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot); LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot);
if (UL_info->rach_ind.pdu_list[0].num_preamble>0) if (UL_info->rach_ind.pdu_list[0].num_preamble>0)
AssertFatal(UL_info->rach_ind.pdu_list[0].num_preamble==1, AssertFatal(UL_info->rach_ind.pdu_list[0].num_preamble==1,
"More than 1 preamble not supported\n"); "More than 1 preamble not supported\n");
...@@ -76,10 +75,11 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { ...@@ -76,10 +75,11 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) {
} }
} }
void handle_nr_sr(NR_UL_IND_t *UL_info) { void handle_nr_sr(NR_UL_IND_t *UL_info) {
if (nfapi_mode == 1) // PNF /* if (nfapi_mode == 1) // PNF
{ {
if (UL_info->sr_ind.sr_indication_body.number_of_srs>0) if (UL_info->sr_ind.sr_indication_body.number_of_srs>0)
{ {
...@@ -89,20 +89,20 @@ void handle_nr_sr(NR_UL_IND_t *UL_info) { ...@@ -89,20 +89,20 @@ void handle_nr_sr(NR_UL_IND_t *UL_info) {
else else
{ {
/*
for (int i=0;i<UL_info->sr_ind.sr_indication_body.number_of_srs;i++) for (int i=0;i<UL_info->sr_ind.sr_indication_body.number_of_srs;i++)
SR_indication(UL_info->module_id, SR_indication(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
UL_info->frame, UL_info->frame,
UL_info->slot, UL_info->slot,
UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].rx_ue_information.rnti, UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].rx_ue_information.rnti,
UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].ul_cqi_information.ul_cqi);*/ UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].ul_cqi_information.ul_cqi);
} }
UL_info->sr_ind.sr_indication_body.number_of_srs=0; UL_info->sr_ind.sr_indication_body.number_of_srs=0;*/
} }
void handle_nr_cqi(NR_UL_IND_t *UL_info) { void handle_nr_cqi(NR_UL_IND_t *UL_info) {
...@@ -117,103 +117,99 @@ void handle_nr_cqi(NR_UL_IND_t *UL_info) { ...@@ -117,103 +117,99 @@ void handle_nr_cqi(NR_UL_IND_t *UL_info) {
&UL_info->cqi_ind.cqi_pdu_list[i].cqi_indication_rel9, &UL_info->cqi_ind.cqi_pdu_list[i].cqi_indication_rel9,
UL_info->cqi_ind.cqi_raw_pdu_list[i].pdu, UL_info->cqi_ind.cqi_raw_pdu_list[i].pdu,
&UL_info->cqi_ind.cqi_pdu_list[i].ul_cqi_information); &UL_info->cqi_ind.cqi_pdu_list[i].ul_cqi_information);
*/
UL_info->cqi_ind.number_of_cqis=0; UL_info->cqi_ind.number_of_cqis=0;*/
} }
void handle_nr_harq(NR_UL_IND_t *UL_info) { void handle_nr_harq(NR_UL_IND_t *UL_info) {
if (nfapi_mode == 1 && UL_info->harq_ind.harq_indication_body.number_of_harqs>0) { // PNF /* if (nfapi_mode == 1 && UL_info->harq_ind.harq_indication_body.number_of_harqs>0) { // PNF
//LOG_D(PHY, "UL_info->harq_ind.harq_indication_body.number_of_harqs:%d Send to VNF\n", UL_info->harq_ind.harq_indication_body.number_of_harqs); //LOG_D(PHY, "UL_info->harq_ind.harq_indication_body.number_of_harqs:%d Send to VNF\n", UL_info->harq_ind.harq_indication_body.number_of_harqs);
/* int retval = oai_nfapi_harq_indication(&UL_info->harq_ind); int retval = oai_nfapi_harq_indication(&UL_info->harq_ind);
if (retval!=0) { if (retval!=0) {
LOG_E(PHY, "Failed to encode NFAPI HARQ_IND retval:%d\n", retval); LOG_E(PHY, "Failed to encode NFAPI HARQ_IND retval:%d\n", retval);
} }
*/
UL_info->harq_ind.harq_indication_body.number_of_harqs = 0; UL_info->harq_ind.harq_indication_body.number_of_harqs = 0;
} }
else else
{ {
/*
for (int i=0;i<UL_info->harq_ind.harq_indication_body.number_of_harqs;i++) for (int i=0;i<UL_info->harq_ind.harq_indication_body.number_of_harqs;i++)
harq_indication(UL_info->module_id, harq_indication(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->harq_ind.sfn_sf), NFAPI_SFNSF2SFN(UL_info->harq_ind.sfn_sf),
NFAPI_SFNSF2SF(UL_info->harq_ind.sfn_sf), NFAPI_SFNSF2SF(UL_info->harq_ind.sfn_sf),
&UL_info->harq_ind.harq_indication_body.harq_pdu_list[i]); &UL_info->harq_ind.harq_indication_body.harq_pdu_list[i]);
*/
UL_info->harq_ind.harq_indication_body.number_of_harqs=0; UL_info->harq_ind.harq_indication_body.number_of_harqs=0;
} }*/
} }
void handle_nr_ulsch(NR_UL_IND_t *UL_info) { void handle_nr_ulsch(NR_UL_IND_t *UL_info) {
if(nfapi_mode == 1) { if(nfapi_mode == 1) {
if (UL_info->crc_ind.crc_indication_body.number_of_crcs>0) { if (UL_info->crc_ind.number_crcs>0) {
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
// oai_nfapi_crc_indication(&UL_info->crc_ind); // oai_nfapi_crc_indication(&UL_info->crc_ind);
UL_info->crc_ind.crc_indication_body.number_of_crcs = 0; UL_info->crc_ind.number_crcs = 0;
} }
if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0) { if (UL_info->rx_ind.number_of_pdus>0) {
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
// oai_nfapi_rx_ind(&UL_info->rx_ind); // oai_nfapi_rx_ind(&UL_info->rx_ind);
UL_info->rx_ind.rx_indication_body.number_of_pdus = 0; UL_info->rx_ind.number_of_pdus = 0;
} }
} else { } else {
if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) { if (UL_info->rx_ind.number_of_pdus>0 && UL_info->crc_ind.number_crcs>0) {
for (int i=0; i<UL_info->rx_ind.rx_indication_body.number_of_pdus; i++) { for (int i=0; i<UL_info->rx_ind.number_of_pdus; i++) {
for (int j=0; j<UL_info->crc_ind.crc_indication_body.number_of_crcs; j++) { for (int j=0; j<UL_info->crc_ind.number_crcs; j++) {
// find crc_indication j corresponding rx_indication i // find crc_indication j corresponding rx_indication i
LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n", j, LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n", j,
UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti, i, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti); UL_info->crc_ind.crc_list[j].rnti, i, UL_info->rx_ind.pdu_list[i].rnti);
if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti == if (UL_info->crc_ind.crc_list[j].rnti ==
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti) { UL_info->rx_ind.pdu_list[i].rnti) {
LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag); LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_list[j].tb_crc_status);
if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag == 1) { // CRC error indication if (UL_info->crc_ind.crc_list[j].tb_crc_status == 1) { // CRC error indication
LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->slot); LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->slot);
nr_rx_sdu(UL_info->module_id, nr_rx_sdu(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame, UL_info->rx_ind.sfn, //UL_info->frame,
NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->slot, UL_info->rx_ind.slot, //UL_info->slot,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti, UL_info->rx_ind.pdu_list[i].rnti,
(uint8_t *)NULL, (uint8_t *)NULL,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length, UL_info->rx_ind.pdu_list[i].pdu_length,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance, UL_info->rx_ind.pdu_list[i].timing_advance,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi); UL_info->rx_ind.pdu_list[i].ul_cqi);
} else { } else {
LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->slot); LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->slot);
nr_rx_sdu(UL_info->module_id, nr_rx_sdu(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame, UL_info->rx_ind.sfn, //UL_info->frame,
NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->slot, UL_info->rx_ind.slot, //UL_info->slot,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti, UL_info->rx_ind.pdu_list[i].rnti,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].data, UL_info->rx_ind.pdu_list[i].pdu,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length, UL_info->rx_ind.pdu_list[i].pdu_length,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance, UL_info->rx_ind.pdu_list[i].timing_advance,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi); UL_info->rx_ind.pdu_list[i].ul_cqi);
} }
//printf("rx_indication_rel8.timing_advance %d\n", UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance);
break; break;
} //if (UL_info->crc_ind.crc_pdu_list[j].rx_ue_information.rnti == }
} // for (j=0;j<UL_info->crc_ind.number_crcs;j++)
// UL_info->rx_ind.rx_pdu_list[i].rx_ue_information.rnti)
} // for (j=0;j<UL_info->crc_ind.crc_indication_body.number_of_crcs;j++)
} // for (i=0;i<UL_info->rx_ind.number_of_pdus;i++) } // for (i=0;i<UL_info->rx_ind.number_of_pdus;i++)
UL_info->crc_ind.crc_indication_body.number_of_crcs=0; UL_info->crc_ind.number_crcs=0;
UL_info->rx_ind.rx_indication_body.number_of_pdus = 0; UL_info->rx_ind.number_of_pdus = 0;
} // UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->slot && UL_info->crc_ind.crc_indication_body.number_of_crcs>0 }
else if (UL_info->rx_ind.rx_indication_body.number_of_pdus!=0 || UL_info->crc_ind.crc_indication_body.number_of_crcs!=0) { else if (UL_info->rx_ind.number_of_pdus!=0 || UL_info->crc_ind.number_crcs!=0) {
LOG_E(PHY,"hoping not to have mis-match between CRC ind and RX ind - hopefully the missing message is coming shortly rx_ind:%d(SFN/SF:%05d) crc_ind:%d(SFN/SF:%05d) UL_info(SFN/SF):%04d%d\n", LOG_E(PHY,"hoping not to have mis-match between CRC ind and RX ind - hopefully the missing message is coming shortly rx_ind:%d(SFN/SL:%d/%d) crc_ind:%d(SFN/SL:%d/%d) \n",
UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf), UL_info->rx_ind.number_of_pdus, UL_info->rx_ind.sfn, UL_info->rx_ind.slot,
UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf), UL_info->crc_ind.number_crcs, UL_info->rx_ind.sfn, UL_info->rx_ind.slot);
UL_info->frame, UL_info->slot);
} }
} }
} }
...@@ -228,11 +224,11 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { ...@@ -228,11 +224,11 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
NR_Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id]; NR_Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id];
NR_IF_Module_t *ifi = if_inst[module_id]; NR_IF_Module_t *ifi = if_inst[module_id];
gNB_MAC_INST *mac = RC.nrmac[module_id]; gNB_MAC_INST *mac = RC.nrmac[module_id];
LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d rach_pdus:%d sr_ind:%d]\n",
LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rach_pdus:%d rx_ind:%d crcs:%d]\n",
UL_info->frame,UL_info->slot, UL_info->frame,UL_info->slot,
module_id,CC_id, module_id,CC_id, UL_info->rach_ind.number_of_pdus,
UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis, UL_info->rx_ind.number_of_pdus, UL_info->crc_ind.number_crcs);
UL_info->rach_ind.number_of_pdus, UL_info->sr_ind.sr_indication_body.number_of_srs);
if (nfapi_mode != 1) { if (nfapi_mode != 1) {
if (ifi->CC_mask==0) { if (ifi->CC_mask==0) {
......
...@@ -61,26 +61,20 @@ typedef struct { ...@@ -61,26 +61,20 @@ typedef struct {
/// slot /// slot
slot_t slot; slot_t slot;
/// harq indication list
nfapi_harq_indication_t harq_ind;
/// crc indication list /// crc indication list
nfapi_crc_indication_t crc_ind; nfapi_nr_crc_indication_t crc_ind;
/// SR indication list
nfapi_sr_indication_t sr_ind;
/// CQI indication list
nfapi_cqi_indication_body_t cqi_ind;
/// RACH indication list /// RACH indication list
nfapi_nr_rach_indication_t rach_ind; nfapi_nr_rach_indication_t rach_ind;
/// SRS indication list /// SRS indication list
nfapi_srs_indication_body_t srs_ind; nfapi_nr_srs_indication_t srs_ind;
/// RX indication /// RX indication
nfapi_rx_indication_t rx_ind; nfapi_nr_rx_data_indication_t rx_ind;
/// UCI indication
nfapi_nr_uci_indication_t uci_ind;
} NR_UL_IND_t; } NR_UL_IND_t;
......
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