X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Fhdsd%2Fscd%2Ffsm%2Fscd_stm_time_req.cpp;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Fhdsd%2Fscd%2Ffsm%2Fscd_stm_time_req.cpp;h=fb96b267396d9a5e07a7a2022444da2a2317f0c1;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/visitor/hdsd/scd/fsm/scd_stm_time_req.cpp b/dol/src/dol/visitor/hdsd/scd/fsm/scd_stm_time_req.cpp new file mode 100644 index 0000000..fb96b26 --- /dev/null +++ b/dol/src/dol/visitor/hdsd/scd/fsm/scd_stm_time_req.cpp @@ -0,0 +1,64 @@ +#include "fsm/scd_stm_time_req.h" + +#include "scd_logging.h" +#include "scd_exception.h" +#include "scd_cont_man_master.h" + + +void scd_stm_time_req::set_busy() +{ + _send_time_nack(); + _fsm.load_state(); +} + + +void scd_stm_time_req::process() +{ + if (!_check_slaves()) + return; + + std::list::iterator iter; + sc_core::sc_time min_step = _time_step; + + for (iter = _slaves.begin(); iter != _slaves.end(); iter++) + { + if ( !(*iter)->time_req() && !(*iter)->time_ack() ) + { + // received time_nack from this slave + _send_time_nack(); + _fsm.load_state(); + return; + } + else if ( !(*iter)->time_ack() ) + { + // this slave did not respond yet + return; + } + else + { + // received time_ack => search the smallest step + sc_core::sc_time time_slave = (*iter)->get_time_step(); + if (min_step == sc_core::SC_ZERO_TIME) + min_step = time_slave; + else if (min_step > time_slave && + time_slave != sc_core::SC_ZERO_TIME) + min_step = time_slave; + } + } + + // all slaves acknkowledged + _time_step = min_step; + for (iter = _slaves.begin(); iter != _slaves.end(); iter++) + (*iter)->send_time(min_step); + + _fsm.set_state(_st_time); +} + + +void scd_stm_time_req::_send_time_nack() +{ + std::list::iterator iter; + + for (iter = _slaves.begin(); iter != _slaves.end(); iter++) + (*iter)->send_time_nack(); +}