From ecd2c1cdccff8329f22be71e1c3fa49216adc2fb Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Thu, 25 Mar 2021 19:26:30 +0100 Subject: [PATCH] Improved LDPC decoded performance and other NR aesthetical changes --- lib/src/phy/fec/ldpc/ldpc_decoder.c | 9 ++++++++- lib/src/phy/phch/csi.c | 2 +- lib/src/phy/phch/pucch_nr.c | 2 +- lib/src/phy/phch/pusch_nr.c | 4 ++-- lib/src/phy/phch/uci_nr.c | 4 +--- lib/test/phy/phy_dl_nr_test.c | 8 +++++++- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/src/phy/fec/ldpc/ldpc_decoder.c b/lib/src/phy/fec/ldpc/ldpc_decoder.c index 04a5eaf85..baba3e5d4 100644 --- a/lib/src/phy/fec/ldpc/ldpc_decoder.c +++ b/lib/src/phy/fec/ldpc/ldpc_decoder.c @@ -1030,7 +1030,14 @@ int srsran_ldpc_decoder_decode_s(srsran_ldpc_decoder_t* q, int srsran_ldpc_decoder_decode_c(srsran_ldpc_decoder_t* q, const int8_t* llrs, uint8_t* message) { - return q->decode_c(q, llrs, message, q->liftN - 2 * q->ls); + uint32_t cdwd_rm_length = q->liftN - 2 * q->ls; + + // Trim input LLR to find last zero + while (llrs[cdwd_rm_length - 1] == 0 && cdwd_rm_length > 0) { + cdwd_rm_length--; + } + + return q->decode_c(q, llrs, message, cdwd_rm_length); } int srsran_ldpc_decoder_decode_rm_c(srsran_ldpc_decoder_t* q, diff --git a/lib/src/phy/phch/csi.c b/lib/src/phy/phch/csi.c index 8c6dff16a..02ced3f83 100644 --- a/lib/src/phy/phch/csi.c +++ b/lib/src/phy/phch/csi.c @@ -315,4 +315,4 @@ uint32_t srsran_csi_str(const srsran_csi_report_cfg_t* report_cfg, } } return len; -} \ No newline at end of file +} diff --git a/lib/src/phy/phch/pucch_nr.c b/lib/src/phy/phch/pucch_nr.c index 67a41d4e7..81a907723 100644 --- a/lib/src/phy/phch/pucch_nr.c +++ b/lib/src/phy/phch/pucch_nr.c @@ -767,7 +767,7 @@ uint32_t srsran_pucch_nr_tx_info(const srsran_pucch_nr_resource_t* resource, len += pucch_nr_resource_info(resource, &str[len], str_len - len); - len = srsran_print_check(str, str_len, len, ", "); + len = srsran_print_check(str, str_len, len, "rnti=0x%x ", uci_data->cfg.pucch.rnti); len += srsran_uci_nr_info(uci_data, &str[len], str_len - len); diff --git a/lib/src/phy/phch/pusch_nr.c b/lib/src/phy/phch/pusch_nr.c index 8e678b920..561514268 100644 --- a/lib/src/phy/phch/pusch_nr.c +++ b/lib/src/phy/phch/pusch_nr.c @@ -53,6 +53,8 @@ int pusch_nr_init_common(srsran_pusch_nr_t* q, const srsran_pusch_nr_args_t* arg return SRSRAN_ERROR; } + q->meas_time_en = args->measure_time; + return SRSRAN_SUCCESS; } @@ -97,8 +99,6 @@ int srsran_pusch_nr_init_gnb(srsran_pusch_nr_t* q, const srsran_pusch_nr_args_t* } } - q->meas_time_en = args->measure_time; - return SRSRAN_SUCCESS; } diff --git a/lib/src/phy/phch/uci_nr.c b/lib/src/phy/phch/uci_nr.c index 75506d1e9..9162d3091 100644 --- a/lib/src/phy/phch/uci_nr.c +++ b/lib/src/phy/phch/uci_nr.c @@ -985,8 +985,6 @@ uint32_t srsran_uci_nr_info(const srsran_uci_data_nr_t* uci_data, char* str, uin { uint32_t len = 0; - len = srsran_print_check(str, str_len, len, "rnti=0x%x", uci_data->cfg.pucch.rnti); - if (uci_data->cfg.o_ack > 0) { char str2[10]; srsran_vec_sprint_bin(str2, 10, uci_data->value.ack, uci_data->cfg.o_ack); @@ -1256,4 +1254,4 @@ int srsran_uci_nr_decode_pusch_csi1(srsran_uci_nr_t* q, } return SRSRAN_SUCCESS; -} \ No newline at end of file +} diff --git a/lib/test/phy/phy_dl_nr_test.c b/lib/test/phy/phy_dl_nr_test.c index 4f8f958e7..4028da43f 100644 --- a/lib/test/phy/phy_dl_nr_test.c +++ b/lib/test/phy/phy_dl_nr_test.c @@ -32,6 +32,7 @@ static uint32_t n_prb = 0; // Set to 0 for steering static uint32_t mcs = 30; // Set to 30 for steering static srsran_sch_cfg_nr_t pdsch_cfg = {}; static uint32_t nof_slots = 10; +static uint32_t rv_idx = 0; static void usage(char* prog) { @@ -40,6 +41,7 @@ static void usage(char* prog) printf("\t-p Number of grant PRB, set to 0 for steering [Default %d]\n", n_prb); printf("\t-n Number of slots to simulate [Default %d]\n", nof_slots); printf("\t-m MCS PRB, set to >28 for steering [Default %d]\n", mcs); + printf("\t-r Redundancy version, set to >28 for steering [Default %d]\n", mcs); printf("\t-T Provide MCS table (64qam, 256qam, 64qamLowSE) [Default %s]\n", srsran_mcs_table_to_str(pdsch_cfg.sch_cfg.mcs_table)); printf("\t-R Reserve RE: [rb_begin] [rb_end] [rb_stride] [sc_mask] [symbol_mask]\n"); @@ -50,7 +52,7 @@ static void usage(char* prog) static int parse_args(int argc, char** argv) { int opt; - while ((opt = getopt(argc, argv, "RPpmnTLv")) != -1) { + while ((opt = getopt(argc, argv, "rRPpmnTLv")) != -1) { switch (opt) { case 'P': carrier.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10); @@ -64,6 +66,9 @@ static int parse_args(int argc, char** argv) case 'm': mcs = (uint32_t)strtol(argv[optind], NULL, 10); break; + case 'r': + rv_idx = (uint32_t)strtol(argv[optind], NULL, 10); + break; case 'T': pdsch_cfg.sch_cfg.mcs_table = srsran_mcs_table_from_str(argv[optind]); break; @@ -298,6 +303,7 @@ int main(int argc, char** argv) pdsch_cfg.grant.nof_dmrs_cdm_groups_without_data = 1; pdsch_cfg.grant.rnti_type = srsran_rnti_type_c; pdsch_cfg.grant.rnti = 0x4601; + pdsch_cfg.grant.tb[0].rv = rv_idx; uint32_t n_prb_start = 1; uint32_t n_prb_end = carrier.nof_prb + 1;