SyncJoin.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. #ifndef SYNCJOIN_H_
  2. #define SYNCJOIN_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'SyncJoin'.
  6. */
  7. class SyncJoin : public StatemachineInterface
  8. {
  9. public:
  10. SyncJoin();
  11. ~SyncJoin();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_A,
  16. main_region_B,
  17. main_region_B_r1_C1,
  18. main_region_B_r1_C2,
  19. main_region_B_r2_D1,
  20. main_region_B_r2_D2,
  21. SyncJoin_last_state
  22. } SyncJoinStates;
  23. //! Inner class for default interface scope.
  24. class DefaultSCI
  25. {
  26. public:
  27. /*! Raises the in event 'e' that is defined in the default interface scope. */
  28. void raise_e();
  29. /*! Raises the in event 'f' that is defined in the default interface scope. */
  30. void raise_f();
  31. /*! Raises the in event 'jc' that is defined in the default interface scope. */
  32. void raise_jc();
  33. /*! Raises the in event 'jd' that is defined in the default interface scope. */
  34. void raise_jd();
  35. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  36. sc_integer get_x() const;
  37. /*! Sets the value of the variable 'x' that is defined in the default interface scope. */
  38. void set_x(sc_integer value);
  39. private:
  40. friend class SyncJoin;
  41. sc_boolean e_raised;
  42. sc_boolean f_raised;
  43. sc_boolean jc_raised;
  44. sc_boolean jd_raised;
  45. sc_integer x;
  46. };
  47. /*! Returns an instance of the interface class 'DefaultSCI'. */
  48. DefaultSCI* getDefaultSCI();
  49. /*! Raises the in event 'e' that is defined in the default interface scope. */
  50. void raise_e();
  51. /*! Raises the in event 'f' that is defined in the default interface scope. */
  52. void raise_f();
  53. /*! Raises the in event 'jc' that is defined in the default interface scope. */
  54. void raise_jc();
  55. /*! Raises the in event 'jd' that is defined in the default interface scope. */
  56. void raise_jd();
  57. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  58. sc_integer get_x() const;
  59. /*! Sets the value of the variable 'x' that is defined in the default interface scope. */
  60. void set_x(sc_integer value);
  61. /*
  62. * Functions inherited from StatemachineInterface
  63. */
  64. virtual void init();
  65. virtual void enter();
  66. virtual void exit();
  67. virtual void runCycle();
  68. /*!
  69. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  70. * 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.
  71. */
  72. virtual sc_boolean isActive() const;
  73. /*!
  74. * Checks if all active states are final.
  75. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  76. */
  77. virtual sc_boolean isFinal() const;
  78. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  79. sc_boolean isStateActive(SyncJoinStates state) const;
  80. private:
  81. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  82. static const sc_integer maxOrthogonalStates = 2;
  83. SyncJoinStates stateConfVector[maxOrthogonalStates];
  84. sc_ushort stateConfVectorPosition;
  85. DefaultSCI iface;
  86. // prototypes of all internal functions
  87. sc_boolean check_main_region_A_tr0_tr0();
  88. sc_boolean check_main_region_B_r1_C1_tr0_tr0();
  89. sc_boolean check_main_region_B_r1_C2_tr0_tr0();
  90. sc_boolean check_main_region_B_r2_D1_tr0_tr0();
  91. sc_boolean check_main_region_B_r2_D2_tr0_tr0();
  92. void effect_main_region_A_tr0();
  93. void effect_main_region_B_r1_C1_tr0();
  94. void effect_main_region_B_r1_C2_tr0();
  95. void effect_main_region_B_r2_D1_tr0();
  96. void effect_main_region_B_r2_D2_tr0();
  97. void enact_main_region_A();
  98. void enseq_main_region_A_default();
  99. void enseq_main_region_B_default();
  100. void enseq_main_region_B_r1_C1_default();
  101. void enseq_main_region_B_r1_C2_default();
  102. void enseq_main_region_B_r2_D1_default();
  103. void enseq_main_region_B_r2_D2_default();
  104. void enseq_main_region_default();
  105. void enseq_main_region_B_r1_default();
  106. void enseq_main_region_B_r2_default();
  107. void exseq_main_region_A();
  108. void exseq_main_region_B();
  109. void exseq_main_region_B_r1_C1();
  110. void exseq_main_region_B_r1_C2();
  111. void exseq_main_region_B_r2_D1();
  112. void exseq_main_region_B_r2_D2();
  113. void exseq_main_region();
  114. void exseq_main_region_B_r1();
  115. void exseq_main_region_B_r2();
  116. void react_main_region_A();
  117. void react_main_region_B_r1_C1();
  118. void react_main_region_B_r1_C2();
  119. void react_main_region_B_r2_D1();
  120. void react_main_region_B_r2_D2();
  121. void react_main_region__entry_Default();
  122. void react_main_region_B_r1__entry_Default();
  123. void react_main_region_B_r2__entry_Default();
  124. void react_main_region__sync0();
  125. void clearInEvents();
  126. void clearOutEvents();
  127. };
  128. #endif /* SYNCJOIN_H_ */