1 #include "fsm/scd_sts_base.h"
3 #include "scd_logging.h"
4 #include "scd_exception.h"
5 #include "scd_cont_man_slave.h"
6 #include "scd_command.h"
7 #include "scd_cont_man.h"
11 scd_sts_base::scd_sts_base(scd_simulator& sim, scd_cont_man_slave& fsm):
12 scd_cont_state(sim), _fsm(fsm),
13 _st_init(fsm._st_init), _st_busy(fsm._st_busy), _st_idle(fsm._st_idle),
14 _st_done(fsm._st_done), _st_time_ack(fsm._st_time_ack),
15 _st_time(fsm._st_time), _st_term_ack(fsm._st_term_ack),
16 _st_terminated(fsm._st_terminated), _st_fail(fsm._st_fail),
17 _st_failed(fsm._st_failed),
18 _writer(fsm._writer), _reader(fsm._reader), _connector(fsm._connector)
23 void scd_sts_base::set_failed()
25 _sim.get_poller().remove_handler(_fsm);
26 _sim.get_chan_man().close();
27 _fsm.set_state(_st_failed);
31 void scd_sts_base::recv_time_req()
33 scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_TIME_NACK);
34 _fsm.send_command(cmd);
38 void scd_sts_base::recv_time(const sc_core::sc_time& time)
40 scd_warn("received time message in wrong state");
44 void scd_sts_base::recv_term_req()
46 scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_TERM_NACK);
47 _fsm.send_command(cmd);
51 void scd_sts_base::recv_term()
53 scd_warn("received terminate message in wrong state");
57 void scd_sts_base::set_fail()
59 scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_FAILED);
60 _fsm.send_command(cmd);
61 _fsm.set_state(_st_fail);
65 bool scd_sts_base::active() const { return true; }
68 bool scd_sts_base::busy() const { return false; }
71 bool scd_sts_base::failed() const { return false; }
74 bool scd_sts_base::advance_time() const { return false; }
77 const sc_core::sc_time& scd_sts_base::get_time_step()
79 scd_warn("illegal call to get_time_step()");
80 throw scd_exception("illegal call");