dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / fsm / scd_stsw_base.cpp
diff --git a/dol/src/dol/visitor/hdsd/scd/fsm/scd_stsw_base.cpp b/dol/src/dol/visitor/hdsd/scd/fsm/scd_stsw_base.cpp
new file mode 100644 (file)
index 0000000..a4f0c46
--- /dev/null
@@ -0,0 +1,125 @@
+#include "fsm/scd_stsw_base.h"
+
+#include "scd_logging.h"
+#include "scd_exception.h"
+#include "scd_cont_slave_wrapper.h"
+#include "scd_command.h"
+
+
+scd_stsw_base::scd_stsw_base(scd_simulator& sim, scd_cont_slave_wrapper& fsm):
+    scd_cont_state(sim), _fsm(fsm), _time_step(fsm._time_step),
+    _st_init(fsm._st_init), _st_busy(fsm._st_busy), _st_idle(fsm._st_idle),
+    _st_done(fsm._st_done), _st_time_req(fsm._st_time_req),
+    _st_time_ack(fsm._st_time_ack), _st_term_req(fsm._st_term_req),
+    _st_term_ack(fsm._st_term_ack), _st_terminate(fsm._st_terminate),
+    _st_terminated(fsm._st_terminated), _st_fail(fsm._st_fail),
+    _st_failed(fsm._st_failed)
+{
+}
+
+
+void scd_stsw_base::set_connected()
+{
+    scd_warn("illegal call to set_connected()");
+    throw scd_exception("illegal call");
+}
+
+
+void scd_stsw_base::set_failed()
+{
+    _sim.get_poller().remove_handler(_fsm);
+    _fsm.set_state(_st_failed);
+}
+
+
+void scd_stsw_base::send_time_req()
+{
+    scd_warn("illegal call to send_time_req()");
+    throw scd_exception("illegal call");
+}
+
+
+void scd_stsw_base::send_time(const sc_core::sc_time& time)
+{
+    scd_warn("illegal call to send_time()");
+    throw scd_exception("illegal call");
+}
+
+void scd_stsw_base::send_term_req()
+{
+    scd_warn("illegal call to send_term_req()");
+    throw scd_exception("illegal call");
+}
+
+
+void scd_stsw_base::send_term()
+{
+    scd_warn("illegal call to send_term()");
+    throw scd_exception("illegal call");
+}
+
+
+bool scd_stsw_base::time_req() const { return false; }
+
+
+bool scd_stsw_base::time_ack() const { return false; }
+
+
+bool scd_stsw_base::term_req() const { return false; }
+
+
+bool scd_stsw_base::term_ack() const { return false; }
+
+
+bool scd_stsw_base::idle() const { return false; }
+
+
+bool scd_stsw_base::done() const { return false; }
+
+
+void scd_stsw_base::set_busy()
+{
+    scd_error("illegal call to set_busy()");
+    throw scd_exception("illegal call");
+}
+
+
+void scd_stsw_base::set_idle(const sc_core::sc_time& time)
+{
+    scd_error("illegal call to set_idle()");
+    throw scd_exception("illegal call");
+}
+
+
+void scd_stsw_base::set_done()
+{
+    scd_error("illegal call to set_done()");
+    throw scd_exception("illegal call");
+}
+
+
+void scd_stsw_base::set_fail()
+{
+    scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_FAILED);
+    _fsm.send_command(cmd);
+    _fsm.set_state(_st_fail);
+}
+
+
+bool scd_stsw_base::active() const { return true; }
+
+
+bool scd_stsw_base::busy() const { return false; }
+
+
+bool scd_stsw_base::failed() const { return false; }
+
+
+bool scd_stsw_base::advance_time() const { return false; }
+
+
+const sc_core::sc_time& scd_stsw_base::get_time_step()
+{
+    scd_error("illegal call to get_time_step()");
+    throw scd_exception("illegal call");
+}