1 #include "fsm/scd_stsw_base.h"
3 #include "scd_logging.h"
4 #include "scd_exception.h"
5 #include "scd_cont_slave_wrapper.h"
6 #include "scd_command.h"
9 scd_stsw_base::scd_stsw_base(scd_simulator& sim, scd_cont_slave_wrapper& fsm):
10 scd_cont_state(sim), _fsm(fsm), _time_step(fsm._time_step),
11 _st_init(fsm._st_init), _st_busy(fsm._st_busy), _st_idle(fsm._st_idle),
12 _st_done(fsm._st_done), _st_time_req(fsm._st_time_req),
13 _st_time_ack(fsm._st_time_ack), _st_term_req(fsm._st_term_req),
14 _st_term_ack(fsm._st_term_ack), _st_terminate(fsm._st_terminate),
15 _st_terminated(fsm._st_terminated), _st_fail(fsm._st_fail),
16 _st_failed(fsm._st_failed)
21 void scd_stsw_base::set_connected()
23 scd_warn("illegal call to set_connected()");
24 throw scd_exception("illegal call");
28 void scd_stsw_base::set_failed()
30 _sim.get_poller().remove_handler(_fsm);
31 _fsm.set_state(_st_failed);
35 void scd_stsw_base::send_time_req()
37 scd_warn("illegal call to send_time_req()");
38 throw scd_exception("illegal call");
42 void scd_stsw_base::send_time(const sc_core::sc_time& time)
44 scd_warn("illegal call to send_time()");
45 throw scd_exception("illegal call");
48 void scd_stsw_base::send_term_req()
50 scd_warn("illegal call to send_term_req()");
51 throw scd_exception("illegal call");
55 void scd_stsw_base::send_term()
57 scd_warn("illegal call to send_term()");
58 throw scd_exception("illegal call");
62 bool scd_stsw_base::time_req() const { return false; }
65 bool scd_stsw_base::time_ack() const { return false; }
68 bool scd_stsw_base::term_req() const { return false; }
71 bool scd_stsw_base::term_ack() const { return false; }
74 bool scd_stsw_base::idle() const { return false; }
77 bool scd_stsw_base::done() const { return false; }
80 void scd_stsw_base::set_busy()
82 scd_error("illegal call to set_busy()");
83 throw scd_exception("illegal call");
87 void scd_stsw_base::set_idle(const sc_core::sc_time& time)
89 scd_error("illegal call to set_idle()");
90 throw scd_exception("illegal call");
94 void scd_stsw_base::set_done()
96 scd_error("illegal call to set_done()");
97 throw scd_exception("illegal call");
101 void scd_stsw_base::set_fail()
103 scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_FAILED);
104 _fsm.send_command(cmd);
105 _fsm.set_state(_st_fail);
109 bool scd_stsw_base::active() const { return true; }
112 bool scd_stsw_base::busy() const { return false; }
115 bool scd_stsw_base::failed() const { return false; }
118 bool scd_stsw_base::advance_time() const { return false; }
121 const sc_core::sc_time& scd_stsw_base::get_time_step()
123 scd_error("illegal call to get_time_step()");
124 throw scd_exception("illegal call");