dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / fsm / scd_stsw_base.cpp
1 #include "fsm/scd_stsw_base.h"
2
3 #include "scd_logging.h"
4 #include "scd_exception.h"
5 #include "scd_cont_slave_wrapper.h"
6 #include "scd_command.h"
7
8
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)
17 {
18 }
19
20
21 void scd_stsw_base::set_connected()
22 {
23     scd_warn("illegal call to set_connected()");
24     throw scd_exception("illegal call");
25 }
26
27
28 void scd_stsw_base::set_failed()
29 {
30     _sim.get_poller().remove_handler(_fsm);
31     _fsm.set_state(_st_failed);
32 }
33
34
35 void scd_stsw_base::send_time_req()
36 {
37     scd_warn("illegal call to send_time_req()");
38     throw scd_exception("illegal call");
39 }
40
41
42 void scd_stsw_base::send_time(const sc_core::sc_time& time)
43 {
44     scd_warn("illegal call to send_time()");
45     throw scd_exception("illegal call");
46 }
47
48 void scd_stsw_base::send_term_req()
49 {
50     scd_warn("illegal call to send_term_req()");
51     throw scd_exception("illegal call");
52 }
53
54
55 void scd_stsw_base::send_term()
56 {
57     scd_warn("illegal call to send_term()");
58     throw scd_exception("illegal call");
59 }
60
61
62 bool scd_stsw_base::time_req() const { return false; }
63
64
65 bool scd_stsw_base::time_ack() const { return false; }
66
67
68 bool scd_stsw_base::term_req() const { return false; }
69
70
71 bool scd_stsw_base::term_ack() const { return false; }
72
73
74 bool scd_stsw_base::idle() const { return false; }
75
76
77 bool scd_stsw_base::done() const { return false; }
78
79
80 void scd_stsw_base::set_busy()
81 {
82     scd_error("illegal call to set_busy()");
83     throw scd_exception("illegal call");
84 }
85
86
87 void scd_stsw_base::set_idle(const sc_core::sc_time& time)
88 {
89     scd_error("illegal call to set_idle()");
90     throw scd_exception("illegal call");
91 }
92
93
94 void scd_stsw_base::set_done()
95 {
96     scd_error("illegal call to set_done()");
97     throw scd_exception("illegal call");
98 }
99
100
101 void scd_stsw_base::set_fail()
102 {
103     scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_FAILED);
104     _fsm.send_command(cmd);
105     _fsm.set_state(_st_fail);
106 }
107
108
109 bool scd_stsw_base::active() const { return true; }
110
111
112 bool scd_stsw_base::busy() const { return false; }
113
114
115 bool scd_stsw_base::failed() const { return false; }
116
117
118 bool scd_stsw_base::advance_time() const { return false; }
119
120
121 const sc_core::sc_time& scd_stsw_base::get_time_step()
122 {
123     scd_error("illegal call to get_time_step()");
124     throw scd_exception("illegal call");
125 }