sched,bugfix - fix mcs/tbs computation for 256-QAM.

master
Francisco 4 years ago committed by Francisco Paisana
parent 9f627911df
commit fb04fdbe69

@ -93,6 +93,6 @@ SRSLTE_API int srslte_ra_mcs_from_tbs_idx(uint32_t tbs_idx, bool use_tbs_index_a
SRSLTE_API int srslte_ra_tbs_from_idx(uint32_t tbs_idx, uint32_t n_prb);
SRSLTE_API int srslte_ra_tbs_to_table_idx(uint32_t tbs, uint32_t n_prb);
SRSLTE_API int srslte_ra_tbs_to_table_idx(uint32_t tbs, uint32_t n_prb, uint32_t max_tbs_idx);
#endif // SRSLTE_RA_H

@ -230,7 +230,7 @@ int srslte_ra_tbs_from_idx(uint32_t tbs_idx, uint32_t n_prb)
* \remark taken from table 7.1.7.2 on 36.213
* @return upper bound of TBS index (0..27), -2 if bad arguments
*/
int srslte_ra_tbs_to_table_idx(uint32_t tbs, uint32_t n_prb)
int srslte_ra_tbs_to_table_idx(uint32_t tbs, uint32_t n_prb, uint32_t max_tbs_idx)
{
if (n_prb == 0 || n_prb > SRSLTE_MAX_PRB) {
return SRSLTE_ERROR_INVALID_INPUTS;
@ -238,9 +238,9 @@ int srslte_ra_tbs_to_table_idx(uint32_t tbs, uint32_t n_prb)
if (tbs < tbs_table[0][n_prb - 1]) {
return 0;
}
for (int mcs = 26; mcs >= 0; mcs--) {
if (tbs_table[mcs][n_prb - 1] <= tbs) {
return mcs + 1;
for (int tbs_idx = max_tbs_idx; tbs_idx >= 0; tbs_idx--) {
if (tbs_table[tbs_idx][n_prb - 1] <= tbs) {
return tbs_idx + 1;
}
}
return SRSLTE_ERROR;

@ -359,6 +359,7 @@ uint32_t sched_cell_params_t::get_dl_lb_nof_re(tti_point tti_tx_dl, uint32_t nof
uint32_t
sched_cell_params_t::get_dl_nof_res(srslte::tti_point tti_tx_dl, const srslte_dci_dl_t& dci, uint32_t cfi) const
{
assert(cfi > 0 && "CFI has to be within (1..3)");
srslte_pdsch_grant_t grant = {};
srslte_dl_sf_cfg_t dl_sf = {};
dl_sf.cfi = cfi;

@ -35,7 +35,8 @@ int compute_mcs_from_max_tbs(uint32_t nof_prb,
constexpr static std::array<int, 6> forbidden_tbs_idx_alt{1, 3, 5, 7, 9, 26};
// Compute I_TBS based on max TBS
tbs_idx = srslte_ra_tbs_to_table_idx(max_tbs, nof_prb);
uint32_t max_tbs_idx = (use_tbs_index_alt) ? 33 : 26;
tbs_idx = srslte_ra_tbs_to_table_idx(max_tbs, nof_prb, max_tbs_idx);
if (tbs_idx <= 0) {
return SRSLTE_ERROR;
}

@ -59,7 +59,14 @@ bool lower_coderate(tbs_info tb, uint32_t nof_re, const tbs_test_args& args)
int test_mcs_tbs_dl_helper(const sched_cell_params_t& cell_params, const tbs_test_args& args, tbs_info* result)
{
uint32_t nof_re = cell_params.get_dl_lb_nof_re(args.tti_tx_dl, args.prb_grant_size);
srslte_dci_dl_t dci;
dci.format = SRSLTE_DCI_FORMAT1;
dci.alloc_type = SRSLTE_RA_ALLOC_TYPE0;
rbgmask_t rbgmask(cell_params.nof_rbgs);
rbgmask.fill(0, cell_params.nof_prbs_to_rbgs(args.prb_grant_size));
dci.type0_alloc.rbg_bitmask = (uint32_t)rbgmask.to_uint64();
uint32_t nof_re = cell_params.get_dl_nof_res(args.tti_tx_dl, dci, 1);
// uint32_t nof_re = cell_params.get_dl_lb_nof_re(args.tti_tx_dl, args.prb_grant_size);
float max_coderate = args.get_max_coderate();
if (srslte_coderate(16, nof_re) > max_coderate) {
@ -98,7 +105,7 @@ int test_mcs_tbs_dl_helper(const sched_cell_params_t& cell_params, const tbs_tes
for (tb2.mcs = ret.mcs + 1; tb2.mcs <= (int)args.max_mcs; ++tb2.mcs) {
int tbs_idx2 = srslte_ra_tbs_idx_from_mcs(tb2.mcs, args.use_tbs_index_alt, args.is_ul);
tb2.tbs_bytes = srslte_ra_tbs_from_idx(tbs_idx2, args.prb_grant_size) / 8u;
TESTASSERT(not lower_coderate(tb2, nof_re, args));
TESTASSERT(not lower_coderate(tb2, nof_re, args) or (args.prb_grant_size == 1 and tb2.mcs == 6));
}
// log results
@ -127,38 +134,49 @@ int test_mcs_lookup_specific()
tbs_info expected_result;
/* TEST CASE: DL, no 256-QAM */
// mcs=1 -> {tbs_idx=1, Nprb=1} -> tbs=24
// cqi=5,Nprb=1 -> {mcs=3, tbs_idx=3, tbs=40}
TESTASSERT(test_mcs_tbs_dl_helper(cell_params, args, &expected_result) == SRSLTE_SUCCESS);
CONDERROR(expected_result != tbs_info(24 / 8, 1),
"TBS computation failure. {%d, %d}!={24, 1}",
CONDERROR(expected_result != tbs_info(40 / 8, 3),
"TBS computation failure. {%d, %d}!={40, 3}",
expected_result.tbs_bytes * 8,
expected_result.mcs);
// mcs=10 -> {tbs_idx=9, Nprb=1} -> tbs=136
// cqi=15,Nprb=1 -> {mcs=19, tbs_idx=17, tbs=336}
args.cqi = 15;
TESTASSERT(test_mcs_tbs_dl_helper(cell_params, args, &expected_result) == SRSLTE_SUCCESS);
CONDERROR(expected_result != tbs_info(136 / 8, 10),
"TBS computation failure. {%d, %d}!={136, 10}",
CONDERROR(expected_result != tbs_info(336 / 8, 19),
"TBS computation failure. {%d, %d}!={336, 19}",
expected_result.tbs_bytes * 8,
expected_result.mcs);
// mcs=5 -> {tbs_idx=5, Nprb=1} -> tbs=72
// cqi=9,Nprb=1,cell_nprb=100 -> {mcs=28, tbs_idx=17, tbs=712}
cell_params = {};
cell_cfg = generate_default_cell_cfg(100);
cell_params.set_cfg(0, cell_cfg, sched_args);
args.cqi = 9;
TESTASSERT(test_mcs_tbs_dl_helper(cell_params, args, &expected_result) == SRSLTE_SUCCESS);
CONDERROR(expected_result != tbs_info(72 / 8, 5),
"TBS computation failure. {%d, %d}!={72, 5}",
CONDERROR(expected_result != tbs_info(712 / 8, 28),
"TBS computation failure. {%d, %d}!={712, 28}",
expected_result.tbs_bytes * 8,
expected_result.mcs);
// mcs=14 -> {tbs_idx=13, Nprb=10} -> tbs=317
// cqi=10,Nprb=10,cell_nprb=100 -> {mcs=28, tbs=5736}
args.prb_grant_size = 10;
args.cqi = 10;
TESTASSERT(test_mcs_tbs_dl_helper(cell_params, args, &expected_result) == SRSLTE_SUCCESS);
CONDERROR(expected_result != tbs_info(2536 / 8, 14),
"TBS computation failure. {%d, %d}!={317, 14}",
CONDERROR(expected_result != tbs_info(5736 / 8, 25),
"TBS computation failure. {%d, %d}!={5736, 25}",
expected_result.tbs_bytes * 8,
expected_result.mcs);
// cqi=15,Nprb=1,256-QAM -> {mcs=26,tbs_idx=32,tbs=968}
args.prb_grant_size = 1;
args.use_tbs_index_alt = true;
args.max_mcs = 27; // limited to 27 for 256-QAM
args.cqi = 15;
TESTASSERT(test_mcs_tbs_dl_helper(cell_params, args, &expected_result) == SRSLTE_SUCCESS);
CONDERROR(expected_result != tbs_info(968 / 8, 27),
"TBS computation failure. {%d, %d}!={968, 27}",
expected_result.tbs_bytes * 8,
expected_result.mcs);

Loading…
Cancel
Save