From 92954c1aa46735e2b6c2f498fa09cae94b3169c1 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 3 Jul 2018 17:29:22 +0200 Subject: [PATCH] Fixed UCI decoder defect in eNb. Improved PUSCH Unit Test. PUSCH CQI is printed like UE. --- lib/src/phy/phch/sch.c | 6 +++--- lib/src/phy/phch/test/pusch_test.c | 28 ++++++++++++++++------------ srsenb/src/phy/phch_worker.cc | 6 ++---- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/src/phy/phch/sch.c b/lib/src/phy/phch/sch.c index f419ea826..aa1f297d7 100644 --- a/lib/src/phy/phch/sch.c +++ b/lib/src/phy/phch/sch.c @@ -683,9 +683,9 @@ int srslte_ulsch_uci_decode_ri_ack(srslte_sch_t *q, srslte_pusch_cfg_t *cfg, srs Q_prime_ack = (uint32_t) ret; // Set zeros to HARQ bits - for (uint32_t i=0;iack_ri_bits[i].position] = 0; - } + for (uint32_t i = 0; i < Q_prime_ack * Qm; i++) { + q_bits[q->ack_ri_bits[i].position] = 0; + } } // Deinterleave and decode RI bits diff --git a/lib/src/phy/phch/test/pusch_test.c b/lib/src/phy/phch/test/pusch_test.c index 38be7b70c..b2b7a263f 100644 --- a/lib/src/phy/phch/test/pusch_test.c +++ b/lib/src/phy/phch/test/pusch_test.c @@ -72,6 +72,7 @@ int freq_hop = -1; int riv = -1; uint32_t mcs_idx = 0; srslte_cqi_value_t cqi_value; +bool enable_64_qam = false; void usage(char *prog) { printf("Usage: %s [csrnfvmtLNF] \n", prog); @@ -96,10 +97,11 @@ void usage(char *prog) { printf("\n\tCQI/RI/ACK Reporting contents:\n"); printf("\t\t-p uci_cqi (none, wideband) [Default none]\n"); printf("\t\t-p uci_ri (0-1) (zeros, ones, random) [Default none]\n"); - printf("\t\t-p uci_ack (0-1) [Default none]\n"); - printf("\t\t-p uci_ack_2 (0-1) [Default none]\n"); + printf("\t\t-p uci_ack [Default none]\n"); + printf("\t\t-p uci_ack_2 [Default none]\n"); printf("\n\tOther parameters:\n"); + printf("\t\t-p enable_64qam [Default %s]\n", enable_64_qam ? "enabled":"disabled"); printf("\t\t-s number of subframes [Default %d]\n", subframe); printf("\t-v [set srslte_verbose to debug, default none]\n"); } @@ -139,14 +141,9 @@ void parse_extensive_param(char *param, char *arg) { uci_data_tx.uci_ri_len = 1; } } else if (!strcmp(param, "uci_ack")) { - uci_data_tx.uci_ack = (uint8_t) strtol(arg, NULL, 10); - if (uci_data_tx.uci_ack > 1) { - ext_code = SRSLTE_ERROR; - } else { - uci_data_tx.uci_ack_len++; - if (uci_data_tx.uci_ack_len > 2) { - uci_data_tx.uci_ack_len = 2; - } + uci_data_tx.uci_ack_len++; + if (uci_data_tx.uci_ack_len > 2) { + uci_data_tx.uci_ack_len = 2; } } else if (!strcmp(param, "uci_ack_2")) { uci_data_tx.uci_ack_2 = (uint8_t) strtol(arg, NULL, 10); @@ -158,6 +155,8 @@ void parse_extensive_param(char *param, char *arg) { uci_data_tx.uci_ack_len = 2; } } + } else if (!strcmp(param, "enable_64qam")) { + enable_64_qam ^= true; } else { ext_code = SRSLTE_ERROR; } @@ -318,6 +317,11 @@ int main(int argc, char **argv) { ce[j] = 1; } + if (!enable_64_qam && grant.mcs.mod == SRSLTE_MOD_64QAM) { + grant.mcs.mod = SRSLTE_MOD_16QAM; + grant.Qm = 4; + } + for (int n = 0; n < subframe; n++) { ret = SRSLTE_SUCCESS; @@ -377,12 +381,12 @@ int main(int argc, char **argv) { gettimeofday(&t[2], NULL); if (r) { printf("Error returned while decoding\n"); - goto quit; + ret = SRSLTE_ERROR; } if (memcmp(data_rx, data, (size_t) cfg.grant.mcs.tbs / 8) != 0) { printf("Unmatched data detected\n"); - goto quit; + ret = SRSLTE_ERROR; } else { INFO("Rx Data is Ok\n"); } diff --git a/srsenb/src/phy/phch_worker.cc b/srsenb/src/phy/phch_worker.cc index 4a365f75f..13156d651 100644 --- a/srsenb/src/phy/phch_worker.cc +++ b/srsenb/src/phy/phch_worker.cc @@ -646,8 +646,7 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch) cqi_value.subband_hl.wideband_cqi_cw0, cqi_value.subband_hl.N); } } - srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, SRSLTE_CQI_STR_MAX_CHAR); - //snprintf(cqi_str, 64, ", cqi=%s", wideband_cqi_value); + srslte_cqi_value_tostring(&cqi_value, cqi_str, SRSLTE_CQI_STR_MAX_CHAR); } float snr_db = 10*log10(srslte_chest_ul_get_snr(&enb_ul.chest)); @@ -665,7 +664,7 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch) } */ log_h->info_hex(grants[i].data, phy_grant.mcs.tbs / 8, - "PUSCH: rnti=0x%x, prb=(%d,%d), tbs=%d, mcs=%d, rv=%d, snr=%.1f dB, n_iter=%d, crc=%s%s%s%s%s%s%s%s\n", + "PUSCH: rnti=0x%x, prb=(%d,%d), tbs=%d, mcs=%d, rv=%d, snr=%.1f dB, n_iter=%d, crc=%s%s%s%s%s%s%s\n", rnti, phy_grant.n_prb[0], phy_grant.n_prb[0]+phy_grant.L_prb, phy_grant.mcs.tbs / 8, phy_grant.mcs.idx, grants[i].grant.rv_idx, snr_db, @@ -674,7 +673,6 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch) (acks_pending[0] || acks_pending[1]) ? ", ack=" : "", (acks_pending[0]) ? (uci_data.uci_ack ? "1" : "0") : "", (acks_pending[1]) ? (uci_data.uci_ack_2 ? "1" : "0") : "", - uci_data.uci_cqi_len > 0 ? ", cqi=" : "", uci_data.uci_cqi_len > 0 ? cqi_str : "", uci_data.uci_ri_len > 0 ? ((uci_data.uci_ri == 0) ? ", ri=0" : ", ri=1") : "", timestr);