dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / fsm / scd_stm_terminate.cpp
1 #include "fsm/scd_stm_terminate.h"
2
3 #include "scd_logging.h"
4 #include "scd_exception.h"
5 #include "scd_cont_man_master.h"
6
7
8 void scd_stm_terminate::set_busy()
9 {
10     scd_error("received further events while terminating");
11     set_fail();
12 }
13
14
15 void scd_stm_terminate::set_idle(const sc_core::sc_time& time)
16 {
17     scd_error("received future events while terminating");
18     set_fail();
19 }
20
21
22 void scd_stm_terminate::process()
23 {
24     // check for failed slaves and react
25     if (!_check_slaves())
26         return;
27
28     if (_some_slaves_active())
29     {
30         // not all slaves have terminated yet
31         return;
32     }
33     else
34     {
35         // all slaves terminated
36         _sim.get_chan_man().close();
37         _close_slaves();
38         _fsm.set_state(_st_terminated);
39     }
40 }