sched,test: add test for CQI->MCS mapping fnc

Signed-off-by: Carlo Galiotto <carlo@srs.io>
master
Carlo Galiotto 3 years ago committed by carlo-gal
parent db983175a8
commit cd32f1385a

@ -150,6 +150,18 @@ SRSRAN_API int srsran_ra_ul_set_grant_uci_nr(const srsran_carrier_nr_t* carri
*/
SRSRAN_API uint32_t srsran_ra_nr_type1_riv(uint32_t N_rb, uint32_t start_rb, uint32_t length_rb);
/**
* @brief Returns the MCS corresponding to CQI
*
* Mapping is performed as: return the MCS that has the closest spectral efficiency to that of the CQI
* @param cqi CQI value
* @param srsran_csi_cqi_table_t CQI table index
* @param mcs_table MCS table parameter
* @param dci_format DCI format
* @param search_space_type Seach Space type
* @param rnti_type RNTI type
* @return The MCS index
*/
SRSRAN_API int srsran_ra_nr_cqi_to_mcs(uint8_t cqi,
srsran_csi_cqi_table_t cqi_table_idx,
srsran_mcs_table_t mcs_table,

@ -135,41 +135,29 @@ static const float ra_nr_beta_offset_csi_table[RA_NR_BETA_OFFSET_CSI_SIZE] = {
typedef enum { ra_nr_table_1 = 0, ra_nr_table_2, ra_nr_table_3 } ra_nr_table_t;
/**
* These tables map the CQI into the MCS, based on the spectral efficiency.
* The table below performs the mapping of the CQI into the closest MCS, based on the corresponding spectral efficiency.
* The mapping works as follows:
* - select spectral efficiency from the CQI from tables Table 5.2.2.1-2, Table 5.2.2.1-3, Table 5.2.2.1-4,
* - select spectral efficiency from the CQI from tables Table 5.2.2.1-2, Table 5.2.2.1-3, or Table 5.2.2.1-4,
* TS 38.214 V15.14.0
* - select MCS corresponding to same spectral efficiency from Table 5.1.3.1-1, Table 5.1.3.1-2, Table 5.1.3.1-3,
* - select MCS corresponding to same spectral efficiency from Table 5.1.3.1-1, Table 5.1.3.1-2, or Table 5.1.3.1-3,
* TS 38.214 V15.14.0
* The indices C_M (e.g, 1_1, 1_3, 3_2, etc.) refer to the CQI and MCS table, respectively.
* C = 1 -> Table 5.2.2.1-2; C = 2 -> Table 5.2.2.1-3, C = 2 -> Table 5.2.2.1-4
* M = 1 -> Table 5.1.3.1-1; M = 2 -> Table 5.1.3.1-2; M = 3 -> Table 5.1.3.1-3
*
* The array ra_nr_cqi_to_mcs_table[CQI_table_idx][MCS_table_idx][CQI] contains the MCS corresponding to CQI, based on
* the given CQI_table_idx and MCS_table_idx tables
* CQI_table_idx: 1 -> Table 5.2.2.1-2; 2 -> Table 5.2.2.1-3, 3 -> Table 5.2.2.1-4
* CQI_table_idx: 1 -> Table 5.1.3.1-1; 2 -> Table 5.1.3.1-2; 3 -> Table 5.1.3.1-3
*/
#if 0
typedef const int nr_cqi_to_mcs_table[RA_NR_CQI_SIZE_TABLE];
static nr_cqi_to_mcs_table ra_nr_cqi_to_mcs_table_1_1 = {-1, 0, 0, 2, 4, 6, 8, 11, 13, 15, 18, 20, 22, 24, 26, 28};
static nr_cqi_to_mcs_table ra_nr_cqi_to_mcs_table_2_1 = {-1, 0, 2, 6, 11, 13, 15, 18, 20, 22, 24, 26, 28, 28, 28, 28};
static nr_cqi_to_mcs_table ra_nr_cqi_to_mcs_table_3_1 = {-1, 0, 0, 0, 0, 2, 4, 6, 8, 11, 13, 15, 18, 20, 22, 24};
static nr_cqi_to_mcs_table ra_nr_cqi_to_mcs_table_1_2 = {-1, 0, 0, 1, 2, 3, 4, 5, 7, 9, 11, 13, 15, 17, 19, 21};
static nr_cqi_to_mcs_table ra_nr_cqi_to_mcs_table_2_2 = {-1, 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27};
static nr_cqi_to_mcs_table ra_nr_cqi_to_mcs_table_3_2 = {-1, 0, 0, 0, 0, 1, 2, 3, 4, 5, 7, 9, 11, 13, 15, 17};
static nr_cqi_to_mcs_table ra_nr_cqi_to_mcs_table_1_3 = {-1, 4, 8, 12, 16, 18, 20, 22, 24, 26, 28, 28, 28, 28, 28, 28};
static nr_cqi_to_mcs_table ra_nr_cqi_to_mcs_table_2_3 = {-1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28};
static nr_cqi_to_mcs_table ra_nr_cqi_to_mcs_table_3_3 = {-1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28};
#endif
static int ra_nr_cqi_to_mcs_table[3][3][RA_NR_CQI_SIZE_TABLE] = {
/* ROW 1 - CQI Table 1 */
{/* MCS Table 1 */ {-1, 0, 0, 2, 4, 6, 8, 11, 13, 15, 18, 20, 22, 24, 26, 28},
/* MCS Table 2 */ {-1, 0, 0, 1, 2, 3, 4, 5, 7, 9, 11, 13, 15, 17, 19, 21},
/* MCS Table 3 */ {-1, 4, 8, 12, 16, 18, 20, 22, 24, 26, 28, 28, 28, 28, 28, 28}},
/* MCS Table 3 */ {-1, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 28, 28}},
/* ROW 2 - CQI Table 2 */
{/* MCS Table 1 */ {-1, 0, 2, 6, 11, 13, 15, 18, 20, 22, 24, 26, 28, 28, 28, 28},
/* MCS Table 2 */ {-1, 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27},
/* MCS Table 3 */ {-1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28}},
/* ROW 1 - CQI Table 3 */
/* MCS Table 3 */ {-1, 4, 8, 12, 16, 18, 20, 22, 24, 26, 28, 28, 28, 28, 28, 28}},
/* ROW 3 - CQI Table 3 */
{/* MCS Table 1 */ {-1, 0, 0, 0, 0, 2, 4, 6, 8, 11, 13, 15, 18, 20, 22, 24},
/* MCS Table 2 */ {-1, 0, 0, 0, 0, 1, 2, 3, 4, 5, 7, 9, 11, 13, 15, 17},
/* MCS Table 3 */ {-1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28}}};

@ -40,6 +40,10 @@ add_executable(sched_nr_rar_test sched_nr_rar_test.cc)
target_link_libraries(sched_nr_rar_test srsgnb_mac sched_nr_test_suite srsran_common)
add_nr_test(sched_nr_rar_test sched_nr_rar_test)
add_executable(sched_nr_utilities_tests sched_nr_utilities_tests.cc)
target_link_libraries(sched_nr_utilities_tests srsgnb_mac srsran_common srsran_phch)
add_nr_test(sched_nr_utilities_tests sched_nr_utilities_tests)
add_executable(sched_nr_test sched_nr_test.cc)
target_link_libraries(sched_nr_test
srsgnb_mac

@ -0,0 +1,220 @@
//
// Created by carlo on 9/12/21.
//
#include "srsran/common/test_common.h"
extern "C" {
#include "srsran/phy/phch/ra_nr.h"
}
void test_cqi_to_mcs()
{
// Sample random CQI values and test the returned MCS, for different combinations of CQI and MCS tables
// Set the parameters so that to select a given MCS table (1, 2, or 3)
// TEST CQI Table 1 - MCS table 1
int mcs = srsran_ra_nr_cqi_to_mcs(/* cqi */ 3,
/* cqi_table_idx */ SRSRAN_CSI_CQI_TABLE_1,
/* mcs_table */ srsran_mcs_table_64qam,
/* dci_format */ srsran_dci_format_nr_1_0,
/* search_space_type*/ srsran_search_space_type_ue,
/* rnti_type */ srsran_rnti_type_c);
TESTASSERT_EQ(2, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(5,
SRSRAN_CSI_CQI_TABLE_1,
srsran_mcs_table_64qam,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(6, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(9,
SRSRAN_CSI_CQI_TABLE_1,
srsran_mcs_table_64qam,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(15, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(12,
SRSRAN_CSI_CQI_TABLE_1,
srsran_mcs_table_64qam,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(22, mcs);
// TEST CQI Table 2 - MCS table 2
mcs = srsran_ra_nr_cqi_to_mcs(1,
SRSRAN_CSI_CQI_TABLE_2,
srsran_mcs_table_256qam,
srsran_dci_format_nr_1_1,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(0, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(4,
SRSRAN_CSI_CQI_TABLE_2,
srsran_mcs_table_256qam,
srsran_dci_format_nr_1_1,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(5, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(7,
SRSRAN_CSI_CQI_TABLE_2,
srsran_mcs_table_256qam,
srsran_dci_format_nr_1_1,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(11, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(11,
SRSRAN_CSI_CQI_TABLE_2,
srsran_mcs_table_256qam,
srsran_dci_format_nr_1_1,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(19, mcs);
// TEST CQI Table 3 - MCS table 3
mcs = srsran_ra_nr_cqi_to_mcs(2,
SRSRAN_CSI_CQI_TABLE_3,
srsran_mcs_table_qam64LowSE,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(2, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(8,
SRSRAN_CSI_CQI_TABLE_3,
srsran_mcs_table_qam64LowSE,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(14, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(13,
SRSRAN_CSI_CQI_TABLE_3,
srsran_mcs_table_qam64LowSE,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(24, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(15,
SRSRAN_CSI_CQI_TABLE_3,
srsran_mcs_table_qam64LowSE,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(28, mcs);
// TEST CQI Table 1 - MCS table 2
mcs = srsran_ra_nr_cqi_to_mcs(6,
SRSRAN_CSI_CQI_TABLE_1,
srsran_mcs_table_256qam,
srsran_dci_format_nr_1_1,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(4, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(14,
SRSRAN_CSI_CQI_TABLE_1,
srsran_mcs_table_256qam,
srsran_dci_format_nr_1_1,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(19, mcs);
// TEST CQI Table 1 - MCS table 3
mcs = srsran_ra_nr_cqi_to_mcs(7,
SRSRAN_CSI_CQI_TABLE_1,
srsran_mcs_table_qam64LowSE,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(16, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(10,
SRSRAN_CSI_CQI_TABLE_1,
srsran_mcs_table_qam64LowSE,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(22, mcs);
// TEST CQI Table 2 - MCS table 1
mcs = srsran_ra_nr_cqi_to_mcs(3,
SRSRAN_CSI_CQI_TABLE_2,
srsran_mcs_table_64qam,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(6, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(11,
SRSRAN_CSI_CQI_TABLE_2,
srsran_mcs_table_64qam,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(26, mcs);
// TEST CQI Table 2 - MCS table 3
mcs = srsran_ra_nr_cqi_to_mcs(7,
SRSRAN_CSI_CQI_TABLE_2,
srsran_mcs_table_qam64LowSE,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(22, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(10,
SRSRAN_CSI_CQI_TABLE_2,
srsran_mcs_table_qam64LowSE,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(28, mcs);
// TEST CQI Table 3 - MCS table 1
mcs = srsran_ra_nr_cqi_to_mcs(2,
SRSRAN_CSI_CQI_TABLE_3,
srsran_mcs_table_64qam,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(0, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(13,
SRSRAN_CSI_CQI_TABLE_3,
srsran_mcs_table_64qam,
srsran_dci_format_nr_1_0,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(20, mcs);
// TEST CQI Table 3 - MCS table 2
mcs = srsran_ra_nr_cqi_to_mcs(5,
SRSRAN_CSI_CQI_TABLE_3,
srsran_mcs_table_256qam,
srsran_dci_format_nr_1_1,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(1, mcs);
mcs = srsran_ra_nr_cqi_to_mcs(14,
SRSRAN_CSI_CQI_TABLE_3,
srsran_mcs_table_256qam,
srsran_dci_format_nr_1_1,
srsran_search_space_type_ue,
srsran_rnti_type_c);
TESTASSERT_EQ(15, mcs);
}
int main()
{
test_cqi_to_mcs();
}
Loading…
Cancel
Save