From f8f1f2f54c13ccec2625e1f38fc201fa5b28d79e Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 18 Dec 2024 17:36:16 +0100 Subject: [PATCH] applies clang-format --- scc | 2 +- src/sc_main.cpp | 2 +- tests/cxs_tlm/csx_packet_test.cpp | 19 ++++++++----------- tests/cxs_tlm/testbench.h | 21 +++++++++------------ 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/scc b/scc index eadb928..5046e6e 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit eadb9285757d639ce1acd854551c115ef84fc903 +Subproject commit 5046e6e54f4dc17e9673c4d5049c55632c926fea diff --git a/src/sc_main.cpp b/src/sc_main.cpp index eced2bc..e8322ca 100644 --- a/src/sc_main.cpp +++ b/src/sc_main.cpp @@ -38,7 +38,7 @@ int sc_main(int argc, char* argv[]) { result = Catch::Session().run(argc, argv); // destroy design(s) sc_stop(); - SCCTRACE()<<"Test sequence finished"; + SCCTRACE() << "Test sequence finished"; factory::get_instance().destroy(); } return result; diff --git a/tests/cxs_tlm/csx_packet_test.cpp b/tests/cxs_tlm/csx_packet_test.cpp index 98f531b..190ab12 100644 --- a/tests/cxs_tlm/csx_packet_test.cpp +++ b/tests/cxs_tlm/csx_packet_test.cpp @@ -22,7 +22,7 @@ template unsigned run_scenario(STATE& state) { auto run1 = sc_spawn([&dut, &state]() { auto burst_cnt{0}; - for(auto size:state.packet_sizes) { + for(auto size : state.packet_sizes) { cxs_pkt_shared_ptr tx_pkt = cxs_pkt_mm::get().allocate(); tx_pkt->get_data().resize(size); auto phase{tlm::nw::REQUEST}; @@ -30,16 +30,16 @@ template unsigned run_scenario(STATE& state) { auto status = dut.isck->nb_transport_fw(*tx_pkt, phase, t); REQUIRE(status == tlm::TLM_UPDATED); REQUIRE(phase == tlm::nw::CONFIRM); - if(++burst_cnt==state.granularity) { + if(++burst_cnt == state.granularity) { wait(dut.recv.data_written_event()); while(!dut.recv.empty()) { auto recv_pkt = dut.recv.front(); dut.recv.pop_front(); - REQUIRE(tx_pkt==recv_pkt); - REQUIRE(recv_pkt->get_data().size()==state.packet_sizes[state.resp_cnt]); + REQUIRE(tx_pkt == recv_pkt); + REQUIRE(recv_pkt->get_data().size() == state.packet_sizes[state.resp_cnt]); state.resp_cnt++; } - burst_cnt=0; + burst_cnt = 0; } } }); @@ -53,10 +53,8 @@ template unsigned run_scenario(STATE& state) { return cycles; } -template -unsigned run_scenario(int width, STATE &state) -{ - switch (width) { +template unsigned run_scenario(int width, STATE& state) { + switch(width) { case 8: case 256: return run_scenario<256>(state); @@ -79,9 +77,8 @@ TEST_CASE("single-packet", "[CXS][tlm-level]") { unsigned resp_cnt{0}; } state; - state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024}); - for(auto width=8; width<11; ++width) { + for(auto width = 8; width < 11; ++width) { state.resp_cnt = 0; auto cycles = run_scenario(width, state); diff --git a/tests/cxs_tlm/testbench.h b/tests/cxs_tlm/testbench.h index 368a88a..0d127dd 100644 --- a/tests/cxs_tlm/testbench.h +++ b/tests/cxs_tlm/testbench.h @@ -7,19 +7,18 @@ #include #include #include -#include -#include #include #include +#include +#include using namespace sc_core; using namespace sc_dt; using namespace std; using namespace cxs; -const char* sc_gen_unique_name( const char*, bool preserve_first ); -template -struct testbench : public sc_core::sc_module { +const char* sc_gen_unique_name(const char*, bool preserve_first); +template struct testbench : public sc_core::sc_module { using transaction_type = cxs_packet_types::tlm_payload_type; using phase_type = cxs_packet_types::tlm_phase_type; @@ -30,19 +29,17 @@ struct testbench : public sc_core::sc_module { cxs_transmitter tx{"tx"}; cxs_channel cxs_chan{"cxs_chan"}; cxs_receiver rx{"rx"}; - tlm::nw::target_mixin,cxs_packet_types> tsck{"tsck"}; + tlm::nw::target_mixin, cxs_packet_types> tsck{"tsck"}; testbench() : testbench(sc_core::sc_gen_unique_name("testbench", false)) {} testbench(sc_core::sc_module_name const& nm) : sc_module(nm) { - isck.register_nb_transport_bw([this](transaction_type& trans, phase_type& phase, sc_core::sc_time& t) { - return this->nb_transport_fw(trans, phase, t); - }); - tsck.register_nb_transport_fw([this](transaction_type& trans, phase_type& phase, sc_core::sc_time& t) { - return this->nb_transport_fw(trans, phase, t); - }); + isck.register_nb_transport_bw( + [this](transaction_type& trans, phase_type& phase, sc_core::sc_time& t) { return this->nb_transport_fw(trans, phase, t); }); + tsck.register_nb_transport_fw( + [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.isck(cxs_chan.tsck);