Constants.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. #ifndef CONSTANTS_H_
  2. #define CONSTANTS_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'Constants'.
  6. */
  7. class Constants : public StatemachineInterface
  8. {
  9. public:
  10. Constants();
  11. ~Constants();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_A,
  16. main_region_B,
  17. main_region_C,
  18. Constants_last_state
  19. } ConstantsStates;
  20. //! Inner class for default interface scope.
  21. class DefaultSCI
  22. {
  23. public:
  24. /*! Raises the in event 'e' that is defined in the default interface scope. */
  25. void raise_e();
  26. /*! Raises the in event 'e2' that is defined in the default interface scope. */
  27. void raise_e2(sc_integer value);
  28. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  29. const sc_integer get_x() const;
  30. /*! Gets the value of the variable 'y' that is defined in the default interface scope. */
  31. const sc_integer get_y() const;
  32. /*! Gets the value of the variable 'result' that is defined in the default interface scope. */
  33. sc_integer get_result() const;
  34. /*! Sets the value of the variable 'result' that is defined in the default interface scope. */
  35. void set_result(sc_integer value);
  36. private:
  37. friend class Constants;
  38. sc_boolean e_raised;
  39. sc_boolean e2_raised;
  40. sc_integer e2_value;
  41. static const sc_integer x;
  42. static const sc_integer y;
  43. sc_integer result;
  44. };
  45. /*! Returns an instance of the interface class 'DefaultSCI'. */
  46. DefaultSCI* getDefaultSCI();
  47. /*! Raises the in event 'e' that is defined in the default interface scope. */
  48. void raise_e();
  49. /*! Raises the in event 'e2' that is defined in the default interface scope. */
  50. void raise_e2(sc_integer value);
  51. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  52. const sc_integer get_x() const;
  53. /*! Gets the value of the variable 'y' that is defined in the default interface scope. */
  54. const sc_integer get_y() const;
  55. /*! Gets the value of the variable 'result' that is defined in the default interface scope. */
  56. sc_integer get_result() const;
  57. /*! Sets the value of the variable 'result' that is defined in the default interface scope. */
  58. void set_result(sc_integer value);
  59. //! Inner class for Named interface scope.
  60. class SCI_Named
  61. {
  62. public:
  63. /*! Gets the value of the variable 'y' that is defined in the interface scope 'Named'. */
  64. const sc_string get_y() const;
  65. /*! Gets the value of the variable 'two' that is defined in the interface scope 'Named'. */
  66. const sc_integer get_two() const;
  67. private:
  68. friend class Constants;
  69. static const sc_string y;
  70. static const sc_integer two;
  71. };
  72. /*! Returns an instance of the interface class 'SCI_Named'. */
  73. SCI_Named* getSCI_Named();
  74. /*
  75. * Functions inherited from StatemachineInterface
  76. */
  77. virtual void init();
  78. virtual void enter();
  79. virtual void exit();
  80. virtual void runCycle();
  81. /*!
  82. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  83. * 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.
  84. */
  85. virtual sc_boolean isActive() const;
  86. /*!
  87. * Checks if all active states are final.
  88. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  89. */
  90. virtual sc_boolean isFinal() const;
  91. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  92. sc_boolean isStateActive(ConstantsStates state) const;
  93. private:
  94. //! Inner class for internal interface scope.
  95. class InternalSCI
  96. {
  97. public:
  98. /*! Gets the value of the variable 'internalConstant' that is defined in the internal scope. */
  99. const sc_integer get_internalConstant() const;
  100. private:
  101. friend class Constants;
  102. static const sc_integer internalConstant;
  103. };
  104. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  105. static const sc_integer maxOrthogonalStates = 1;
  106. ConstantsStates stateConfVector[maxOrthogonalStates];
  107. sc_ushort stateConfVectorPosition;
  108. DefaultSCI iface;
  109. SCI_Named ifaceNamed;
  110. InternalSCI ifaceInternalSCI;
  111. // prototypes of all internal functions
  112. sc_boolean check_main_region_A_tr0_tr0();
  113. sc_boolean check_main_region_B_tr0_tr0();
  114. sc_boolean check_main_region_C_tr0_tr0();
  115. void effect_main_region_A_tr0();
  116. void effect_main_region_B_tr0();
  117. void effect_main_region_C_tr0();
  118. void enact_main_region_B();
  119. void enact_main_region_C();
  120. void enseq_main_region_A_default();
  121. void enseq_main_region_B_default();
  122. void enseq_main_region_C_default();
  123. void enseq_main_region_default();
  124. void exseq_main_region_A();
  125. void exseq_main_region_B();
  126. void exseq_main_region_C();
  127. void exseq_main_region();
  128. void react_main_region_A();
  129. void react_main_region_B();
  130. void react_main_region_C();
  131. void react_main_region__entry_Default();
  132. void clearInEvents();
  133. void clearOutEvents();
  134. };
  135. #endif /* CONSTANTS_H_ */