dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / fsm / scd_stm_base.h
1 #ifndef SCD_STM_BASE_H
2 #define SCD_STM_BASE_H
3
4 #include <list>
5
6 #include "scd_simulator.h"
7 #include "scd_cont_slave_wrapper.h"
8 #include "fsm/scd_cont_state.h"
9
10
11 /* forward declaration */
12 class scd_cont_man_master;
13
14
15 /**
16  * Base class for all control master states.
17  */
18 class scd_stm_base : public scd_cont_state
19 {
20 public:
21     /**
22      * Constructor.
23      * \param sim the simulation environment
24      * \param fsm the FSM of this state
25      */
26     scd_stm_base(scd_simulator& sim, scd_cont_man_master& fsm);
27
28     virtual ~scd_stm_base() {}
29
30     /* scd_cont_fsm_if */
31     void set_busy() {}
32     void set_idle(const sc_core::sc_time& time) {}
33     void set_done() {}
34     void set_fail();
35     void process();
36     bool active() const;
37     bool busy() const;
38     bool failed() const;
39     bool advance_time() const;
40     const sc_core::sc_time& get_time_step();
41
42 protected:
43     scd_cont_man_master& _fsm;
44     std::list<scd_cont_slave_wrapper*>& _slaves;
45     sc_core::sc_time& _time_step;
46     scd_cont_state& _st_init;
47     scd_cont_state& _st_busy;
48     scd_cont_state& _st_idle;
49     scd_cont_state& _st_done;
50     scd_cont_state& _st_time_req;
51     scd_cont_state& _st_time;
52     scd_cont_state& _st_term_req;
53     scd_cont_state& _st_terminate;
54     scd_cont_state& _st_terminated;
55     scd_cont_state& _st_fail;
56     scd_cont_state& _st_failed;
57
58     /* member functions */
59     bool _check_slaves();
60     bool _some_slaves_active();
61     void _close_slaves();
62 };
63
64 #endif