GuardedExit.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef GUARDEDEXIT_H_
  2. #define GUARDEDEXIT_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'GuardedExit'.
  6. */
  7. class GuardedExit : public StatemachineInterface
  8. {
  9. public:
  10. GuardedExit();
  11. ~GuardedExit();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_A,
  16. main_region_B,
  17. GuardedExit_last_state
  18. } GuardedExitStates;
  19. //! Inner class for default interface scope.
  20. class DefaultSCI
  21. {
  22. public:
  23. /*! Raises the in event 'e' that is defined in the default interface scope. */
  24. void raise_e();
  25. /*! Gets the value of the variable 'guard' that is defined in the default interface scope. */
  26. sc_boolean get_guard() const;
  27. /*! Sets the value of the variable 'guard' that is defined in the default interface scope. */
  28. void set_guard(sc_boolean value);
  29. /*! Gets the value of the variable 'done' that is defined in the default interface scope. */
  30. sc_boolean get_done() const;
  31. /*! Sets the value of the variable 'done' that is defined in the default interface scope. */
  32. void set_done(sc_boolean value);
  33. private:
  34. friend class GuardedExit;
  35. sc_boolean e_raised;
  36. sc_boolean guard;
  37. sc_boolean done;
  38. };
  39. /*! Returns an instance of the interface class 'DefaultSCI'. */
  40. DefaultSCI* getDefaultSCI();
  41. /*! Raises the in event 'e' that is defined in the default interface scope. */
  42. void raise_e();
  43. /*! Gets the value of the variable 'guard' that is defined in the default interface scope. */
  44. sc_boolean get_guard() const;
  45. /*! Sets the value of the variable 'guard' that is defined in the default interface scope. */
  46. void set_guard(sc_boolean value);
  47. /*! Gets the value of the variable 'done' that is defined in the default interface scope. */
  48. sc_boolean get_done() const;
  49. /*! Sets the value of the variable 'done' that is defined in the default interface scope. */
  50. void set_done(sc_boolean value);
  51. /*
  52. * Functions inherited from StatemachineInterface
  53. */
  54. virtual void init();
  55. virtual void enter();
  56. virtual void exit();
  57. virtual void runCycle();
  58. /*!
  59. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  60. * A state machine is active if it has been entered. It is inactive if it has not been entered at all or if it has been exited.
  61. */
  62. virtual sc_boolean isActive() const;
  63. /*!
  64. * Checks if all active states are final.
  65. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  66. */
  67. virtual sc_boolean isFinal() const;
  68. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  69. sc_boolean isStateActive(GuardedExitStates state) const;
  70. private:
  71. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  72. static const sc_integer maxOrthogonalStates = 1;
  73. GuardedExitStates stateConfVector[maxOrthogonalStates];
  74. sc_ushort stateConfVectorPosition;
  75. DefaultSCI iface;
  76. // prototypes of all internal functions
  77. sc_boolean check_main_region_A_tr0_tr0();
  78. sc_boolean check_main_region_B_tr0_tr0();
  79. void effect_main_region_A_tr0();
  80. void effect_main_region_B_tr0();
  81. void exact_main_region_A();
  82. void enseq_main_region_A_default();
  83. void enseq_main_region_B_default();
  84. void enseq_main_region_default();
  85. void exseq_main_region_A();
  86. void exseq_main_region_B();
  87. void exseq_main_region();
  88. void react_main_region_A();
  89. void react_main_region_B();
  90. void react_main_region__entry_Default();
  91. void clearInEvents();
  92. void clearOutEvents();
  93. };
  94. #endif /* GUARDEDEXIT_H_ */