diff --git a/lib/src/phy/phch/test/CMakeLists.txt b/lib/src/phy/phch/test/CMakeLists.txt index 1de12d749..0c753d17e 100644 --- a/lib/src/phy/phch/test/CMakeLists.txt +++ b/lib/src/phy/phch/test/CMakeLists.txt @@ -124,8 +124,8 @@ target_link_libraries(pssch_pscch_file_test srslte_phy) add_test(pssch_pscch_file_test_ideal_tm2_p100 pssch_pscch_file_test -p 100 -d -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_ideal_tm2_p100_c335_s30.72e6.dat) set_property(TEST pssch_pscch_file_test_ideal_tm2_p100 PROPERTY PASS_REGULAR_EXPRESSION "num_decoded_sci=2 num_decoded_tb=1") -# TM4 file tests -add_test(pssch_pscch_file_test_ideal_tm4_p100 pssch_pscch_file_test -p 100 -t 4 -s 10 -n 10 -d -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_ideal_tm4_p100_c335_size10_num10_cshift0_s30.72e6.dat) +# TM4 file tests (first SF is sf_idx = 6 such that the PSSCH sf_idx=0) +add_test(pssch_pscch_file_test_ideal_tm4_p100 pssch_pscch_file_test -p 100 -t 4 -s 10 -n 10 -d -m 6 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_ideal_tm4_p100_c335_size10_num10_cshift0_s30.72e6.dat) set_property(TEST pssch_pscch_file_test_ideal_tm4_p100 PROPERTY PASS_REGULAR_EXPRESSION "num_decoded_sci=1 num_decoded_tb=1") add_test(pssch_pscch_test_tm4_p50_qc pssch_pscch_file_test -p 50 -t 4 -d -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_qc9150_f5.92e9_s15.36e6_50prb_20offset.dat) @@ -135,24 +135,24 @@ set_property(TEST pssch_pscch_test_tm4_p50_qc PROPERTY PASS_REGULAR_EXPRESSION " add_test(pssch_pscch_test_tm4_p50_cmw pssch_pscch_file_test -p 50 -t 4 -o 20 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_cmw500_f5.92e9_s11.52e6_50prb_0offset_1ms.dat) set_property(TEST pssch_pscch_test_tm4_p50_cmw PROPERTY PASS_REGULAR_EXPRESSION "num_decoded_sci=1 num_decoded_tb=1") -# With PHY retransmission (3 TTI offset) -add_test(pssch_pscch_test_tm4_p50_huawei pssch_pscch_file_test -p 50 -t 4 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_huawei_s11.52e6_50prb_10prb_offset_with_retx.dat) +# With PHY retransmission (3 TTI offset) first SF at sf_idx=5 +add_test(pssch_pscch_test_tm4_p50_huawei pssch_pscch_file_test -p 50 -t 4 -m 5 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_huawei_s11.52e6_50prb_10prb_offset_with_retx.dat) set_property(TEST pssch_pscch_test_tm4_p50_huawei PROPERTY PASS_REGULAR_EXPRESSION "num_decoded_sci=2 num_decoded_tb=2") # With PHY ReTx (0 TTI offset?) add_test(pssch_pscch_test_tm4_p50_uxm1 pssch_pscch_file_test -p 50 -d -t 4 -s 5 -n 10 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_uxm_s15.36e6_50prb_0prb_offset_mcs12.dat) set_property(TEST pssch_pscch_test_tm4_p50_uxm1 PROPERTY PASS_REGULAR_EXPRESSION "mcs=12.*num_decoded_sci=2 num_decoded_tb=2") -# 100 PRB startOffset 1 MCS12 MAC padding +# 100 PRB startOffset 1 MCS12 MAC padding, first SF is index 0 add_test(pssch_pscch_test_tm4_p100_uxm2 pssch_pscch_file_test -p 100 -t 4 -s 10 -n 10 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_uxm_s23.04e6_100prb_1prb_offset_mcs12_padding.dat) set_property(TEST pssch_pscch_test_tm4_p100_uxm2 PROPERTY PASS_REGULAR_EXPRESSION "mcs=12.*num_decoded_sci=4 num_decoded_tb=4") -# 100 PRB LTE sampling rate, startOffset1 MCS12 ITS data -add_test(pssch_pscch_test_tm4_p100_uxm3 pssch_pscch_file_test -p 100 -d -t 4 -s 10 -n 10 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_uxm_s30.72e6_100prb_1prb_offset_mcs12_its.dat) +# 100 PRB LTE sampling rate, startOffset1 MCS12 ITS data, first SF is index 6 +add_test(pssch_pscch_test_tm4_p100_uxm3 pssch_pscch_file_test -p 100 -d -t 4 -s 10 -n 10 -m 6 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_uxm_s30.72e6_100prb_1prb_offset_mcs12_its.dat) set_property(TEST pssch_pscch_test_tm4_p100_uxm3 PROPERTY PASS_REGULAR_EXPRESSION "mcs=12.*num_decoded_sci=1 num_decoded_tb=1") -# 50 PRB LTE sampling rate, startOffset0 MCS28 MAC padding -add_test(pssch_pscch_test_tm4_p50_uxm4 pssch_pscch_file_test -p 50 -d -t 4 -s 5 -n 10 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_uxm_s15.36e6_50prb_0prb_offset_mcs28_padding_5ms.dat) +# 50 PRB LTE sampling rate, startOffset0 MCS28 MAC padding, first SF is index 1 +add_test(pssch_pscch_test_tm4_p50_uxm4 pssch_pscch_file_test -p 50 -d -t 4 -s 5 -n 10 -m 1 -i ${CMAKE_HOME_DIRECTORY}/lib/src/phy/phch/test/signal_sidelink_uxm_s15.36e6_50prb_0prb_offset_mcs28_padding_5ms.dat) set_property(TEST pssch_pscch_test_tm4_p50_uxm4 PROPERTY PASS_REGULAR_EXPRESSION "mcs=28.*num_decoded_sci=5 num_decoded_tb=5") ######################################################################## diff --git a/lib/src/phy/phch/test/pssch_pscch_file_test.c b/lib/src/phy/phch/test/pssch_pscch_file_test.c index 1c8b61d10..ecc6e161d 100644 --- a/lib/src/phy/phch/test/pssch_pscch_file_test.c +++ b/lib/src/phy/phch/test/pssch_pscch_file_test.c @@ -55,6 +55,7 @@ static srslte_ofdm_t fft = {}; static srslte_sl_comm_resource_pool_t sl_comm_resource_pool = {}; static uint32_t size_sub_channel = 10; static uint32_t num_sub_channel = 5; +static uint32_t current_sf_idx = 0; static srslte_chest_sl_cfg_t pscch_chest_sl_cfg = {}; static srslte_chest_sl_cfg_t pssch_chest_sl_cfg = {}; @@ -69,6 +70,7 @@ void usage(char* prog) printf("\t-p nof_prb [Default %d]\n", cell.nof_prb); printf("\t-s size_sub_channel [Default for 50 prbs %d]\n", size_sub_channel); printf("\t-n num_sub_channel [Default for 50 prbs %d]\n", num_sub_channel); + printf("\t-m Subframe index [Default for %d]\n", current_sf_idx); printf("\t-e Extended CP [Default normal]\n"); printf("\t-t Sidelink transmission mode {1,2,3,4} [Default %d]\n", (cell.tm + 1)); printf("\t-d use_standard_lte_rates [Default %i]\n", use_standard_lte_rates); @@ -78,7 +80,7 @@ void usage(char* prog) void parse_args(int argc, char** argv) { int opt; - while ((opt = getopt(argc, argv, "deinopstv")) != -1) { + while ((opt = getopt(argc, argv, "deinmopstv")) != -1) { switch (opt) { case 'd': use_standard_lte_rates = true; @@ -98,6 +100,9 @@ void parse_args(int argc, char** argv) case 'n': num_sub_channel = (uint32_t)strtol(argv[optind], NULL, 10); break; + case 'm': + current_sf_idx = (uint32_t)strtol(argv[optind], NULL, 10); + break; case 'p': cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10); break; @@ -248,7 +253,6 @@ int main(int argc, char** argv) int nread = 0; uint32_t period_sf_idx = 0; - uint32_t pssch_sf_idx = 0; uint32_t allowed_pssch_sf_idx = 0; if (file_offset > 0) { @@ -307,7 +311,7 @@ int main(int argc, char** argv) } if ((sl_comm_resource_pool.pssch_sf_bitmap[period_sf_idx] == 1) && (sci_decoded == true)) { - if (srslte_ra_sl_pssch_allowed_sf(pssch_sf_idx, sci.trp_idx, SRSLTE_SL_DUPLEX_MODE_FDD, 0)) { + if (srslte_ra_sl_pssch_allowed_sf(current_sf_idx, sci.trp_idx, SRSLTE_SL_DUPLEX_MODE_FDD, 0)) { // Redundancy version uint32_t rv_idx = allowed_pssch_sf_idx % 4; @@ -319,14 +323,14 @@ int main(int argc, char** argv) // PSSCH Channel estimation pssch_chest_sl_cfg.N_x_id = sci.N_sa_id; - pssch_chest_sl_cfg.sf_idx = pssch_sf_idx; + pssch_chest_sl_cfg.sf_idx = current_sf_idx; pssch_chest_sl_cfg.prb_start_idx = pssch_prb_start_idx; pssch_chest_sl_cfg.nof_prb = nof_prb_pssch; srslte_chest_sl_set_cfg(&pssch_chest, pssch_chest_sl_cfg); srslte_chest_sl_ls_estimate_equalize(&pssch_chest, sf_buffer, equalized_sf_buffer); srslte_pssch_cfg_t pssch_cfg = { - pssch_prb_start_idx, nof_prb_pssch, sci.N_sa_id, sci.mcs_idx, rv_idx, pssch_sf_idx}; + pssch_prb_start_idx, nof_prb_pssch, sci.N_sa_id, sci.mcs_idx, rv_idx, current_sf_idx}; if (srslte_pssch_set_cfg(&pssch, pssch_cfg) == SRSLTE_SUCCESS) { if (srslte_pssch_decode(&pssch, equalized_sf_buffer, tb, SRSLTE_SL_SCH_MAX_TB_LEN) == SRSLTE_SUCCESS) { srslte_vec_fprint_byte(stdout, tb, pssch.sl_sch_tb_len); @@ -336,7 +340,7 @@ int main(int argc, char** argv) } allowed_pssch_sf_idx++; } - pssch_sf_idx++; + current_sf_idx++; } } else if (cell.tm == SRSLTE_SIDELINK_TM3 || cell.tm == SRSLTE_SIDELINK_TM4) { for (int sub_channel_idx = 0; sub_channel_idx < sl_comm_resource_pool.num_sub_channel; sub_channel_idx++) { @@ -368,6 +372,9 @@ int main(int argc, char** argv) uint32_t nof_prb_pssch = ((L_subCH + sub_channel_idx) * sl_comm_resource_pool.size_sub_channel) - pssch_prb_start_idx + sl_comm_resource_pool.start_prb_sub_channel; + // make sure PRBs are valid for DFT precoding + nof_prb_pssch = srslte_dft_precoding_get_valid_prb(nof_prb_pssch); + uint32_t N_x_id = 0; for (int j = 0; j < SRSLTE_SCI_CRC_LEN; j++) { N_x_id += pscch.sci_crc[j] * exp2(SRSLTE_SCI_CRC_LEN - 1 - j); @@ -380,14 +387,14 @@ int main(int argc, char** argv) // PSSCH Channel estimation pssch_chest_sl_cfg.N_x_id = N_x_id; - pssch_chest_sl_cfg.sf_idx = pssch_sf_idx; + pssch_chest_sl_cfg.sf_idx = current_sf_idx; pssch_chest_sl_cfg.prb_start_idx = pssch_prb_start_idx; pssch_chest_sl_cfg.nof_prb = nof_prb_pssch; srslte_chest_sl_set_cfg(&pssch_chest, pssch_chest_sl_cfg); srslte_chest_sl_ls_estimate_equalize(&pssch_chest, sf_buffer, equalized_sf_buffer); srslte_pssch_cfg_t pssch_cfg = { - pssch_prb_start_idx, nof_prb_pssch, N_x_id, sci.mcs_idx, rv_idx, pssch_sf_idx}; + pssch_prb_start_idx, nof_prb_pssch, N_x_id, sci.mcs_idx, rv_idx, current_sf_idx}; if (srslte_pssch_set_cfg(&pssch, pssch_cfg) == SRSLTE_SUCCESS) { if (srslte_pssch_decode(&pssch, equalized_sf_buffer, tb, SRSLTE_SL_SCH_MAX_TB_LEN) == SRSLTE_SUCCESS) { srslte_vec_fprint_byte(stdout, tb, pssch.sl_sch_tb_len); @@ -397,7 +404,10 @@ int main(int argc, char** argv) if (SRSLTE_VERBOSE_ISDEBUG()) { char filename[64]; snprintf(filename, 64, "pssch_rx_syms_sf%d.bin", num_subframes); - printf("Saving PSSCH symbols (%d) to %s\n", pssch.G / pssch.Qm, filename); + printf("Saving PSSCH symbols (%d) to %s (current_sf_idx=%d)\n", + pssch.G / pssch.Qm, + filename, + current_sf_idx); srslte_vec_save_file(filename, pssch.symbols, pssch.G / pssch.Qm * sizeof(cf_t)); } } @@ -416,7 +426,7 @@ int main(int argc, char** argv) } } } - pssch_sf_idx++; + current_sf_idx = (current_sf_idx + 1) % 10; } num_subframes++; period_sf_idx++;