From 0dafe4dd58ecb2b92274457b758ae0ba8f5dfef9 Mon Sep 17 00:00:00 2001 From: Francisco Date: Wed, 26 May 2021 13:27:50 +0100 Subject: [PATCH] fix coderate derivation in PDCCH based on aggregation level --- lib/src/phy/phch/pdcch.c | 3 ++- srsenb/src/stack/mac/sched_helpers.cc | 14 +++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/src/phy/phch/pdcch.c b/lib/src/phy/phch/pdcch.c index eaffc0aa8..badcba244 100644 --- a/lib/src/phy/phch/pdcch.c +++ b/lib/src/phy/phch/pdcch.c @@ -36,7 +36,8 @@ float srsran_pdcch_coderate(uint32_t nof_bits, uint32_t l) { - return (float)(nof_bits + 16) / (4 * PDCCH_FORMAT_NOF_REGS(l)); + static const int nof_bits_x_symbol = 2; //QPSK + return (float)(nof_bits + 16) / (nof_bits_x_symbol * PDCCH_FORMAT_NOF_REGS(l)); } /** Initializes the PDCCH transmitter and receiver */ diff --git a/srsenb/src/stack/mac/sched_helpers.cc b/srsenb/src/stack/mac/sched_helpers.cc index 0978a3770..0dd785551 100644 --- a/srsenb/src/stack/mac/sched_helpers.cc +++ b/srsenb/src/stack/mac/sched_helpers.cc @@ -396,18 +396,14 @@ uint32_t get_aggr_level(uint32_t nof_bits, factor = 1.0; l_max = 2; } - l_max = SRSRAN_MIN(max_aggr_lvl, l_max); + l_max = std::min(max_aggr_lvl, l_max); - uint32_t l = min_aggr_lvl; - float coderate = 0; - for (; l <= l_max; ++l) { + uint32_t l = std::min(min_aggr_lvl, l_max); + float coderate = srsran_pdcch_coderate(nof_bits, l); + while (factor * coderate > max_coderate and l < l_max) { + l++; coderate = srsran_pdcch_coderate(nof_bits, l); - if (factor * coderate <= max_coderate) { - break; - } } - // make aggregation level more conservative - l = std::min(l_max, l + 1); Debug("SCHED: CQI=%d, l=%d, nof_bits=%d, coderate=%.2f, max_coderate=%.2f", dl_cqi,