diff --git a/srslte/include/srslte/phch/ra.h b/srslte/include/srslte/phch/ra.h index c8282ed1b..6b002c9ed 100644 --- a/srslte/include/srslte/phch/ra.h +++ b/srslte/include/srslte/phch/ra.h @@ -219,6 +219,8 @@ SRSLTE_API int srslte_ul_dci_to_grant_prb_allocation(srslte_ra_ul_dci_t *dci, uint32_t n_rb_ho, uint32_t nof_prb); +SRSLTE_API int srslte_ra_tbs_idx_from_mcs(uint32_t mcs); + SRSLTE_API int srslte_ra_tbs_from_idx(uint32_t tbs_idx, uint32_t n_prb); diff --git a/srslte/lib/phch/src/ra.c b/srslte/lib/phch/src/ra.c index b5915a946..573f724e3 100644 --- a/srslte/lib/phch/src/ra.c +++ b/srslte/lib/phch/src/ra.c @@ -549,6 +549,15 @@ uint32_t srslte_ra_type2_n_vrb_dl(uint32_t nof_prb, bool ngap_is_1) { } } +/* Modulation and TBS index table for PDSCH from 3GPP TS 36.213 v10.3.0 table 7.1.7.1-1 */ +int srslte_ra_tbs_idx_from_mcs(uint32_t mcs) { + if(mcs < 29) { + return mcs_tbs_idx_table[mcs]; + } else { + return SRSLTE_ERROR; + } +} + /* Table 7.1.7.2.1-1: Transport block size table on 36.213 */ int srslte_ra_tbs_from_idx(uint32_t tbs_idx, uint32_t n_prb) { if (tbs_idx < 27 && n_prb > 0 && n_prb <= SRSLTE_MAX_PRB) { diff --git a/srslte/lib/phch/src/tbs_tables.h b/srslte/lib/phch/src/tbs_tables.h index 1563fb2e0..636bc67f2 100644 --- a/srslte/lib/phch/src/tbs_tables.h +++ b/srslte/lib/phch/src/tbs_tables.h @@ -4,6 +4,11 @@ const int tbs_format1c_table[32] = { 552, 600, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1224, 1288, 1384, 1480, 1608, 1736 }; +/* Modulation and TBS index table for PDSCH from 3GPP TS 36.213 v10.3.0 table 7.1.7.1-1 */ +const int mcs_tbs_idx_table[29] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26}; + /* Transport Block Size from 3GPP TS 36.213 v10.3.0 table 7.1.7.2.1-1 */ const int tbs_table[27][110] = {{ 16, 32, 56, 88, 120, 152, 176, 208, 224, 256, 288,