AlwaysOncycle.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #ifndef ALWAYSONCYCLE_H_
  2. #define ALWAYSONCYCLE_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'AlwaysOncycle'.
  6. */
  7. class AlwaysOncycle : public StatemachineInterface
  8. {
  9. public:
  10. AlwaysOncycle();
  11. ~AlwaysOncycle();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_StateA,
  16. main_region_StateB,
  17. AlwaysOncycle_last_state
  18. } AlwaysOncycleStates;
  19. //! Inner class for default interface scope.
  20. class DefaultSCI
  21. {
  22. public:
  23. /*! Gets the value of the variable 'value' that is defined in the default interface scope. */
  24. sc_integer get_value() const;
  25. /*! Sets the value of the variable 'value' that is defined in the default interface scope. */
  26. void set_value(sc_integer value);
  27. /*! Gets the value of the variable 'v2' that is defined in the default interface scope. */
  28. sc_boolean get_v2() const;
  29. /*! Sets the value of the variable 'v2' that is defined in the default interface scope. */
  30. void set_v2(sc_boolean value);
  31. private:
  32. friend class AlwaysOncycle;
  33. sc_integer value;
  34. sc_boolean v2;
  35. };
  36. /*! Returns an instance of the interface class 'DefaultSCI'. */
  37. DefaultSCI* getDefaultSCI();
  38. /*! Gets the value of the variable 'value' that is defined in the default interface scope. */
  39. sc_integer get_value() const;
  40. /*! Sets the value of the variable 'value' that is defined in the default interface scope. */
  41. void set_value(sc_integer value);
  42. /*! Gets the value of the variable 'v2' that is defined in the default interface scope. */
  43. sc_boolean get_v2() const;
  44. /*! Sets the value of the variable 'v2' that is defined in the default interface scope. */
  45. void set_v2(sc_boolean value);
  46. /*
  47. * Functions inherited from StatemachineInterface
  48. */
  49. virtual void init();
  50. virtual void enter();
  51. virtual void exit();
  52. virtual void runCycle();
  53. /*!
  54. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  55. * 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.
  56. */
  57. virtual sc_boolean isActive() const;
  58. /*!
  59. * Checks if all active states are final.
  60. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  61. */
  62. virtual sc_boolean isFinal() const;
  63. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  64. sc_boolean isStateActive(AlwaysOncycleStates state) const;
  65. private:
  66. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  67. static const sc_integer maxOrthogonalStates = 1;
  68. AlwaysOncycleStates stateConfVector[maxOrthogonalStates];
  69. sc_ushort stateConfVectorPosition;
  70. DefaultSCI iface;
  71. // prototypes of all internal functions
  72. sc_boolean check_main_region_StateA_tr0_tr0();
  73. sc_boolean check_main_region_StateA_lr1_lr1();
  74. sc_boolean check_main_region_StateB_tr0_tr0();
  75. sc_boolean check_main_region_StateB_lr0_lr0();
  76. void effect_main_region_StateA_tr0();
  77. void effect_main_region_StateA_lr1_lr1();
  78. void effect_main_region_StateB_tr0();
  79. void effect_main_region_StateB_lr0_lr0();
  80. void enact_main_region_StateA();
  81. void exact_main_region_StateA();
  82. void enseq_main_region_StateA_default();
  83. void enseq_main_region_StateB_default();
  84. void enseq_main_region_default();
  85. void exseq_main_region_StateA();
  86. void exseq_main_region_StateB();
  87. void exseq_main_region();
  88. void react_main_region_StateA();
  89. void react_main_region_StateB();
  90. void react_main_region__entry_Default();
  91. void clearInEvents();
  92. void clearOutEvents();
  93. };
  94. #endif /* ALWAYSONCYCLE_H_ */