From e0231398cad4f519efa0db8b57929f6e200763c4 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 8 Jul 2020 21:02:33 +0200 Subject: [PATCH 1/3] update from Walter Maguire --- openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index daa2346098..42d500ae86 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -197,8 +197,10 @@ decoder_node_t *add_nodes(int level, int first_leaf_index, t_nrPolar_params *pol } for (int i=0;iinformation_bit_pattern[i+first_leaf_index]>0) - all_frozen_below=0; + if (polarParams->information_bit_pattern[i+first_leaf_index]>0) { + all_frozen_below=0; + break; + } } if (all_frozen_below==0) From 96b5380b0282fb0a3fc70cfee22bf45288e3b2f4 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 10 Jul 2020 12:44:59 +0200 Subject: [PATCH 2/3] minor: remove a LOG_E that should not be here anymore When running the softmodem, we get the error: fill_ulsch UE_id 0 nb_rb = 0 The code has changed some time ago and this log was left but is not meaningful anymore. --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index ce409de131..8de011acef 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -2006,11 +2006,6 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu return; } - //AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb>0,"nb_rb = 0\n"); - if(ulsch->harq_processes[harq_pid]->nb_rb == 0) { - LOG_E(PHY, "fill_ulsch UE_id %d nb_rb = 0\n", UE_id); - } - ulsch->harq_processes[harq_pid]->frame = frame; ulsch->harq_processes[harq_pid]->subframe = subframe; ulsch->harq_processes[harq_pid]->handled = 0; From 2cd3c0b7bba65b54b82b98892edb602489c7c87d Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 22 Jul 2020 18:08:27 +0200 Subject: [PATCH 3/3] harq put in ulsim --- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 3 +- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 24 +++++++------- .../PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c | 7 ++-- openair1/SIMULATION/NR_PHY/ulsim.c | 32 +++++++++++++------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 3 +- 5 files changed, 42 insertions(+), 27 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 2f55bde321..fe5c3a626b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -326,7 +326,8 @@ int nr_dlsch_encoding(unsigned char *a, nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_processes[harq_pid]->pdsch_pdu.pdsch_pdu_rel15; uint16_t nb_rb = rel15->rbSize; uint8_t nb_symb_sch = rel15->NrOfSymbols; - uint32_t A, Z, Kb, F=0; + uint32_t A, Kb, F=0; + static uint32_t Z = 0; uint32_t *Zc = &Z; uint8_t mod_order = rel15->qamModOrder[0]; uint16_t Kr=0,r; diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index e00975eee1..cf8463b2bc 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -366,13 +366,6 @@ 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); - if (harq_process->round == 0) { - - // This is a new packet, so compute quantities regarding segmentation - if (A > 3824) - harq_process->B = A+24; - else - harq_process->B = A+16; if (R<1024) Coderate = (float) R /(float) 1024; @@ -409,6 +402,13 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, } } + if (harq_process->round == 0) { + // This is a new packet, so compute quantities regarding segmentation + if (A > 3824) + harq_process->B = A+24; + else + harq_process->B = A+16; + // [hna] Perform nr_segmenation with input and output set to NULL to calculate only (B, C, K, Z, F) nr_segmentation(NULL, NULL, @@ -479,7 +479,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, stop_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); -#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", harq_pid,r, G, Kr*3, @@ -489,7 +488,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, n_layers, pusch_pdu->pusch_data.rv_index, harq_process->round); -#endif ////////////////////////////////////////////////////////////////////////////////////////// @@ -664,8 +662,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, harq_process->status = SCH_IDLE; harq_process->round = 0; harq_process->handled = 0; - ulsch->harq_mask &= ~(1 << harq_pid); } + ulsch->harq_mask &= ~(1 << harq_pid); // LOG_D(PHY,"[gNB %d] ULSCH: Setting NACK for nr_tti_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n", // phy_vars_gNB->Mod_id,nr_tti_rx,harq_pid,harq_process->status,harq_process->round,ulsch->Mlimit,harq_process->TBS); @@ -675,15 +673,15 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, } else { -#ifdef gNB_DEBUG_TRACE +//#ifdef gNB_DEBUG_TRACE LOG_I(PHY,"[gNB %d] ULSCH: Setting ACK for nr_tti_rx %d TBS %d\n", phy_vars_gNB->Mod_id,nr_tti_rx,harq_process->TBS); -#endif +//#endif harq_process->status = SCH_IDLE; harq_process->round = 0; // harq_process->handled = 0; - ulsch->harq_mask &= ~(1 << harq_pid); + ulsch->harq_mask |= (1 << harq_pid); // harq_process->harq_ack.ack = 1; // harq_process->harq_ack.harq_id = harq_pid; // harq_process->harq_ack.send_harq_status = 1; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 4b36f91e69..b8d204ad17 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -225,8 +225,9 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, unsigned int crc; NR_UL_UE_HARQ_t *harq_process; uint16_t nb_rb ; - uint32_t A, Z, F; - uint32_t *pz; + uint32_t A, F; + static uint32_t Z = 0; + uint32_t *pz = &Z; uint8_t mod_order; uint16_t Kr,r; uint32_t r_offset; @@ -409,6 +410,8 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, /////////////////////////////////////////////////////////////////////////////// } + F = harq_process->F; + Kr = harq_process->K; for (r=0; rC; r++) { // looping over C segments diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index bcaa967a30..7a99aef1ac 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -104,6 +104,7 @@ int rrc_init_nr_global_param(void){return(0);} // needed for some functions uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; +uint8_t round_rv_map[4] = {1, 0, 2, 3}; int main(int argc, char **argv) { @@ -146,6 +147,7 @@ int main(int argc, char **argv) int print_perf = 0; cpuf = get_cpu_freq_GHz(); int msg3_flag = 0; + uint8_t rv_index = 0; UE_nr_rxtx_proc_t UE_proc; FILE *scg_fd=NULL; @@ -556,6 +558,7 @@ int main(int argc, char **argv) uint16_t n_rb1 = 75; uint8_t mcs_table = 0; uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; // | PUSCH_PDU_BITMAP_PUSCH_PTRS; + uint8_t max_rounds = 4; uint8_t length_dmrs = pusch_len1; // [hna] remove dmrs struct uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct @@ -574,10 +577,18 @@ int main(int argc, char **argv) printf("\n"); - for (int i=0;i<16;i++) printf("%f\n",gaussdouble(0.0,1.0)); + //for (int i=0;i<16;i++) printf("%f\n",gaussdouble(0.0,1.0)); for (SNR = snr0; SNR < snr1; SNR += snr_step) { + varArray_t *table_rx=initVarArray(1000,sizeof(double)); + for (trial = 0; trial < n_trials; trial++) { + uint8_t round = 0; + int error_flag; + gNB->ulsch[0][0]->harq_mask = 0; - varArray_t *table_rx=initVarArray(1000,sizeof(double)); + while (roundulsch[0][0]->harq_mask & 0x1)) { + ulsch_ue[0]->harq_processes[harq_pid]->round = round; + gNB->ulsch[0][0]->harq_processes[harq_pid]->round = round; + rv_index = round_rv_map[round]; reset_meas(&gNB->phy_proc_rx); reset_meas(&gNB->ulsch_decoding_stats); reset_meas(&gNB->ulsch_deinterleaving_stats); @@ -658,9 +669,9 @@ int main(int argc, char **argv) pusch_pdu->uplink_frequency_shift_7p5khz = 0; pusch_pdu->start_symbol_index = start_symbol; pusch_pdu->nr_of_symbols = nb_symb_sch; - pusch_pdu->pusch_data.rv_index = 0; + pusch_pdu->pusch_data.rv_index = rv_index; pusch_pdu->pusch_data.harq_process_id = 0; - pusch_pdu->pusch_data.new_data_indicator = 0; + pusch_pdu->pusch_data.new_data_indicator = trial & 0x1; pusch_pdu->pusch_data.num_cb = 0; pusch_pdu->pusch_ptrs.ptrs_time_density = ptrs_time_density; pusch_pdu->pusch_ptrs.ptrs_freq_density = ptrs_freq_density; @@ -694,8 +705,8 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs; ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table; ul_config.ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 1; - ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0; - ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = 0; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = trial & 0x1; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = rv_index; ul_config.ul_config_list[0].pusch_config_pdu.nrOfLayers = precod_nbr_layers; ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_pid; ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density; @@ -762,8 +773,6 @@ int main(int argc, char **argv) errors_scrambling = 0; errors_decoding = 0; - int error_flag; - for (trial = 0; trial < n_trials; trial++) { error_flag = 0; //---------------------------------------------------------- @@ -833,6 +842,9 @@ int main(int argc, char **argv) error_flag = 1; n_errors++; } + printf("end of round %d rv_index %d\n",round, rv_index); + round++; + } // round //---------------------------------------------------------- //----------------- count and print errors ----------------- @@ -868,11 +880,11 @@ int main(int argc, char **argv) if (n_trials == 1) { for (int r=0;rharq_processes[harq_pid]->C;r++) for (int i=0;iharq_processes[harq_pid]->K>>3;i++) { - if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************"); + /*if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************"); printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r, i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i], i,ulsch_gNB->harq_processes[harq_pid]->c[r][i], - ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]); + ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/ } } if (errors_decoding > 0 && error_flag == 0) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 338c94776b..874a5c3cfc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -269,6 +269,7 @@ int configure_fapi_dl_pdu(int Mod_idP, int TBS; int bwp_id=1; int UE_id = 0; + uint8_t rv_round_map[4] = {0, 2, 3, 1}; NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list; @@ -314,7 +315,7 @@ int configure_fapi_dl_pdu(int Mod_idP, pdsch_pdu_rel15->qamModOrder[0] = 2; pdsch_pdu_rel15->mcsIndex[0] = mcs; pdsch_pdu_rel15->mcsTable[0] = 0; - pdsch_pdu_rel15->rvIndex[0] = (get_softmodem_params()->phy_test==1) ? 0 : UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round; + pdsch_pdu_rel15->rvIndex[0] = (get_softmodem_params()->phy_test==1) ? 0 : rv_round_map[UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round]; pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; pdsch_pdu_rel15->nrOfLayers = 1; pdsch_pdu_rel15->transmissionScheme = 0;