/* * top.cpp * * Created on: 04.05.2020 * Author: eyck */ #include "top.h" #include #include #include using namespace sc_core; using namespace fmt; top::top(sc_core::sc_module_name const& nm, unsigned dimension) :sc_module(nm){ sc_assert(dimension>0); SC_HAS_PROCESS(top); for(auto yidx=0U; yidx(sc_module_name(name.c_str()))); switches.back()->clk_i(clk); } } for(auto yidx=0U; yidxisck[RIGHT](swr->tsck[LEFT]); swr->isck[LEFT](sw->tsck[RIGHT]); } if(yidxisck[BOTTOM](swb->tsck[TOP]); swb->isck[TOP](sw->tsck[BOTTOM]); } } } auto yidx = 0U; auto xidx = 0U; for(xidx=0U; xidx(sc_module_name(name.c_str()), dimension, xidx+1, 0)); auto& snd = senders[TOP].back(); snd->clk_i(clk); auto& sw = switches[yidx*dimension+xidx]; snd->isck(sw->tsck[TOP]); sw->isck[TOP](snd->tsck); } yidx=dimension-1; for(xidx=0U; xidx(sc_module_name(name.c_str()), dimension, xidx+1, dimension+1)); auto& snd = senders[BOTTOM].back(); snd->clk_i(clk); auto& sw = switches[yidx*dimension+xidx]; snd->isck(sw->tsck[BOTTOM]); sw->isck[BOTTOM](snd->tsck); } xidx=0U; for(yidx=0U; yidx(sc_module_name(name.c_str()), dimension, 0, yidx+1)); auto& snd = senders[LEFT].back(); snd->clk_i(clk); auto& sw = switches[yidx*dimension+xidx]; snd->isck(sw->tsck[LEFT]); sw->isck[LEFT](snd->tsck); } xidx=dimension-1; for(yidx=0U; yidx(sc_module_name(name.c_str()), dimension, dimension+1, yidx+1)); auto& snd = senders[RIGHT].back(); snd->clk_i(clk); auto& sw = switches[yidx*dimension+xidx]; snd->isck(sw->tsck[RIGHT]); sw->isck[RIGHT](snd->tsck); } SC_THREAD(run); } void top::run() { sc_event_and_list evt_list; for(auto& sides:senders) { for(auto& sender:sides){ evt_list&=sender->get_finish_event(); } } wait(evt_list); sc_stop(); }