diff --git a/scc b/scc index 331b6d7..d6f2a80 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 331b6d77ea5f9aed99bd0963a3bb234cf7c98b07 +Subproject commit d6f2a80b1b8aa49506fd6e37e21c38149bcc3ba6 diff --git a/tests/cxs_tlm/csx_packet_test.cpp b/tests/cxs_tlm/csx_packet_test.cpp index 8000a57..8bfdcf3 100644 --- a/tests/cxs_tlm/csx_packet_test.cpp +++ b/tests/cxs_tlm/csx_packet_test.cpp @@ -13,9 +13,10 @@ factory::add> tb8; factory::add> tb9; factory::add> tb10; -template unsigned run_scenario(STATE& state) { +template unsigned run_scenario(STATE& state, unsigned burst_factor = 0) { auto& dut = factory::get>(); - + if(burst_factor) + dut.tx.burst_len.set_value(burst_factor); dut.rst.write(true); sc_start(state.reset_cycles * dut.clk.period()); dut.rst.write(false); @@ -66,7 +67,7 @@ template unsigned run_scenario(STATE& state) { return cycles; } -template unsigned run_scenario(int width, STATE& state) { +template unsigned run_scenario(int width, STATE& state, unsigned burst_factor = 0) { switch(width) { case 8: case 256: @@ -124,4 +125,47 @@ TEST_CASE("multi-packet", "[CXS][tlm-level]") { REQUIRE(state.resp_cnt == state.packet_sizes.size()); } } +TEST_CASE("single-packet-burst2", "[CXS][tlm-level]") { + struct { + unsigned int reset_cycles{4}; + unsigned int max_cycles = 5000; + std::vector packet_sizes; + unsigned granularity{1}; + unsigned resp_cnt{0}; + } 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); + + 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()); + } +} + +TEST_CASE("multi-packet-burst2", "[CXS][tlm-level]") { + struct { + unsigned int reset_cycles{4}; + unsigned int max_cycles = 5000; + std::vector packet_sizes; + unsigned granularity{2}; + unsigned resp_cnt{0}; + } 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); + + 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()); + } +} } // namespace cxs diff --git a/tests/cxs_tlm/testbench.h b/tests/cxs_tlm/testbench.h index 332d43d..00d99b9 100644 --- a/tests/cxs_tlm/testbench.h +++ b/tests/cxs_tlm/testbench.h @@ -42,6 +42,7 @@ template struct testbench : public sc_core::sc_module { [this](transaction_type& trans, phase_type& phase, sc_core::sc_time& t) { return this->nb_transport_fw(trans, phase, t); }); isck(tx.tsck); tx.clk_i(clk); + tx.rst_i(rst); tx.isck(cxs_chan.tsck); cxs_chan.isck(rx.tsck); rx.clk_i(clk);