InternalEventLifeCycle.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #ifndef INTERNALEVENTLIFECYCLE_H_
  2. #define INTERNALEVENTLIFECYCLE_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'InternalEventLifeCycle'.
  6. */
  7. class InternalEventLifeCycle : public StatemachineInterface
  8. {
  9. public:
  10. InternalEventLifeCycle();
  11. ~InternalEventLifeCycle();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. r1_A,
  16. r1_B,
  17. r2_C,
  18. r2_D,
  19. InternalEventLifeCycle_last_state
  20. } InternalEventLifeCycleStates;
  21. //! Inner class for default interface scope.
  22. class DefaultSCI
  23. {
  24. public:
  25. /*! Raises the in event 'e' that is defined in the default interface scope. */
  26. void raise_e();
  27. /*! Raises the in event 'f' that is defined in the default interface scope. */
  28. void raise_f();
  29. private:
  30. friend class InternalEventLifeCycle;
  31. sc_boolean e_raised;
  32. sc_boolean f_raised;
  33. };
  34. /*! Returns an instance of the interface class 'DefaultSCI'. */
  35. DefaultSCI* getDefaultSCI();
  36. /*! Raises the in event 'e' that is defined in the default interface scope. */
  37. void raise_e();
  38. /*! Raises the in event 'f' that is defined in the default interface scope. */
  39. void raise_f();
  40. /*
  41. * Functions inherited from StatemachineInterface
  42. */
  43. virtual void init();
  44. virtual void enter();
  45. virtual void exit();
  46. virtual void runCycle();
  47. /*!
  48. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  49. * 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.
  50. */
  51. virtual sc_boolean isActive() const;
  52. /*!
  53. * Checks if all active states are final.
  54. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  55. */
  56. virtual sc_boolean isFinal() const;
  57. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  58. sc_boolean isStateActive(InternalEventLifeCycleStates state) const;
  59. private:
  60. //! Inner class for internal interface scope.
  61. class InternalSCI
  62. {
  63. public:
  64. /*! Raises the in event 'i1' that is defined in the internal scope. */
  65. void raise_i1();
  66. /*! Checks if the out event 'i1' that is defined in the internal scope has been raised. */
  67. sc_boolean isRaised_i1() const;
  68. /*! Raises the in event 'i2' that is defined in the internal scope. */
  69. void raise_i2();
  70. /*! Checks if the out event 'i2' that is defined in the internal scope has been raised. */
  71. sc_boolean isRaised_i2() const;
  72. private:
  73. friend class InternalEventLifeCycle;
  74. sc_boolean i1_raised;
  75. sc_boolean i2_raised;
  76. };
  77. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  78. static const sc_integer maxOrthogonalStates = 2;
  79. InternalEventLifeCycleStates stateConfVector[maxOrthogonalStates];
  80. sc_ushort stateConfVectorPosition;
  81. DefaultSCI iface;
  82. InternalSCI ifaceInternalSCI;
  83. // prototypes of all internal functions
  84. sc_boolean check_r1_A_tr0_tr0();
  85. sc_boolean check_r1_A_lr0_lr0();
  86. sc_boolean check_r1_B_tr0_tr0();
  87. sc_boolean check_r2_C_tr0_tr0();
  88. sc_boolean check_r2_D_tr0_tr0();
  89. void effect_r1_A_tr0();
  90. void effect_r1_A_lr0_lr0();
  91. void effect_r1_B_tr0();
  92. void effect_r2_C_tr0();
  93. void effect_r2_D_tr0();
  94. void enseq_r1_A_default();
  95. void enseq_r1_B_default();
  96. void enseq_r2_C_default();
  97. void enseq_r2_D_default();
  98. void enseq_r1_default();
  99. void enseq_r2_default();
  100. void exseq_r1_A();
  101. void exseq_r1_B();
  102. void exseq_r2_C();
  103. void exseq_r2_D();
  104. void exseq_r1();
  105. void exseq_r2();
  106. void react_r1_A();
  107. void react_r1_B();
  108. void react_r2_C();
  109. void react_r2_D();
  110. void react_r1__entry_Default();
  111. void react_r2__entry_Default();
  112. void clearInEvents();
  113. void clearOutEvents();
  114. };
  115. #endif /* INTERNALEVENTLIFECYCLE_H_ */