Commit 90266524 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Merge branch 'NR_UL_scheduling' of...

Merge branch 'NR_UL_scheduling' of https://gitlab.eurecom.fr/oai/openairinterface5g into NR_UL_scheduling
parents 0c1c2edd 37dcdeb3
...@@ -83,6 +83,10 @@ nullPointer:common/utils/T/tracer/multi.c:265 ...@@ -83,6 +83,10 @@ nullPointer:common/utils/T/tracer/multi.c:265
// the tests // the tests
arrayIndexOutOfBounds:openair2/LAYER2/rlc_v2/tests/test.c:401 arrayIndexOutOfBounds:openair2/LAYER2/rlc_v2/tests/test.c:401
// //
//-----------------------------------------------------------------------------
// cppcheck does not understand the different lengths of arrays
arrayIndexOutOfBounds:openair1/SIMULATION/TOOLS/random_channel.c:705
arrayIndexOutOfBounds:openair1/SIMULATION/TOOLS/random_channel.c:706
//***************************************************************************** //*****************************************************************************
// //
// True problems we don't know how to fix, Suppression is commented out, // True problems we don't know how to fix, Suppression is commented out,
......
...@@ -3132,7 +3132,7 @@ if (${T_TRACER}) ...@@ -3132,7 +3132,7 @@ if (${T_TRACER})
SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
L2 L2_LTE L2_NR L2_UE NR_L2_UE MAC_NR_COMMON MAC_NR MAC_UE_NR L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE MAC_NR_COMMON MAC_NR MAC_UE_NR
CN_UTILS GTPV1U NR_GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB CN_UTILS GTPV1U NR_GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts) ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts)
if (TARGET ${i}) if (TARGET ${i})
......
This diff is collapsed.
...@@ -69,27 +69,9 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB, ...@@ -69,27 +69,9 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
unsigned char *sdu); unsigned char *sdu);
uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch, uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
uint32_t ***pdsch_dmrs, int frame,
int32_t** txdataF, int slot);
int16_t amp,
int frame,
uint8_t slot,
NR_DL_FRAME_PARMS *frame_parms,
int xOverhead,
time_stats_t *dlsch_encoding_stats,
time_stats_t *dlsch_scrambling_stats,
time_stats_t *dlsch_modulation_stats,
time_stats_t *tinput,
time_stats_t *tprep,
time_stats_t *tparity,
time_stats_t *toutput,
time_stats_t *dlsch_rate_matching_stats,
time_stats_t *dlsch_interleaving_stats,
time_stats_t *dlsch_segmentation_stats);
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB); void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
...@@ -98,6 +80,8 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch); ...@@ -98,6 +80,8 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch);
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type); int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
NR_gNB_SCH_STATS_t *find_nr_dlsch_stats(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
int nr_dlsch_encoding(unsigned char *a,int frame, int nr_dlsch_encoding(unsigned char *a,int frame,
uint8_t slot, uint8_t slot,
NR_gNB_DLSCH_t *dlsch, NR_gNB_DLSCH_t *dlsch,
...@@ -113,4 +97,8 @@ int nr_dlsch_encoding(unsigned char *a,int frame, ...@@ -113,4 +97,8 @@ int nr_dlsch_encoding(unsigned char *a,int frame,
void nr_emulate_dlsch_payload(uint8_t* payload, uint16_t size); void nr_emulate_dlsch_payload(uint8_t* payload, uint16_t size);
void dump_pdsch_stats(PHY_VARS_gNB *gNB);
void clear_pdsch_stats(PHY_VARS_gNB *gNB);
#endif #endif
...@@ -354,6 +354,13 @@ int nr_dlsch_encoding(unsigned char *a, ...@@ -354,6 +354,13 @@ int nr_dlsch_encoding(unsigned char *a,
A = rel15->TBSize[0]<<3; A = rel15->TBSize[0]<<3;
if (dlsch->harq_processes[harq_pid]->round == 0){
dlsch->stats.total_bytes_tx += rel15->TBSize[0];
dlsch->stats.current_RI = rel15->nrOfLayers;
dlsch->stats.current_Qm = rel15->qamModOrder[0];
}
dlsch->stats.round_trials[dlsch->harq_processes[harq_pid]->round]++;
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers); G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers);
LOG_D(PHY,"dlsch coding A %d G %d mod_order %d\n", A,G, mod_order); LOG_D(PHY,"dlsch coding A %d G %d mod_order %d\n", A,G, mod_order);
......
...@@ -255,27 +255,28 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) { ...@@ -255,27 +255,28 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) {
} }
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) { int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
uint16_t i; uint16_t i;
int16_t first_free_index=-1; int16_t first_free_index=-1;
AssertFatal(gNB!=NULL,"gNB is null\n"); AssertFatal(gNB!=NULL,"gNB is null\n");
for (i=0; i<NUMBER_OF_NR_DLSCH_MAX; i++) { for (i=0; i<NUMBER_OF_NR_DLSCH_MAX; i++) {
AssertFatal(gNB->dlsch[i]!=NULL,"gNB->dlsch[%d] is null\n",i); AssertFatal(gNB->dlsch[i]!=NULL,"gNB->dlsch[%d] is null\n",i);
AssertFatal(gNB->dlsch[i][0]!=NULL,"gNB->dlsch[%d][0] is null\n",i); AssertFatal(gNB->dlsch[i][0]!=NULL,"gNB->dlsch[%d][0] is null\n",i);
LOG_D(PHY,"searching for rnti %x : dlsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->dlsch[i][0]->harq_mask,gNB->dlsch[i][0]->rnti,first_free_index); LOG_D(PHY,"searching for rnti %x : dlsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,
if ((gNB->dlsch[i][0]->harq_mask >0) && gNB->dlsch[i][0]->harq_mask,gNB->dlsch[i][0]->rnti,first_free_index);
(gNB->dlsch[i][0]->rnti==rnti)) return i; if ((gNB->dlsch[i][0]->harq_mask >0) &&
else if ((gNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; (gNB->dlsch[i][0]->rnti==rnti)) return i;
} else if ((gNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
if (type == SEARCH_EXIST) return -1; }
if (first_free_index != -1) if (type == SEARCH_EXIST) return -1;
gNB->dlsch[first_free_index][0]->rnti = 0; if (first_free_index != -1)
return first_free_index; gNB->dlsch[first_free_index][0]->rnti = 0;
return first_free_index;
} }
void nr_fill_dlsch(PHY_VARS_gNB *gNB, void nr_fill_dlsch(PHY_VARS_gNB *gNB,
int frame, int frame,
int slot, int slot,
......
...@@ -137,3 +137,33 @@ void nr_ulsch_unscrambling_optim(int16_t* llr, ...@@ -137,3 +137,33 @@ void nr_ulsch_unscrambling_optim(int16_t* llr,
n_RNTI); n_RNTI);
#endif #endif
} }
void dump_pusch_stats(PHY_VARS_gNB *gNB) {
for (int i=0;i<NUMBER_OF_NR_ULSCH_MAX;i++)
if (gNB->ulsch[i][0]->rnti>0)
LOG_I(PHY,"ULSCH RNTI %x: round_trials %d(%1.1e)/%d(%1.1e)/%d(%1.1e)/%d/%d/%d/%d/%d, current_Qm %d, current_RI %d, total_bytes RX/TX %d/%d\n",
gNB->ulsch[i][0]->rnti,
gNB->ulsch[i][0]->stats.round_trials[0],
(double)gNB->ulsch[i][0]->stats.round_trials[1]/gNB->ulsch[i][0]->stats.round_trials[0],
gNB->ulsch[i][0]->stats.round_trials[1],
(double)gNB->ulsch[i][0]->stats.round_trials[2]/gNB->ulsch[i][0]->stats.round_trials[1],
gNB->ulsch[i][0]->stats.round_trials[2],
(double)gNB->ulsch[i][0]->stats.round_trials[3]/gNB->ulsch[i][0]->stats.round_trials[2],
gNB->ulsch[i][0]->stats.round_trials[3],
gNB->ulsch[i][0]->stats.round_trials[4],
gNB->ulsch[i][0]->stats.round_trials[5],
gNB->ulsch[i][0]->stats.round_trials[6],
gNB->ulsch[i][0]->stats.round_trials[7],
gNB->ulsch[i][0]->stats.current_Qm,
gNB->ulsch[i][0]->stats.current_RI,
gNB->ulsch[i][0]->stats.total_bytes_rx,
gNB->ulsch[i][0]->stats.total_bytes_tx);
}
void clear_pusch_stats(PHY_VARS_gNB *gNB) {
for (int i=0;i<NUMBER_OF_NR_ULSCH_MAX;i++)
memset((void*)&gNB->ulsch[i][0]->stats,0,sizeof(gNB->ulsch[i][0]->stats));
}
...@@ -87,3 +87,5 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, ...@@ -87,3 +87,5 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB,
int UE_id, int UE_id,
uint8_t harq_pid); uint8_t harq_pid);
int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type); int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
...@@ -208,8 +208,6 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch) ...@@ -208,8 +208,6 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch)
ulsch->Mlimit = 0; ulsch->Mlimit = 0;
ulsch->max_ldpc_iterations = 0; ulsch->max_ldpc_iterations = 0;
ulsch->last_iteration_cnt = 0; ulsch->last_iteration_cnt = 0;
ulsch->num_active_cba_groups = 0;
for (i=0;i<NUM_MAX_CBA_GROUP;i++) ulsch->cba_rnti[i] = 0;
for (i=0;i<NR_MAX_SLOTS_PER_FRAME;i++) ulsch->harq_process_id[i] = 0; for (i=0;i<NR_MAX_SLOTS_PER_FRAME;i++) ulsch->harq_process_id[i] = 0;
for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) { for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
...@@ -225,7 +223,6 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch) ...@@ -225,7 +223,6 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch)
ulsch->harq_processes[i]->rar_alloc=0; ulsch->harq_processes[i]->rar_alloc=0;
ulsch->harq_processes[i]->status=NR_SCH_IDLE; ulsch->harq_processes[i]->status=NR_SCH_IDLE;
ulsch->harq_processes[i]->subframe_scheduling_flag=0; ulsch->harq_processes[i]->subframe_scheduling_flag=0;
ulsch->harq_processes[i]->subframe_cba_scheduling_flag=0;
ulsch->harq_processes[i]->phich_active=0; ulsch->harq_processes[i]->phich_active=0;
ulsch->harq_processes[i]->phich_ACK=0; ulsch->harq_processes[i]->phich_ACK=0;
ulsch->harq_processes[i]->previous_first_rb=0; ulsch->harq_processes[i]->previous_first_rb=0;
...@@ -366,15 +363,14 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -366,15 +363,14 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers); LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers);
if (R<1024)
if (R<1024) Coderate = (float) R /(float) 1024;
Coderate = (float) R /(float) 1024; else
else Coderate = (float) R /(float) 2048;
Coderate = (float) R /(float) 2048;
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){ p_decParams->BG = 2;
p_decParams->BG = 2; if (Coderate < 0.3333) {
if (Coderate < 0.3333) {
p_decParams->R = 15; p_decParams->R = 15;
kc = 52; kc = 52;
} }
...@@ -401,8 +397,15 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -401,8 +397,15 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
kc = 27; kc = 27;
} }
} }
ulsch->stats.round_trials[harq_process->round]++;
if (harq_process->round == 0) { if (harq_process->round == 0) {
ulsch->stats.current_Qm = Qm;
ulsch->stats.current_RI = n_layers;
ulsch->stats.total_bytes_tx += harq_process->TBS;
// This is a new packet, so compute quantities regarding segmentation // This is a new packet, so compute quantities regarding segmentation
if (A > 3824) if (A > 3824)
harq_process->B = A+24; harq_process->B = A+24;
...@@ -600,6 +603,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -600,6 +603,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
LOG_I(PHY, "Segment %d CRC OK\n",r); LOG_I(PHY, "Segment %d CRC OK\n",r);
#endif #endif
ret = no_iteration_ldpc; ret = no_iteration_ldpc;
ulsch->stats.total_bytes_rx += harq_process->TBS;
} else { } else {
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
//if (prnt_crc_cnt%10 == 0) //if (prnt_crc_cnt%10 == 0)
......
...@@ -1082,25 +1082,23 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, ...@@ -1082,25 +1082,23 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
ul_ch_mag128b[0][i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128b[aa][i],1),_mm_srai_epi16(ul_ch_mag128b[aa][i],1)); ul_ch_mag128b[0][i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128b[aa][i],1),_mm_srai_epi16(ul_ch_mag128b[aa][i],1));
// rxdataF_comp128[0][i] = _mm_add_epi16(rxdataF_comp128_0[i],(*(__m128i *)&jitterc[0])); // rxdataF_comp128[0][i] = _mm_add_epi16(rxdataF_comp128_0[i],(*(__m128i *)&jitterc[0]));
} }
}
#elif defined(__arm__) #elif defined(__arm__)
rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128_0 = (int16x8_t *)&ul_ch_mag[0][symbol*frame_parms->N_RB_DL*12]; ul_ch_mag128_0 = (int16x8_t *)&ul_ch_mag[0][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128_1 = (int16x8_t *)&ul_ch_mag[1][symbol*frame_parms->N_RB_DL*12]; ul_ch_mag128_1 = (int16x8_t *)&ul_ch_mag[1][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128_0b = (int16x8_t *)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12]; ul_ch_mag128_0b = (int16x8_t *)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128_1b = (int16x8_t *)&ul_ch_magb[1][symbol*frame_parms->N_RB_DL*12]; ul_ch_mag128_1b = (int16x8_t *)&ul_ch_magb[1][symbol*frame_parms->N_RB_DL*12];
// MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
for (i=0; i<nb_rb*3; i++) {
rxdataF_comp128_0[i] = vhaddq_s16(rxdataF_comp128_0[i],rxdataF_comp128_1[i]);
ul_ch_mag128_0[i] = vhaddq_s16(ul_ch_mag128_0[i],ul_ch_mag128_1[i]);
ul_ch_mag128_0b[i] = vhaddq_s16(ul_ch_mag128_0b[i],ul_ch_mag128_1b[i]);
rxdataF_comp128_0[i] = vqaddq_s16(rxdataF_comp128_0[i],(*(int16x8_t *)&jitterc[0]));
}
#endif // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
for (i=0; i<nb_rb*3; i++) {
rxdataF_comp128_0[i] = vhaddq_s16(rxdataF_comp128_0[i],rxdataF_comp128_1[i]);
ul_ch_mag128_0[i] = vhaddq_s16(ul_ch_mag128_0[i],ul_ch_mag128_1[i]);
ul_ch_mag128_0b[i] = vhaddq_s16(ul_ch_mag128_0b[i],ul_ch_mag128_1b[i]);
rxdataF_comp128_0[i] = vqaddq_s16(rxdataF_comp128_0[i],(*(int16x8_t *)&jitterc[0]));
} }
#endif
} }
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
......
...@@ -270,7 +270,6 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2) ...@@ -270,7 +270,6 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
if (k>= fp->ofdm_symbol_size) k-=fp->ofdm_symbol_size; if (k>= fp->ofdm_symbol_size) k-=fp->ofdm_symbol_size;
for (int i=0; i < LENGTH_PSS_NR; i++) { for (int i=0; i < LENGTH_PSS_NR; i++) {
synchroF_tmp[2*k] = primary_synchro[2*i]; synchroF_tmp[2*k] = primary_synchro[2*i];
synchroF_tmp[2*k+1] = primary_synchro[2*i+1]; synchroF_tmp[2*k+1] = primary_synchro[2*i+1];
......
...@@ -124,6 +124,14 @@ typedef struct { ...@@ -124,6 +124,14 @@ typedef struct {
nfapi_nr_ul_dci_request_pdus_t pdcch_pdu; nfapi_nr_ul_dci_request_pdus_t pdcch_pdu;
} NR_gNB_UL_PDCCH_t; } NR_gNB_UL_PDCCH_t;
typedef struct {
int round_trials[8];
int total_bytes_tx;
int total_bytes_rx;
int current_Qm;
int current_RI;
} NR_gNB_SCH_STATS_t;
typedef struct { typedef struct {
/// Pointers to 16 HARQ processes for the DLSCH /// Pointers to 16 HARQ processes for the DLSCH
NR_DL_gNB_HARQ_t *harq_processes[NR_MAX_NB_HARQ_PROCESSES]; NR_DL_gNB_HARQ_t *harq_processes[NR_MAX_NB_HARQ_PROCESSES];
...@@ -167,8 +175,12 @@ typedef struct { ...@@ -167,8 +175,12 @@ typedef struct {
int16_t sqrt_rho_a; int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots /// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b; int16_t sqrt_rho_b;
/// statistics for measurement collection
NR_gNB_SCH_STATS_t stats;
} NR_gNB_DLSCH_t; } NR_gNB_DLSCH_t;
typedef struct { typedef struct {
int frame; int frame;
int slot; int slot;
...@@ -345,10 +357,8 @@ typedef struct { ...@@ -345,10 +357,8 @@ typedef struct {
uint8_t max_ldpc_iterations; uint8_t max_ldpc_iterations;
/// number of iterations used in last LDPC decoding /// number of iterations used in last LDPC decoding
uint8_t last_iteration_cnt; uint8_t last_iteration_cnt;
/// num active cba group /// statistics for measurement collection
uint8_t num_active_cba_groups; NR_gNB_SCH_STATS_t stats;
/// num active cba group
uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
} NR_gNB_ULSCH_t; } NR_gNB_ULSCH_t;
typedef struct { typedef struct {
......
...@@ -194,20 +194,8 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -194,20 +194,8 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
for (int i=0; i<gNB->num_pdsch_rnti[slot]; i++) { for (int i=0; i<gNB->num_pdsch_rnti[slot]; i++) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", gNB->num_pdsch_rnti[slot],frame,slot); LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", gNB->num_pdsch_rnti[slot],frame,slot);
nr_generate_pdsch(gNB->dlsch[i][0], nr_generate_pdsch(gNB,frame, slot);
gNB->nr_gold_pdsch_dmrs[slot], if ((frame&127) == 0) dump_pdsch_stats(gNB);
gNB->common_vars.txdataF,
AMP, frame, slot, fp, 0,
&gNB->dlsch_encoding_stats,
&gNB->dlsch_scrambling_stats,
&gNB->dlsch_modulation_stats,
&gNB->tinput,
&gNB->tprep,
&gNB->tparity,
&gNB->toutput,
&gNB->dlsch_rate_matching_stats,
&gNB->dlsch_interleaving_stats,
&gNB->dlsch_segmentation_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
} }
...@@ -586,5 +574,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -586,5 +574,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
} }
} }
} }
if ((frame_rx&127) == 0) dump_pusch_stats(gNB);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,0);
} }
...@@ -181,7 +181,7 @@ int main(int argc, char **argv) ...@@ -181,7 +181,7 @@ int main(int argc, char **argv)
//unsigned char frame_type = 0; //unsigned char frame_type = 0;
int frame=0,slot=1; int frame=1,slot=1;
int frame_length_complex_samples; int frame_length_complex_samples;
int frame_length_complex_samples_no_prefix; int frame_length_complex_samples_no_prefix;
NR_DL_FRAME_PARMS *frame_parms; NR_DL_FRAME_PARMS *frame_parms;
...@@ -716,6 +716,8 @@ int main(int argc, char **argv) ...@@ -716,6 +716,8 @@ int main(int argc, char **argv)
reset_meas(&gNB->tparity); reset_meas(&gNB->tparity);
reset_meas(&gNB->toutput); reset_meas(&gNB->toutput);
clear_pdsch_stats(gNB);
n_errors = 0; n_errors = 0;
effRate = 0; effRate = 0;
//n_errors2 = 0; //n_errors2 = 0;
...@@ -956,6 +958,7 @@ int main(int argc, char **argv) ...@@ -956,6 +958,7 @@ int main(int argc, char **argv)
(float) n_errors / (float) n_trials); (float) n_errors / (float) n_trials);
printf("*****************************************\n"); printf("*****************************************\n");
printf("\n"); printf("\n");
dump_pdsch_stats(gNB);
printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],(double)errors_scrambling/available_bits/n_trials,effRate,effRate/TBS*100,TBS); printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],(double)errors_scrambling/available_bits/n_trials,effRate,effRate/TBS*100,TBS);
printf("\n"); printf("\n");
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
#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)) #define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
#include "SIMULATION/LTE_PHY/common_sim.h" #include "SIMULATION/LTE_PHY/common_sim.h"
...@@ -119,7 +118,7 @@ int main(int argc, char **argv) ...@@ -119,7 +118,7 @@ int main(int argc, char **argv)
double sigma, sigma_dB; double sigma, sigma_dB;
double snr_step = .2; double snr_step = .2;
uint8_t snr1set = 0; uint8_t snr1set = 0;
int slot = 8, frame = 0; int slot = 8, frame = 1;
FILE *output_fd = NULL; FILE *output_fd = NULL;
double *s_re[2]= {s_re0,s_re1}; double *s_re[2]= {s_re0,s_re1};
double *s_im[2]= {s_im0,s_im1}; double *s_im[2]= {s_im0,s_im1};
...@@ -460,12 +459,13 @@ int main(int argc, char **argv) ...@@ -460,12 +459,13 @@ int main(int argc, char **argv)
DS_TDL, DS_TDL,
0, 0, 0); 0, 0, 0);
UE2gNB->max_Doppler = maxDoppler;
if (UE2gNB == NULL) { if (UE2gNB == NULL) {
printf("Problem generating channel model. Exiting.\n"); printf("Problem generating channel model. Exiting.\n");
exit(-1); exit(-1);
} }
UE2gNB->max_Doppler = maxDoppler;
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB)); RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0]; gNB = RC.gNB[0];
...@@ -690,7 +690,6 @@ int main(int argc, char **argv) ...@@ -690,7 +690,6 @@ int main(int argc, char **argv)
slot_offset, slot_offset,
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[i], ((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[i],
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]); ((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]);
fclose(input_fd);
} }
for (SNR = snr0; SNR < snr1; SNR += snr_step) { for (SNR = snr0; SNR < snr1; SNR += snr_step) {
...@@ -702,11 +701,13 @@ int main(int argc, char **argv) ...@@ -702,11 +701,13 @@ int main(int argc, char **argv)
int round_trials[4]={0,0,0,0}; int round_trials[4]={0,0,0,0};
uint32_t errors_scrambling[4] = {0,0,0,0}; uint32_t errors_scrambling[4] = {0,0,0,0};
clear_pusch_stats(gNB);
for (trial = 0; trial < n_trials; trial++) { for (trial = 0; trial < n_trials; trial++) {
uint8_t round = 0; uint8_t round = 0;
crc_status = 1; crc_status = 1;
errors_decoding = 0; errors_decoding = 0;
memset((void*)roundStats,0,50*sizeof(roundStats[0]));
while (round<max_rounds && crc_status) { while (round<max_rounds && crc_status) {
round_trials[round]++; round_trials[round]++;
ulsch_ue[0]->harq_processes[harq_pid]->round = round; ulsch_ue[0]->harq_processes[harq_pid]->round = round;
...@@ -1028,7 +1029,8 @@ int main(int argc, char **argv) ...@@ -1028,7 +1029,8 @@ int main(int argc, char **argv)
printf("*****************************************\n"); printf("*****************************************\n");
printf("SNR %f: n_errors (%d/%d,%d/%d,%d/%d,%d/%d) (negative CRC), false_positive %d/%d, errors_scrambling (%u/%u,%u/%u,%u/%u,%u/%u\n", SNR, n_errors[0], round_trials[0],n_errors[1], round_trials[1],n_errors[2], round_trials[2],n_errors[3], round_trials[3], n_false_positive, n_trials, errors_scrambling[0],available_bits*n_trials,errors_scrambling[1],available_bits*n_trials,errors_scrambling[2],available_bits*n_trials,errors_scrambling[3],available_bits*n_trials); printf("SNR %f: n_errors (%d/%d,%d/%d,%d/%d,%d/%d) (negative CRC), false_positive %d/%d, errors_scrambling (%u/%u,%u/%u,%u/%u,%u/%u\n", SNR, n_errors[0], round_trials[0],n_errors[1], round_trials[1],n_errors[2], round_trials[2],n_errors[3], round_trials[3], n_false_positive, n_trials, errors_scrambling[0],available_bits*n_trials,errors_scrambling[1],available_bits*n_trials,errors_scrambling[2],available_bits*n_trials,errors_scrambling[3],available_bits*n_trials);
printf("\n"); printf("\n");
printf("SNR %f: Channel BLER (%e,%e,%e,%e), Channel BER (%e,%e,%e,%e) Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot\n", SNR, printf("SNR %f: Channel BLER (%e,%e,%e,%e), Channel BER (%e,%e,%e,%e) Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot\n",
SNR,
(double)n_errors[0]/round_trials[0], (double)n_errors[0]/round_trials[0],
(double)n_errors[1]/round_trials[0], (double)n_errors[1]/round_trials[0],
(double)n_errors[2]/round_trials[0], (double)n_errors[2]/round_trials[0],
...@@ -1038,6 +1040,9 @@ int main(int argc, char **argv) ...@@ -1038,6 +1040,9 @@ int main(int argc, char **argv)
(double)errors_scrambling[2]/available_bits/round_trials[0], (double)errors_scrambling[2]/available_bits/round_trials[0],
(double)errors_scrambling[3]/available_bits/round_trials[0], (double)errors_scrambling[3]/available_bits/round_trials[0],
roundStats[snrRun],effRate,effRate/TBS*100,TBS); roundStats[snrRun],effRate,effRate/TBS*100,TBS);
dump_pusch_stats(gNB);
printf("*****************************************\n"); printf("*****************************************\n");
printf("\n"); printf("\n");
......
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
#define NUMBER_OF_NR_DLSCH_MAX 2//16 #define NUMBER_OF_NR_DLSCH_MAX 2//16
#define NUMBER_OF_NR_ULSCH_MAX 2//16 #define NUMBER_OF_NR_ULSCH_MAX 2//16
#define NUMBER_OF_NR_SCH_STATS_MAX 16
#define NUMBER_OF_NR_PUCCH_MAX 16 #define NUMBER_OF_NR_PUCCH_MAX 16
#define NUMBER_OF_NR_SR_MAX 16 #define NUMBER_OF_NR_SR_MAX 16
#define NUMBER_OF_NR_PDCCH_MAX 16 #define NUMBER_OF_NR_PDCCH_MAX 16
......
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