Fix NR-SCH test

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 39e97cbcf4
commit 3504bfcf5a

@ -622,7 +622,14 @@ add_nr_test(pucch_nr_test pucch_nr_test)
add_executable(sch_nr_test sch_nr_test.c) add_executable(sch_nr_test sch_nr_test.c)
target_link_libraries(sch_nr_test srsran_phy) target_link_libraries(sch_nr_test srsran_phy)
add_nr_test(sch_nr_test sch_nr_test -m 0 -p 1) add_nr_test(sch_nr_test sch_nr_test -P 52 -p 1 -r 0)
add_nr_test(sch_nr_test sch_nr_test -P 52 -p 1 -r 1)
add_nr_test(sch_nr_test sch_nr_test -P 52 -p 10 -r 0)
add_nr_test(sch_nr_test sch_nr_test -P 52 -p 10 -r 1)
add_nr_test(sch_nr_test sch_nr_test -P 52 -p 20 -r 0)
add_nr_test(sch_nr_test sch_nr_test -P 52 -p 20 -r 1)
add_nr_test(sch_nr_test sch_nr_test -P 52 -p 52 -r 0)
add_nr_test(sch_nr_test sch_nr_test -P 52 -p 52 -r 1)
add_executable(pdsch_nr_test pdsch_nr_test.c) add_executable(pdsch_nr_test pdsch_nr_test.c)
target_link_libraries(pdsch_nr_test srsran_phy) target_link_libraries(pdsch_nr_test srsran_phy)

@ -28,13 +28,15 @@ static srsran_carrier_nr_t carrier = {
static uint32_t n_prb = 0; // Set to 0 for steering static uint32_t n_prb = 0; // Set to 0 for steering
static uint32_t mcs = 30; // Set to 30 for steering static uint32_t mcs = 30; // Set to 30 for steering
static uint32_t rv = 4; // Set to 30 for steering
static srsran_sch_cfg_nr_t pdsch_cfg = {}; static srsran_sch_cfg_nr_t pdsch_cfg = {};
static srsran_sch_grant_nr_t pdsch_grant = {};
void usage(char* prog) static void usage(char* prog)
{ {
printf("Usage: %s [pTL] \n", prog); printf("Usage: %s [pTL] \n", prog);
printf("\t-P Number of carrier PRB [Default %d]\n", carrier.nof_prb);
printf("\t-p Number of grant PRB, set to 0 for steering [Default %d]\n", n_prb); printf("\t-p Number of grant PRB, set to 0 for steering [Default %d]\n", n_prb);
printf("\t-r Redundancy version, set to 4 or higher for steering [Default %d]\n", rv);
printf("\t-m MCS PRB, set to >28 for steering [Default %d]\n", mcs); printf("\t-m MCS PRB, set to >28 for steering [Default %d]\n", mcs);
printf("\t-T Provide MCS table (64qam, 256qam, 64qamLowSE) [Default %s]\n", printf("\t-T Provide MCS table (64qam, 256qam, 64qamLowSE) [Default %s]\n",
srsran_mcs_table_to_str(pdsch_cfg.sch_cfg.mcs_table)); srsran_mcs_table_to_str(pdsch_cfg.sch_cfg.mcs_table));
@ -45,8 +47,11 @@ void usage(char* prog)
int parse_args(int argc, char** argv) int parse_args(int argc, char** argv)
{ {
int opt; int opt;
while ((opt = getopt(argc, argv, "pmTLv")) != -1) { while ((opt = getopt(argc, argv, "PpmTLv")) != -1) {
switch (opt) { switch (opt) {
case 'P':
carrier.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break;
case 'p': case 'p':
n_prb = (uint32_t)strtol(argv[optind], NULL, 10); n_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
@ -132,12 +137,12 @@ int main(int argc, char** argv)
} }
// Use grant default A time resources with m=0 // Use grant default A time resources with m=0
if (srsran_ra_dl_nr_time_default_A(0, pdsch_cfg.dmrs.typeA_pos, &pdsch_grant) < SRSRAN_SUCCESS) { if (srsran_ra_dl_nr_time_default_A(0, pdsch_cfg.dmrs.typeA_pos, &pdsch_cfg.grant) < SRSRAN_SUCCESS) {
ERROR("Error loading default grant"); ERROR("Error loading default grant");
goto clean_exit; goto clean_exit;
} }
pdsch_grant.nof_layers = carrier.max_mimo_layers; pdsch_cfg.grant.nof_layers = carrier.max_mimo_layers;
pdsch_grant.dci_format = srsran_dci_format_nr_1_0; pdsch_cfg.grant.dci_format = srsran_dci_format_nr_1_0;
uint32_t n_prb_start = 1; uint32_t n_prb_start = 1;
uint32_t n_prb_end = carrier.nof_prb + 1; uint32_t n_prb_end = carrier.nof_prb + 1;
@ -146,6 +151,13 @@ int main(int argc, char** argv)
n_prb_end = SRSRAN_MIN(n_prb + 1, n_prb_end); n_prb_end = SRSRAN_MIN(n_prb + 1, n_prb_end);
} }
uint32_t rv_start = 0;
uint32_t rv_end = 4;
if (rv < 4) {
rv_start = rv;
rv_end = rv + 1;
}
uint32_t mcs_start = 0; uint32_t mcs_start = 0;
uint32_t mcs_end = pdsch_cfg.sch_cfg.mcs_table == srsran_mcs_table_256qam ? 28 : 29; uint32_t mcs_end = pdsch_cfg.sch_cfg.mcs_table == srsran_mcs_table_256qam ? 28 : 29;
if (mcs < mcs_end) { if (mcs < mcs_end) {
@ -155,12 +167,20 @@ int main(int argc, char** argv)
for (n_prb = n_prb_start; n_prb < n_prb_end; n_prb++) { for (n_prb = n_prb_start; n_prb < n_prb_end; n_prb++) {
for (mcs = mcs_start; mcs < mcs_end; mcs++) { for (mcs = mcs_start; mcs < mcs_end; mcs++) {
for (rv = rv_start; rv < rv_end; rv++) {
for (uint32_t n = 0; n < SRSRAN_MAX_PRB_NR; n++) { for (uint32_t n = 0; n < SRSRAN_MAX_PRB_NR; n++) {
pdsch_grant.prb_idx[n] = (n < n_prb); pdsch_cfg.grant.prb_idx[n] = (n < n_prb);
}
if (srsran_ra_dl_nr_nof_dmrs_cdm_groups_without_data_format_1_0(&pdsch_cfg.dmrs, &pdsch_cfg.grant) <
SRSRAN_SUCCESS) {
ERROR("Error calculating number of DMRS CDM groups");
goto clean_exit;
} }
srsran_sch_tb_t tb = {}; srsran_sch_tb_t tb = {};
if (srsran_ra_nr_fill_tb(&pdsch_cfg, &pdsch_grant, mcs, &tb) < SRSRAN_SUCCESS) { tb.rv = rv;
if (srsran_ra_nr_fill_tb(&pdsch_cfg, &pdsch_cfg.grant, mcs, &tb) < SRSRAN_SUCCESS) {
ERROR("Error filing tb"); ERROR("Error filing tb");
goto clean_exit; goto clean_exit;
} }
@ -189,6 +209,7 @@ int main(int argc, char** argv)
goto clean_exit; goto clean_exit;
} }
if (rv == 0) {
if (!crc) { if (!crc) {
ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, tb.tbs); ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, tb.tbs);
goto clean_exit; goto clean_exit;
@ -202,8 +223,10 @@ int main(int argc, char** argv)
srsran_vec_fprint_byte(stdout, data_rx, tb.tbs / 8); srsran_vec_fprint_byte(stdout, data_rx, tb.tbs / 8);
goto clean_exit; goto clean_exit;
} }
}
printf("n_prb=%d; mcs=%d; TBS=%d; PASSED!\n", n_prb, mcs, tb.tbs); INFO("n_prb=%d; mcs=%d; rv=%d TBS=%d; PASSED!\n", n_prb, mcs, rv, tb.tbs);
}
} }
} }
@ -228,5 +251,5 @@ clean_exit:
srsran_softbuffer_tx_free(&softbuffer_tx); srsran_softbuffer_tx_free(&softbuffer_tx);
srsran_softbuffer_rx_free(&softbuffer_rx); srsran_softbuffer_rx_free(&softbuffer_rx);
return SRSRAN_SUCCESS; return ret;
} }

Loading…
Cancel
Save