123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500 |
- #include "ShallowHistoryWithDeepEntry.h"
- #include <string.h>
- /*! \file Implementation of the state machine 'ShallowHistoryWithDeepEntry'
- */
- ShallowHistoryWithDeepEntry::ShallowHistoryWithDeepEntry()
- {
-
-
- for (int i = 0; i < maxHistoryStates; ++i)
- historyVector[i] = ShallowHistoryWithDeepEntry_last_state;
-
- stateConfVectorPosition = 0;
-
- }
- ShallowHistoryWithDeepEntry::~ShallowHistoryWithDeepEntry()
- {
- }
- void ShallowHistoryWithDeepEntry::init()
- {
- for (int i = 0; i < maxOrthogonalStates; ++i)
- stateConfVector[i] = ShallowHistoryWithDeepEntry_last_state;
-
- for (int i = 0; i < maxHistoryStates; ++i)
- historyVector[i] = ShallowHistoryWithDeepEntry_last_state;
-
- stateConfVectorPosition = 0;
- clearInEvents();
- clearOutEvents();
-
- }
- void ShallowHistoryWithDeepEntry::enter()
- {
- /* Default enter sequence for statechart ShallowHistoryWithDeepEntry */
- enseq_main_region_default();
- }
- void ShallowHistoryWithDeepEntry::exit()
- {
- /* Default exit sequence for statechart ShallowHistoryWithDeepEntry */
- exseq_main_region();
- }
- sc_boolean ShallowHistoryWithDeepEntry::isActive() const
- {
- return stateConfVector[0] != ShallowHistoryWithDeepEntry_last_state;
- }
- /*
- * Always returns 'false' since this state machine can never become final.
- */
- sc_boolean ShallowHistoryWithDeepEntry::isFinal() const
- {
- return false;}
- void ShallowHistoryWithDeepEntry::runCycle()
- {
-
- clearOutEvents();
-
- for (stateConfVectorPosition = 0;
- stateConfVectorPosition < maxOrthogonalStates;
- stateConfVectorPosition++)
- {
-
- switch (stateConfVector[stateConfVectorPosition])
- {
- case main_region_Y :
- {
- react_main_region_Y();
- break;
- }
- case main_region_Z__region0_A :
- {
- react_main_region_Z__region0_A();
- break;
- }
- case main_region_Z__region0_B__region0_C :
- {
- react_main_region_Z__region0_B__region0_C();
- break;
- }
- default:
- break;
- }
- }
-
- clearInEvents();
- }
- void ShallowHistoryWithDeepEntry::clearInEvents()
- {
- iface.toZ_raised = false;
- iface.toY_raised = false;
- iface.toC_raised = false;
- iface.toA_raised = false;
- }
- void ShallowHistoryWithDeepEntry::clearOutEvents()
- {
- }
- sc_boolean ShallowHistoryWithDeepEntry::isStateActive(ShallowHistoryWithDeepEntryStates state) const
- {
- switch (state)
- {
- case main_region_Y :
- return (sc_boolean) (stateConfVector[0] == main_region_Y
- );
- case main_region_Z :
- return (sc_boolean) (stateConfVector[0] >= main_region_Z
- && stateConfVector[0] <= main_region_Z__region0_B__region0_C);
- case main_region_Z__region0_A :
- return (sc_boolean) (stateConfVector[0] == main_region_Z__region0_A
- );
- case main_region_Z__region0_B :
- return (sc_boolean) (stateConfVector[0] >= main_region_Z__region0_B
- && stateConfVector[0] <= main_region_Z__region0_B__region0_C);
- case main_region_Z__region0_B__region0_C :
- return (sc_boolean) (stateConfVector[0] == main_region_Z__region0_B__region0_C
- );
- default: return false;
- }
- }
- ShallowHistoryWithDeepEntry::DefaultSCI* ShallowHistoryWithDeepEntry::getDefaultSCI()
- {
- return &iface;
- }
- void ShallowHistoryWithDeepEntry::DefaultSCI::raise_toZ()
- {
- toZ_raised = true;
- }
- void ShallowHistoryWithDeepEntry::raise_toZ()
- {
- iface.raise_toZ();
- }
- void ShallowHistoryWithDeepEntry::DefaultSCI::raise_toY()
- {
- toY_raised = true;
- }
- void ShallowHistoryWithDeepEntry::raise_toY()
- {
- iface.raise_toY();
- }
- void ShallowHistoryWithDeepEntry::DefaultSCI::raise_toC()
- {
- toC_raised = true;
- }
- void ShallowHistoryWithDeepEntry::raise_toC()
- {
- iface.raise_toC();
- }
- void ShallowHistoryWithDeepEntry::DefaultSCI::raise_toA()
- {
- toA_raised = true;
- }
- void ShallowHistoryWithDeepEntry::raise_toA()
- {
- iface.raise_toA();
- }
- // implementations of all internal functions
- sc_boolean ShallowHistoryWithDeepEntry::check_main_region_Y_tr0_tr0()
- {
- return iface.toZ_raised;
- }
- sc_boolean ShallowHistoryWithDeepEntry::check_main_region_Y_tr1_tr1()
- {
- return iface.toC_raised;
- }
- sc_boolean ShallowHistoryWithDeepEntry::check_main_region_Z_tr0_tr0()
- {
- return iface.toY_raised;
- }
- sc_boolean ShallowHistoryWithDeepEntry::check_main_region_Z__region0_A_tr0_tr0()
- {
- return iface.toC_raised;
- }
- sc_boolean ShallowHistoryWithDeepEntry::check_main_region_Z__region0_B__region0_C_tr0_tr0()
- {
- return iface.toA_raised;
- }
- void ShallowHistoryWithDeepEntry::effect_main_region_Y_tr0()
- {
- exseq_main_region_Y();
- enseq_main_region_Z_default();
- }
- void ShallowHistoryWithDeepEntry::effect_main_region_Y_tr1()
- {
- exseq_main_region_Y();
- enseq_main_region_Z__region0_B__region0_C_default();
- historyVector[0] = stateConfVector[0];
- }
- void ShallowHistoryWithDeepEntry::effect_main_region_Z_tr0()
- {
- exseq_main_region_Z();
- enseq_main_region_Y_default();
- }
- void ShallowHistoryWithDeepEntry::effect_main_region_Z__region0_A_tr0()
- {
- exseq_main_region_Z__region0_A();
- enseq_main_region_Z__region0_B__region0_C_default();
- historyVector[0] = stateConfVector[0];
- }
- void ShallowHistoryWithDeepEntry::effect_main_region_Z__region0_B__region0_C_tr0()
- {
- exseq_main_region_Z__region0_B();
- enseq_main_region_Z__region0_A_default();
- }
- /* 'default' enter sequence for state Y */
- void ShallowHistoryWithDeepEntry::enseq_main_region_Y_default()
- {
- /* 'default' enter sequence for state Y */
- stateConfVector[0] = main_region_Y;
- stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state Z */
- void ShallowHistoryWithDeepEntry::enseq_main_region_Z_default()
- {
- /* 'default' enter sequence for state Z */
- enseq_main_region_Z__region0_default();
- }
- /* 'default' enter sequence for state A */
- void ShallowHistoryWithDeepEntry::enseq_main_region_Z__region0_A_default()
- {
- /* 'default' enter sequence for state A */
- stateConfVector[0] = main_region_Z__region0_A;
- stateConfVectorPosition = 0;
- historyVector[0] = stateConfVector[0];
- }
- /* 'default' enter sequence for state B */
- void ShallowHistoryWithDeepEntry::enseq_main_region_Z__region0_B_default()
- {
- /* 'default' enter sequence for state B */
- enseq_main_region_Z__region0_B__region0_default();
- historyVector[0] = stateConfVector[0];
- }
- /* 'default' enter sequence for state C */
- void ShallowHistoryWithDeepEntry::enseq_main_region_Z__region0_B__region0_C_default()
- {
- /* 'default' enter sequence for state C */
- stateConfVector[0] = main_region_Z__region0_B__region0_C;
- stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for region main region */
- void ShallowHistoryWithDeepEntry::enseq_main_region_default()
- {
- /* 'default' enter sequence for region main region */
- react_main_region__entry_Default();
- }
- /* 'default' enter sequence for region null */
- void ShallowHistoryWithDeepEntry::enseq_main_region_Z__region0_default()
- {
- /* 'default' enter sequence for region null */
- react_main_region_Z__region0__entry_Default();
- }
- /* shallow enterSequence with history in child null */
- void ShallowHistoryWithDeepEntry::shenseq_main_region_Z__region0()
- {
- /* shallow enterSequence with history in child null */
- /* Handle shallow history entry of null */
- switch(historyVector[ 0 ])
- {
- case main_region_Z__region0_A :
- {
- enseq_main_region_Z__region0_A_default();
- break;
- }
- case main_region_Z__region0_B__region0_C :
- {
- enseq_main_region_Z__region0_B_default();
- break;
- }
- default: break;
- }
- }
- /* 'default' enter sequence for region null */
- void ShallowHistoryWithDeepEntry::enseq_main_region_Z__region0_B__region0_default()
- {
- /* 'default' enter sequence for region null */
- react_main_region_Z__region0_B__region0__entry_Default();
- }
- /* Default exit sequence for state Y */
- void ShallowHistoryWithDeepEntry::exseq_main_region_Y()
- {
- /* Default exit sequence for state Y */
- stateConfVector[0] = ShallowHistoryWithDeepEntry_last_state;
- stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state Z */
- void ShallowHistoryWithDeepEntry::exseq_main_region_Z()
- {
- /* Default exit sequence for state Z */
- exseq_main_region_Z__region0();
- }
- /* Default exit sequence for state A */
- void ShallowHistoryWithDeepEntry::exseq_main_region_Z__region0_A()
- {
- /* Default exit sequence for state A */
- stateConfVector[0] = ShallowHistoryWithDeepEntry_last_state;
- stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state B */
- void ShallowHistoryWithDeepEntry::exseq_main_region_Z__region0_B()
- {
- /* Default exit sequence for state B */
- exseq_main_region_Z__region0_B__region0();
- }
- /* Default exit sequence for state C */
- void ShallowHistoryWithDeepEntry::exseq_main_region_Z__region0_B__region0_C()
- {
- /* Default exit sequence for state C */
- stateConfVector[0] = ShallowHistoryWithDeepEntry_last_state;
- stateConfVectorPosition = 0;
- }
- /* Default exit sequence for region main region */
- void ShallowHistoryWithDeepEntry::exseq_main_region()
- {
- /* Default exit sequence for region main region */
- /* Handle exit of all possible states (of ShallowHistoryWithDeepEntry.main_region) at position 0... */
- switch(stateConfVector[ 0 ])
- {
- case main_region_Y :
- {
- exseq_main_region_Y();
- break;
- }
- case main_region_Z__region0_A :
- {
- exseq_main_region_Z__region0_A();
- break;
- }
- case main_region_Z__region0_B__region0_C :
- {
- exseq_main_region_Z__region0_B__region0_C();
- break;
- }
- default: break;
- }
- }
- /* Default exit sequence for region null */
- void ShallowHistoryWithDeepEntry::exseq_main_region_Z__region0()
- {
- /* Default exit sequence for region null */
- /* Handle exit of all possible states (of ShallowHistoryWithDeepEntry.main_region.Z._region0) at position 0... */
- switch(stateConfVector[ 0 ])
- {
- case main_region_Z__region0_A :
- {
- exseq_main_region_Z__region0_A();
- break;
- }
- case main_region_Z__region0_B__region0_C :
- {
- exseq_main_region_Z__region0_B__region0_C();
- break;
- }
- default: break;
- }
- }
- /* Default exit sequence for region null */
- void ShallowHistoryWithDeepEntry::exseq_main_region_Z__region0_B__region0()
- {
- /* Default exit sequence for region null */
- /* Handle exit of all possible states (of ShallowHistoryWithDeepEntry.main_region.Z._region0.B._region0) at position 0... */
- switch(stateConfVector[ 0 ])
- {
- case main_region_Z__region0_B__region0_C :
- {
- exseq_main_region_Z__region0_B__region0_C();
- break;
- }
- default: break;
- }
- }
- /* The reactions of state Y. */
- void ShallowHistoryWithDeepEntry::react_main_region_Y()
- {
- /* The reactions of state Y. */
- if (check_main_region_Y_tr0_tr0())
- {
- effect_main_region_Y_tr0();
- } else
- {
- if (check_main_region_Y_tr1_tr1())
- {
- effect_main_region_Y_tr1();
- }
- }
- }
- /* The reactions of state A. */
- void ShallowHistoryWithDeepEntry::react_main_region_Z__region0_A()
- {
- /* The reactions of state A. */
- if (check_main_region_Z_tr0_tr0())
- {
- effect_main_region_Z_tr0();
- } else
- {
- if (check_main_region_Z__region0_A_tr0_tr0())
- {
- effect_main_region_Z__region0_A_tr0();
- }
- }
- }
- /* The reactions of state C. */
- void ShallowHistoryWithDeepEntry::react_main_region_Z__region0_B__region0_C()
- {
- /* The reactions of state C. */
- if (check_main_region_Z_tr0_tr0())
- {
- effect_main_region_Z_tr0();
- } else
- {
- if (check_main_region_Z__region0_B__region0_C_tr0_tr0())
- {
- effect_main_region_Z__region0_B__region0_C_tr0();
- }
- }
- }
- /* Default react sequence for initial entry */
- void ShallowHistoryWithDeepEntry::react_main_region__entry_Default()
- {
- /* Default react sequence for initial entry */
- enseq_main_region_Y_default();
- }
- /* Default react sequence for shallow history entry */
- void ShallowHistoryWithDeepEntry::react_main_region_Z__region0__entry_Default()
- {
- /* Default react sequence for shallow history entry */
- /* Enter the region with shallow history */
- if (historyVector[0] != ShallowHistoryWithDeepEntry_last_state)
- {
- shenseq_main_region_Z__region0();
- } else
- {
- enseq_main_region_Z__region0_A_default();
- }
- }
- /* Default react sequence for initial entry */
- void ShallowHistoryWithDeepEntry::react_main_region_Z__region0_B__region0__entry_Default()
- {
- /* Default react sequence for initial entry */
- enseq_main_region_Z__region0_B__region0_C_default();
- }
|