diff --git a/.launch/.gitignore b/.launch/.gitignore new file mode 100644 index 0000000..a2be07b --- /dev/null +++ b/.launch/.gitignore @@ -0,0 +1 @@ +/cxs_tlm single-packet.launch diff --git a/.launch/cxs_tlm.launch b/.launch/cxs_tlm.launch index 403e3df..73588d7 100644 --- a/.launch/cxs_tlm.launch +++ b/.launch/cxs_tlm.launch @@ -30,7 +30,7 @@ - + diff --git a/scc b/scc index 4429911..3b715da 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 4429911c18aa91eeab9e902f488e86aca6060237 +Subproject commit 3b715da553833b807e6fd63740a4e62a5796ab7c diff --git a/tests/cxs_tlm/csx_packet_test.cpp b/tests/cxs_tlm/csx_packet_test.cpp index 4e2c492..39ace08 100644 --- a/tests/cxs_tlm/csx_packet_test.cpp +++ b/tests/cxs_tlm/csx_packet_test.cpp @@ -12,11 +12,10 @@ factory::add> tb8; factory::add> tb9; factory::add> tb10; -template unsigned run_scenario(STATE& state, unsigned burst_factor = 0) { +template unsigned run_scenario(STATE& state) { auto& dut = factory::get>(); - if(burst_factor) - dut.tx.burst_len.set_value(burst_factor); - dut.rx.max_credit.set_value(5); + dut.tx.burst_len.set_value(state.burst_factor); + dut.rx.max_credit.set_value(state.credits); dut.rst.write(true); sc_start(state.reset_cycles * dut.clk.period()); dut.rst.write(false); @@ -67,7 +66,7 @@ template unsigned run_scenario(STATE& state, un return cycles; } -template unsigned run_scenario(int width, STATE& state, unsigned burst_factor = 0) { +template unsigned run_scenario(int width, STATE& state) { switch(width) { case 8: case 256: @@ -85,32 +84,40 @@ template unsigned run_scenario(int width, STATE& state, unsigne TEST_CASE("single-packet", "[CXS][tlm-level]") { struct { unsigned int reset_cycles{4}; - unsigned int max_cycles = 5000; + unsigned int max_cycles = 20000; std::vector packet_sizes; unsigned granularity{1}; unsigned resp_cnt{0}; + unsigned burst_factor{1}; + unsigned credits{1}; } state; state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024}); + std::array credits{1, 4, 15}; for(auto width = 8; width < 11; ++width) { - state.resp_cnt = 0; - auto cycles = run_scenario(width, state); + for(auto credit : credits) { + state.resp_cnt = 0; + state.credits = credit; + auto cycles = run_scenario(width, state); - REQUIRE(cycles < state.max_cycles); - REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); - REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + REQUIRE(cycles < state.max_cycles); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); - REQUIRE(state.resp_cnt == state.packet_sizes.size()); + REQUIRE(state.resp_cnt == state.packet_sizes.size()); + } } } TEST_CASE("multi-packet", "[CXS][tlm-level]") { struct { unsigned int reset_cycles{4}; - unsigned int max_cycles = 5000; + unsigned int max_cycles = 20000; std::vector packet_sizes; unsigned granularity{2}; unsigned resp_cnt{0}; + unsigned burst_factor{1}; + unsigned credits{15}; } state; state.packet_sizes.assign({4, 8, 16, 32, 16, 64, 16, 128, 16, 256, 16, 1024}); @@ -128,16 +135,18 @@ TEST_CASE("multi-packet", "[CXS][tlm-level]") { TEST_CASE("single-packet-burst2", "[CXS][tlm-level]") { struct { unsigned int reset_cycles{4}; - unsigned int max_cycles = 5000; + unsigned int max_cycles = 20000; std::vector packet_sizes; unsigned granularity{1}; unsigned resp_cnt{0}; + unsigned burst_factor{2}; + unsigned credits{2}; } state; state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024}); for(auto width = 8; width < 11; ++width) { state.resp_cnt = 0; - auto cycles = run_scenario(width, state, 2); + auto cycles = run_scenario(width, state); REQUIRE(cycles < state.max_cycles); REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); @@ -150,16 +159,18 @@ TEST_CASE("single-packet-burst2", "[CXS][tlm-level]") { TEST_CASE("multi-packet-burst2", "[CXS][tlm-level]") { struct { unsigned int reset_cycles{4}; - unsigned int max_cycles = 5000; + unsigned int max_cycles = 20000; std::vector packet_sizes; unsigned granularity{2}; unsigned resp_cnt{0}; + unsigned burst_factor{2}; + unsigned credits{2}; } state; state.packet_sizes.assign({4, 8, 16, 32, 16, 64, 16, 128, 16, 256, 16, 1024}); for(auto width = 8; width < 11; ++width) { state.resp_cnt = 0; - auto cycles = run_scenario(width, state, 2); + auto cycles = run_scenario(width, state); REQUIRE(cycles < state.max_cycles); REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); diff --git a/tests/cxs_tlm/testbench.h b/tests/cxs_tlm/testbench.h index 2982a0c..77cead5 100644 --- a/tests/cxs_tlm/testbench.h +++ b/tests/cxs_tlm/testbench.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -69,7 +70,7 @@ template struct testbench : public sc_core::sc_module { tlm::tlm_sync_enum nb_transport_fw(transaction_type& trans, phase_type& phase, sc_core::sc_time& t) { if(phase == tlm::nw::REQUEST) { - SCCINFO(SCMOD) << "Received non-blocking transaction with phase " << phase.get_name(); + SCCDEBUG(SCMOD) << "Received non-blocking transaction with phase " << phase.get_name(); recv.push_back(&trans); phase = tlm::nw::CONFIRM; return tlm::TLM_UPDATED;