diff --git a/openair1/PHY/CODING/coding_defs.h b/openair1/PHY/CODING/coding_defs.h index 0c1dbfae35..3e6222c341 100644 --- a/openair1/PHY/CODING/coding_defs.h +++ b/openair1/PHY/CODING/coding_defs.h @@ -38,7 +38,7 @@ #define MAX_TURBO_ITERATIONS_MBSFN 8 #define MAX_TURBO_ITERATIONS max_turbo_iterations -#define MAX_LDPC_ITERATIONS 4 +#define MAX_LDPC_ITERATIONS 5 #define MAX_LDPC_ITERATIONS_MBSFN 4 #define LTE_NULL 2 diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 964bbf802a..8f6806141f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -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->Mdlharq = Mdlharq; dlsch->Nsoft = Nsoft; + dlsch->Mlimit = 4; dlsch->max_ldpc_iterations = max_ldpc_iterations; for (i=0; inrUE_config; //uint8_t dmrs_type = cfg->pdsch_config.dmrs_type.value; 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, if (!dlsch_llr) { printf("dlsch_decoding.c: NULL dlsch_llr pointer\n"); - return(dlsch->max_ldpc_iterations); + return(dlsch->max_ldpc_iterations + 1); } if (!harq_process) { printf("dlsch_decoding.c: NULL harq_process pointer\n"); - return(dlsch->max_ldpc_iterations); + return(dlsch->max_ldpc_iterations + 1); } if (!frame_parms) { 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)) { 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) { @@ -282,13 +283,13 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, /* if (nb_rb > frame_parms->N_RB_DL) { 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]]; if (harq_pid >= 8) { 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, 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; - 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); G = harq_process->G; @@ -447,7 +448,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, stop_meas(dlsch_rate_unmatching_stats); #endif LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n"); - return(dlsch->max_ldpc_iterations); + return(dlsch->max_ldpc_iterations + 1); } else { #if UE_TIMING_TRACE stop_meas(dlsch_rate_unmatching_stats); @@ -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 if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) { - printf("Segment %d CRC OK\n",r); - ret = 2; + printf("\x1B[34m" "Segment %d CRC OK\n",r); + ret = no_iteration_ldpc; } else { - printf("CRC NOK\n"); - ret = 1+dlsch->max_ldpc_iterations; + printf("\x1B[33m" "CRC NOK\n"); + ret = 1 + dlsch->max_ldpc_iterations; } nb_total_decod++; @@ -535,8 +536,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, nb_error_decod++; } - ret=no_iteration_ldpc; - //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); //} @@ -561,6 +560,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, stop_meas(dlsch_turbo_decoding_stats); #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", harq_process->C, @@ -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.send_harq_status = 1; 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); - if (harq_process->round >= dlsch->Mdlharq) { + if (harq_process->round >= dlsch->Mlimit) { harq_process->status = SCH_IDLE; harq_process->round = 0; } + 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", 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 { #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", @@ -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.harq_id = harq_pid; 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", // 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, // 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->round = 0; } 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", - 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)); @@ -1634,7 +1636,6 @@ void *nr_dlsch_decoding_process(void *arg) proc->decoder_thread_available = 1; //proc->decoder_main_available = 0; - } void *dlsch_thread(void *arg) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index e479c7cc34..86b551435e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -372,6 +372,8 @@ typedef struct { uint8_t max_ldpc_iterations; /// number of iterations used in last turbo decoding uint8_t last_iteration_cnt; + /// Maximum number of HARQ rounds + uint8_t Mlimit; } NR_UE_DLSCH_t; typedef enum {format0_0,