dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / fsm / scd_sts_base.h
1 #ifndef SCD_STS_BASE_H
2 #define SCD_STS_BASE_H
3
4 #include "scd_simulator.h"
5 #include "scd_out_connector.h"
6 #include "scd_command_writer.h"
7 #include "scd_command_reader.h"
8 #include "fsm/scd_cont_state.h"
9
10
11 /* forward declaration */
12 class scd_cont_man_slave;
13
14
15 /**
16  * Base class for all control slave states.
17  */
18 class scd_sts_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_sts_base(scd_simulator& sim, scd_cont_man_slave& fsm);
27
28     virtual ~scd_sts_base() {}
29
30     /**
31      * Signalizes the state, that a failed message has been received
32      * from the master.
33      */
34     virtual void set_failed();
35
36     /**
37      * Signalizes the state, that a time_req message has been received
38      * from the master.
39      */
40     virtual void recv_time_req();
41
42     /**
43      * Signalizes the state, that a time_nack message has been received
44      * from the master.
45      */
46     virtual void recv_time_nack() {}
47
48     /**
49      * Signalizes the state, that a time message has been received
50      * from the master.
51      */
52     virtual void recv_time(const sc_core::sc_time& time);
53
54     /**
55      * Signalizes the state, that a term_req message has been received
56      * from the master.
57      */
58     virtual void recv_term_req();
59
60     /**
61      * Signalizes the state, that a term_nack message has been received
62      * from the master.
63      */
64     virtual void recv_term_nack() {}
65
66     /**
67      * Signalizes the state, that a term message has been received
68      * from the master.
69      */
70     virtual void recv_term();
71
72     /* scd_cont_fsm_if */
73     void set_busy() {}
74     void set_idle(const sc_core::sc_time& time) {}
75     void set_done() {}
76     void set_fail();
77     void process() {}
78     bool active() const;
79     bool busy() const;
80     bool failed() const;
81     bool advance_time() const;
82     const sc_core::sc_time& get_time_step();
83
84 protected:
85     scd_cont_man_slave& _fsm;
86     scd_command_writer& _writer;
87     scd_command_reader& _reader;
88     scd_out_connector& _connector;
89     scd_cont_state& _st_init;
90     scd_cont_state& _st_busy;
91     scd_cont_state& _st_idle;
92     scd_cont_state& _st_done;
93     scd_cont_state& _st_time_ack;
94     scd_cont_state& _st_time;
95     scd_cont_state& _st_term_ack;
96     scd_cont_state& _st_terminated;
97     scd_cont_state& _st_fail;
98     scd_cont_state& _st_failed;
99 };
100
101 #endif