From 6346033b315ed306390d97a810323d1bf3976ec3 Mon Sep 17 00:00:00 2001 From: eyck Date: Tue, 14 Jul 2020 11:32:22 +0200 Subject: [PATCH] add CLI configurability --- tests/sim_performance/pkt_sender.cpp | 6 +++--- tests/sim_performance/pkt_sender.h | 4 ++-- tests/sim_performance/sc_main.cpp | 9 +++++++-- tests/sim_performance/top.cpp | 10 +++++----- tests/sim_performance/top.h | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/tests/sim_performance/pkt_sender.cpp b/tests/sim_performance/pkt_sender.cpp index a7b060d..12415fe 100644 --- a/tests/sim_performance/pkt_sender.cpp +++ b/tests/sim_performance/pkt_sender.cpp @@ -12,12 +12,13 @@ using namespace sc_core; -pkt_sender::pkt_sender(const sc_core::sc_module_name &nm, unsigned dim, unsigned pos_x, unsigned pos_y) +pkt_sender::pkt_sender(const sc_core::sc_module_name &nm, unsigned dim, unsigned pos_x, unsigned pos_y, unsigned count) : sc_module(nm) , bw_peq("bw_peq") , fw_peq("fw_peq") , my_pos{pos_x,pos_y} , dim{dim} +, count{count} { SCCDEBUG(SCMOD)<<"instantiating sender "< &route_vec) { void pkt_sender::run() { wait(clk_i.posedge_event()); - for(auto i=0U; i<1000; i++){ + for(auto i=0U; i::get().allocate(); gen_routing(gp->get_extension()->routing); tlm::tlm_phase phase{tlm::BEGIN_REQ}; @@ -66,7 +67,6 @@ void pkt_sender::run() { } sc_assert(gp==ret); ret->release(); - wait(clk_i.posedge_event()); } finish_evt.notify(SC_ZERO_TIME); } diff --git a/tests/sim_performance/pkt_sender.h b/tests/sim_performance/pkt_sender.h index b6728af..e6fcc27 100644 --- a/tests/sim_performance/pkt_sender.h +++ b/tests/sim_performance/pkt_sender.h @@ -19,7 +19,7 @@ public: sc_core::sc_in clk_i{"clk_i"}; scc::initiator_mixin> isck; scc::target_mixin> tsck; - pkt_sender(sc_core::sc_module_name const&, unsigned dim, unsigned pos_x, unsigned pos_y); + pkt_sender(sc_core::sc_module_name const&, unsigned dim, unsigned pos_x, unsigned pos_y, unsigned count); virtual ~pkt_sender() = default; sc_core::sc_event const& get_finish_event(){return finish_evt;} private: @@ -31,7 +31,7 @@ private: tlm::tlm_sync_enum nb_bw(tlm::tlm_generic_payload&, tlm::tlm_phase&, sc_core::sc_time&); sc_core::sc_event finish_evt; std::pair my_pos; - const unsigned dim; + const unsigned dim, count; }; #endif /* _SIM_PERFORMANCE_PKT_SENDER_H_ */ diff --git a/tests/sim_performance/sc_main.cpp b/tests/sim_performance/sc_main.cpp index fac05d7..e5cbe4d 100644 --- a/tests/sim_performance/sc_main.cpp +++ b/tests/sim_performance/sc_main.cpp @@ -47,7 +47,9 @@ int sc_main(int argc, char *argv[]) { desc.add_options() ("help,h", "Print help message") ("debug,d", "set debug level") - ("trace,t", "trace SystemC signals"); + ("trace,t", "trace SystemC signals") + ("dim", po::value()->default_value(16)) + ("count", po::value()->default_value(16384)); // clang-format on po::variables_map vm; try { @@ -78,7 +80,10 @@ int sc_main(int argc, char *argv[]) { // instantiate top level /////////////////////////////////////////////////////////////////////////// perf_estimator estimator; - top i_top("i_top", 89); + auto const count=vm["count"].as(); + auto const dim = vm["dim"].as(); + SCCINFO()<<"Instantiating "<<(unsigned)dim<<"x"<<(unsigned)dim<<" matrix and executing "<0); SC_HAS_PROCESS(top); for(auto yidx=0U; yidx(sc_module_name(name.c_str()), dimension, xidx+1, 0)); + senders[TOP].push_back(scc::make_unique(sc_module_name(name.c_str()), dimension, xidx+1, 0, count)); auto& snd = senders[TOP].back(); snd->clk_i(clk); auto& sw = switches[yidx*dimension+xidx]; @@ -53,7 +53,7 @@ top::top(sc_core::sc_module_name const& nm, unsigned dimension) :sc_module(nm){ yidx=dimension-1; for(xidx=0U; xidx(sc_module_name(name.c_str()), dimension, xidx+1, dimension+1)); + senders[BOTTOM].push_back(scc::make_unique(sc_module_name(name.c_str()), dimension, xidx+1, dimension+1, count)); auto& snd = senders[BOTTOM].back(); snd->clk_i(clk); auto& sw = switches[yidx*dimension+xidx]; @@ -63,7 +63,7 @@ top::top(sc_core::sc_module_name const& nm, unsigned dimension) :sc_module(nm){ xidx=0U; for(yidx=0U; yidx(sc_module_name(name.c_str()), dimension, 0, yidx+1)); + senders[LEFT].push_back(scc::make_unique(sc_module_name(name.c_str()), dimension, 0, yidx+1, count)); auto& snd = senders[LEFT].back(); snd->clk_i(clk); auto& sw = switches[yidx*dimension+xidx]; @@ -73,7 +73,7 @@ top::top(sc_core::sc_module_name const& nm, unsigned dimension) :sc_module(nm){ xidx=dimension-1; for(yidx=0U; yidx(sc_module_name(name.c_str()), dimension, dimension+1, yidx+1)); + senders[RIGHT].push_back(scc::make_unique(sc_module_name(name.c_str()), dimension, dimension+1, yidx+1, count)); auto& snd = senders[RIGHT].back(); snd->clk_i(clk); auto& sw = switches[yidx*dimension+xidx]; diff --git a/tests/sim_performance/top.h b/tests/sim_performance/top.h index 15627f5..ca97be1 100644 --- a/tests/sim_performance/top.h +++ b/tests/sim_performance/top.h @@ -17,7 +17,7 @@ class top: public sc_core::sc_module { public: - top(sc_core::sc_module_name const&, unsigned); + top(sc_core::sc_module_name const&, uint8_t, unsigned); virtual ~top() = default; private: void run();