SyncFork.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #ifndef SYNCFORK_H_
  2. #define SYNCFORK_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'SyncFork'.
  6. */
  7. class SyncFork : public StatemachineInterface
  8. {
  9. public:
  10. SyncFork();
  11. ~SyncFork();
  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. SyncFork_last_state
  22. } SyncForkStates;
  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. private:
  32. friend class SyncFork;
  33. sc_boolean e_raised;
  34. sc_boolean f_raised;
  35. };
  36. /*! Returns an instance of the interface class 'DefaultSCI'. */
  37. DefaultSCI* getDefaultSCI();
  38. /*! Raises the in event 'e' that is defined in the default interface scope. */
  39. void raise_e();
  40. /*! Raises the in event 'f' that is defined in the default interface scope. */
  41. void raise_f();
  42. /*
  43. * Functions inherited from StatemachineInterface
  44. */
  45. virtual void init();
  46. virtual void enter();
  47. virtual void exit();
  48. virtual void runCycle();
  49. /*!
  50. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  51. * 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.
  52. */
  53. virtual sc_boolean isActive() const;
  54. /*!
  55. * Checks if all active states are final.
  56. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  57. */
  58. virtual sc_boolean isFinal() const;
  59. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  60. sc_boolean isStateActive(SyncForkStates state) const;
  61. private:
  62. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  63. static const sc_integer maxOrthogonalStates = 2;
  64. SyncForkStates stateConfVector[maxOrthogonalStates];
  65. sc_ushort stateConfVectorPosition;
  66. DefaultSCI iface;
  67. // prototypes of all internal functions
  68. sc_boolean check_main_region_A_tr0_tr0();
  69. sc_boolean check_main_region_A_tr1_tr1();
  70. sc_boolean check_main_region_B_tr0_tr0();
  71. sc_boolean check_main_region_B_r1_C1_tr0_tr0();
  72. sc_boolean check_main_region_B_r2_D1_tr0_tr0();
  73. void effect_main_region_A_tr0();
  74. void effect_main_region_A_tr1();
  75. void effect_main_region_B_tr0();
  76. void effect_main_region_B_r1_C1_tr0();
  77. void effect_main_region_B_r2_D1_tr0();
  78. void enseq_main_region_A_default();
  79. void enseq_main_region_B_default();
  80. void enseq_main_region_B_r1_C1_default();
  81. void enseq_main_region_B_r1_C2_default();
  82. void enseq_main_region_B_r2_D1_default();
  83. void enseq_main_region_B_r2_D2_default();
  84. void enseq_main_region_default();
  85. void enseq_main_region_B_r1_default();
  86. void enseq_main_region_B_r2_default();
  87. void exseq_main_region_A();
  88. void exseq_main_region_B();
  89. void exseq_main_region_B_r1_C1();
  90. void exseq_main_region_B_r1_C2();
  91. void exseq_main_region_B_r2_D1();
  92. void exseq_main_region_B_r2_D2();
  93. void exseq_main_region();
  94. void exseq_main_region_B_r1();
  95. void exseq_main_region_B_r2();
  96. void react_main_region_A();
  97. void react_main_region_B_r1_C1();
  98. void react_main_region_B_r1_C2();
  99. void react_main_region_B_r2_D1();
  100. void react_main_region_B_r2_D2();
  101. void react_main_region__entry_Default();
  102. void react_main_region_B_r1__entry_Default();
  103. void react_main_region_B_r2__entry_Default();
  104. void react_main_region__sync0();
  105. void clearInEvents();
  106. void clearOutEvents();
  107. };
  108. #endif /* SYNCFORK_H_ */