OutEventLifeCycle.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #ifndef OUTEVENTLIFECYCLE_H_
  2. #define OUTEVENTLIFECYCLE_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'OutEventLifeCycle'.
  6. */
  7. class OutEventLifeCycle : public StatemachineInterface
  8. {
  9. public:
  10. OutEventLifeCycle();
  11. ~OutEventLifeCycle();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. r1_A,
  16. r1_B,
  17. r2_B,
  18. OutEventLifeCycle_last_state
  19. } OutEventLifeCycleStates;
  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. /*! Checks if the out event 'f' that is defined in the default interface scope has been raised. */
  27. sc_boolean isRaised_f() const;
  28. /*! Gets the value of the variable 'f_available_in_cycle' that is defined in the default interface scope. */
  29. sc_boolean get_f_available_in_cycle() const;
  30. /*! Sets the value of the variable 'f_available_in_cycle' that is defined in the default interface scope. */
  31. void set_f_available_in_cycle(sc_boolean value);
  32. /*! Gets the value of the variable 'f_available_in_next_cycle' that is defined in the default interface scope. */
  33. sc_boolean get_f_available_in_next_cycle() const;
  34. /*! Sets the value of the variable 'f_available_in_next_cycle' that is defined in the default interface scope. */
  35. void set_f_available_in_next_cycle(sc_boolean value);
  36. private:
  37. friend class OutEventLifeCycle;
  38. sc_boolean e_raised;
  39. sc_boolean f_raised;
  40. sc_boolean f_available_in_cycle;
  41. sc_boolean f_available_in_next_cycle;
  42. };
  43. /*! Returns an instance of the interface class 'DefaultSCI'. */
  44. DefaultSCI* getDefaultSCI();
  45. /*! Raises the in event 'e' that is defined in the default interface scope. */
  46. void raise_e();
  47. /*! Checks if the out event 'f' that is defined in the default interface scope has been raised. */
  48. sc_boolean isRaised_f() const;
  49. /*! Gets the value of the variable 'f_available_in_cycle' that is defined in the default interface scope. */
  50. sc_boolean get_f_available_in_cycle() const;
  51. /*! Sets the value of the variable 'f_available_in_cycle' that is defined in the default interface scope. */
  52. void set_f_available_in_cycle(sc_boolean value);
  53. /*! Gets the value of the variable 'f_available_in_next_cycle' that is defined in the default interface scope. */
  54. sc_boolean get_f_available_in_next_cycle() const;
  55. /*! Sets the value of the variable 'f_available_in_next_cycle' that is defined in the default interface scope. */
  56. void set_f_available_in_next_cycle(sc_boolean value);
  57. /*
  58. * Functions inherited from StatemachineInterface
  59. */
  60. virtual void init();
  61. virtual void enter();
  62. virtual void exit();
  63. virtual void runCycle();
  64. /*!
  65. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  66. * 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.
  67. */
  68. virtual sc_boolean isActive() const;
  69. /*!
  70. * Checks if all active states are final.
  71. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  72. */
  73. virtual sc_boolean isFinal() const;
  74. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  75. sc_boolean isStateActive(OutEventLifeCycleStates state) const;
  76. private:
  77. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  78. static const sc_integer maxOrthogonalStates = 2;
  79. OutEventLifeCycleStates stateConfVector[maxOrthogonalStates];
  80. sc_ushort stateConfVectorPosition;
  81. DefaultSCI iface;
  82. // prototypes of all internal functions
  83. sc_boolean check_r1_A_tr0_tr0();
  84. sc_boolean check_r1_B_lr0_lr0();
  85. sc_boolean check_r2_B_lr0_lr0();
  86. void effect_r1_A_tr0();
  87. void effect_r1_B_lr0_lr0();
  88. void effect_r2_B_lr0_lr0();
  89. void enseq_r1_A_default();
  90. void enseq_r1_B_default();
  91. void enseq_r2_B_default();
  92. void enseq_r1_default();
  93. void enseq_r2_default();
  94. void exseq_r1_A();
  95. void exseq_r1_B();
  96. void exseq_r2_B();
  97. void exseq_r1();
  98. void exseq_r2();
  99. void react_r1_A();
  100. void react_r1_B();
  101. void react_r2_B();
  102. void react_r1__entry_Default();
  103. void react_r2__entry_Default();
  104. void clearInEvents();
  105. void clearOutEvents();
  106. };
  107. #endif /* OUTEVENTLIFECYCLE_H_ */