Commit aca390e6 authored by Ahmed Hussein's avatar Ahmed Hussein Committed by Thomas Schlichter

Fixed repeating CRC NOK for 7 times, as well as CRC NOK occuring a lot more than CRC OK

- changed Mdlharq to Mlimit when comparing with the round number
- Not incrementing the HARQ round in case of err_flag = 1, until HARQ is implemented
- Changed MAX_LDPC_ITERATIONS to 5 from 4 (provided better performance)
parent 37015999
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define MAX_TURBO_ITERATIONS_MBSFN 8 #define MAX_TURBO_ITERATIONS_MBSFN 8
#define MAX_TURBO_ITERATIONS max_turbo_iterations #define MAX_TURBO_ITERATIONS max_turbo_iterations
#define MAX_LDPC_ITERATIONS 4 #define MAX_LDPC_ITERATIONS 5
#define MAX_LDPC_ITERATIONS_MBSFN 4 #define MAX_LDPC_ITERATIONS_MBSFN 4
#define LTE_NULL 2 #define LTE_NULL 2
......
...@@ -128,6 +128,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint ...@@ -128,6 +128,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
dlsch->Kmimo = Kmimo; dlsch->Kmimo = Kmimo;
dlsch->Mdlharq = Mdlharq; dlsch->Mdlharq = Mdlharq;
dlsch->Nsoft = Nsoft; dlsch->Nsoft = Nsoft;
dlsch->Mlimit = 4;
dlsch->max_ldpc_iterations = max_ldpc_iterations; dlsch->max_ldpc_iterations = max_ldpc_iterations;
for (i=0; i<Mdlharq; i++) { for (i=0; i<Mdlharq; i++) {
...@@ -237,9 +238,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -237,9 +238,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
//int16_t inv_d [68*384]; //int16_t inv_d [68*384];
uint8_t kc; uint8_t kc;
uint8_t Ilbrm = 0; uint8_t Ilbrm = 0;
uint32_t Tbslbrm = 950984; uint32_t Tbslbrm; //= 950984;
uint16_t nb_rb = 30; uint16_t nb_rb; //= 30;
double Coderate = 0.0; double Coderate; //= 0.0;
//nfapi_nr_config_request_t *cfg = &phy_vars_ue->nrUE_config; //nfapi_nr_config_request_t *cfg = &phy_vars_ue->nrUE_config;
//uint8_t dmrs_type = cfg->pdsch_config.dmrs_type.value; //uint8_t dmrs_type = cfg->pdsch_config.dmrs_type.value;
uint8_t nb_re_dmrs = 6; //(dmrs_type==NFAPI_NR_DMRS_TYPE1)?6:4; uint8_t nb_re_dmrs = 6; //(dmrs_type==NFAPI_NR_DMRS_TYPE1)?6:4;
...@@ -254,22 +255,22 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -254,22 +255,22 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
if (!dlsch_llr) { if (!dlsch_llr) {
printf("dlsch_decoding.c: NULL dlsch_llr pointer\n"); printf("dlsch_decoding.c: NULL dlsch_llr pointer\n");
return(dlsch->max_ldpc_iterations); return(dlsch->max_ldpc_iterations + 1);
} }
if (!harq_process) { if (!harq_process) {
printf("dlsch_decoding.c: NULL harq_process pointer\n"); printf("dlsch_decoding.c: NULL harq_process pointer\n");
return(dlsch->max_ldpc_iterations); return(dlsch->max_ldpc_iterations + 1);
} }
if (!frame_parms) { if (!frame_parms) {
printf("dlsch_decoding.c: NULL frame_parms pointer\n"); printf("dlsch_decoding.c: NULL frame_parms pointer\n");
return(dlsch->max_ldpc_iterations); return(dlsch->max_ldpc_iterations + 1);
} }
/*if (nr_tti_rx> (10*frame_parms->ttis_per_subframe-1)) { /*if (nr_tti_rx> (10*frame_parms->ttis_per_subframe-1)) {
printf("dlsch_decoding.c: Illegal subframe index %d\n",nr_tti_rx); printf("dlsch_decoding.c: Illegal subframe index %d\n",nr_tti_rx);
return(dlsch->max_ldpc_iterations); return(dlsch->max_ldpc_iterations + 1);
}*/ }*/
/*if (harq_process->harq_ack.ack != 2) { /*if (harq_process->harq_ack.ack != 2) {
...@@ -282,13 +283,13 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -282,13 +283,13 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
/* /*
if (nb_rb > frame_parms->N_RB_DL) { if (nb_rb > frame_parms->N_RB_DL) {
printf("dlsch_decoding.c: Illegal nb_rb %d\n",nb_rb); printf("dlsch_decoding.c: Illegal nb_rb %d\n",nb_rb);
return(max_ldpc_iterations); return(max_ldpc_iterations + 1);
}*/ }*/
/*harq_pid = dlsch->current_harq_pid[phy_vars_ue->current_thread_id[subframe]]; /*harq_pid = dlsch->current_harq_pid[phy_vars_ue->current_thread_id[subframe]];
if (harq_pid >= 8) { if (harq_pid >= 8) {
printf("dlsch_decoding.c: Illegal harq_pid %d\n",harq_pid); printf("dlsch_decoding.c: Illegal harq_pid %d\n",harq_pid);
return(max_ldpc_iterations); return(max_ldpc_iterations + 1);
} }
*/ */
...@@ -299,7 +300,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -299,7 +300,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->TBS = nr_compute_tbs(harq_process->mcs,nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs, harq_process->Nl); harq_process->TBS = nr_compute_tbs(harq_process->mcs,nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs, harq_process->Nl);
A = harq_process->TBS; A = harq_process->TBS;
ret = dlsch->max_ldpc_iterations; ret = dlsch->max_ldpc_iterations + 1;
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl); harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl);
G = harq_process->G; G = harq_process->G;
...@@ -447,7 +448,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -447,7 +448,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
stop_meas(dlsch_rate_unmatching_stats); stop_meas(dlsch_rate_unmatching_stats);
#endif #endif
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n"); LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
return(dlsch->max_ldpc_iterations); return(dlsch->max_ldpc_iterations + 1);
} else { } else {
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(dlsch_rate_unmatching_stats); stop_meas(dlsch_rate_unmatching_stats);
...@@ -522,12 +523,12 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -522,12 +523,12 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) { if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
printf("Segment %d CRC OK\n",r); printf("\x1B[34m" "Segment %d CRC OK\n",r);
ret = 2; ret = no_iteration_ldpc;
} }
else { else {
printf("CRC NOK\n"); printf("\x1B[33m" "CRC NOK\n");
ret = 1+dlsch->max_ldpc_iterations; ret = 1 + dlsch->max_ldpc_iterations;
} }
nb_total_decod++; nb_total_decod++;
...@@ -535,8 +536,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -535,8 +536,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
nb_error_decod++; nb_error_decod++;
} }
ret=no_iteration_ldpc;
//if (!nb_total_decod%10000){ //if (!nb_total_decod%10000){
//printf("Error number of iteration LPDC %d %ld/%ld \n", no_iteration_ldpc, nb_error_decod,nb_total_decod);fflush(stdout); //printf("Error number of iteration LPDC %d %ld/%ld \n", no_iteration_ldpc, nb_error_decod,nb_total_decod);fflush(stdout);
//} //}
...@@ -561,6 +560,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -561,6 +560,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
stop_meas(dlsch_turbo_decoding_stats); stop_meas(dlsch_turbo_decoding_stats);
#endif #endif
} }
/*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n", /*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n",
harq_process->C, harq_process->C,
...@@ -593,21 +594,21 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -593,21 +594,21 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->harq_ack.harq_id = harq_pid; harq_process->harq_ack.harq_id = harq_pid;
harq_process->harq_ack.send_harq_status = 1; harq_process->harq_ack.send_harq_status = 1;
harq_process->errors[harq_process->round]++; harq_process->errors[harq_process->round]++;
harq_process->round++; // harq_process->round++; // [hna] uncomment this line when HARQ is implemented
// printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); // printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
if (harq_process->round >= dlsch->Mdlharq) { if (harq_process->round >= dlsch->Mlimit) {
harq_process->status = SCH_IDLE; harq_process->status = SCH_IDLE;
harq_process->round = 0; harq_process->round = 0;
} }
if(is_crnti) if(is_crnti)
{ {
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for nr_tti_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n", LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for nr_tti_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
phy_vars_ue->Mod_id,nr_tti_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS); phy_vars_ue->Mod_id,nr_tti_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS);
} }
return((1+dlsch->max_ldpc_iterations)); return((1 + dlsch->max_ldpc_iterations));
} else { } else {
#if UE_DEBUG_TRACE #if UE_DEBUG_TRACE
LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for nr_tti_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n", LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for nr_tti_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
...@@ -619,6 +620,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -619,6 +620,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->harq_ack.ack = 1; harq_process->harq_ack.ack = 1;
harq_process->harq_ack.harq_id = harq_pid; harq_process->harq_ack.harq_id = harq_pid;
harq_process->harq_ack.send_harq_status = 1; harq_process->harq_ack.send_harq_status = 1;
//LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d)\n", //LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d)\n",
// phy_vars_ue->Mod_id, frame, subframe, harq_pid, harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs); // phy_vars_ue->Mod_id, frame, subframe, harq_pid, harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs);
...@@ -1145,14 +1147,14 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -1145,14 +1147,14 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
// printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); // printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
if (harq_process->round >= dlsch->Mdlharq) { if (harq_process->round >= dlsch->Mlimit) {
harq_process->status = SCH_IDLE; harq_process->status = SCH_IDLE;
harq_process->round = 0; harq_process->round = 0;
} }
if(is_crnti) if(is_crnti)
{ {
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for nr_tti_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n", LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for nr_tti_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
phy_vars_ue->Mod_id,nr_tti_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS); phy_vars_ue->Mod_id,nr_tti_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mlimit,harq_process->TBS);
} }
return((1+dlsch->max_ldpc_iterations)); return((1+dlsch->max_ldpc_iterations));
...@@ -1634,7 +1636,6 @@ void *nr_dlsch_decoding_process(void *arg) ...@@ -1634,7 +1636,6 @@ void *nr_dlsch_decoding_process(void *arg)
proc->decoder_thread_available = 1; proc->decoder_thread_available = 1;
//proc->decoder_main_available = 0; //proc->decoder_main_available = 0;
} }
void *dlsch_thread(void *arg) { void *dlsch_thread(void *arg) {
......
...@@ -372,6 +372,8 @@ typedef struct { ...@@ -372,6 +372,8 @@ typedef struct {
uint8_t max_ldpc_iterations; uint8_t max_ldpc_iterations;
/// number of iterations used in last turbo decoding /// number of iterations used in last turbo decoding
uint8_t last_iteration_cnt; uint8_t last_iteration_cnt;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
} NR_UE_DLSCH_t; } NR_UE_DLSCH_t;
typedef enum {format0_0, typedef enum {format0_0,
......
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