ConditionalExpressions.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #ifndef CONDITIONALEXPRESSIONS_H_
  2. #define CONDITIONALEXPRESSIONS_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'ConditionalExpressions'.
  6. */
  7. class ConditionalExpressions : public StatemachineInterface
  8. {
  9. public:
  10. ConditionalExpressions();
  11. ~ConditionalExpressions();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_A,
  16. main_region_B,
  17. ConditionalExpressions_last_state
  18. } ConditionalExpressionsStates;
  19. //! Inner class for default interface scope.
  20. class DefaultSCI
  21. {
  22. public:
  23. /*! Raises the in event 'e' that is defined in the default interface scope. */
  24. void raise_e();
  25. /*! Gets the value of the variable 'condition' that is defined in the default interface scope. */
  26. sc_integer get_condition() const;
  27. /*! Sets the value of the variable 'condition' that is defined in the default interface scope. */
  28. void set_condition(sc_integer value);
  29. /*! Gets the value of the variable 'boolVar' that is defined in the default interface scope. */
  30. sc_boolean get_boolVar() const;
  31. /*! Sets the value of the variable 'boolVar' that is defined in the default interface scope. */
  32. void set_boolVar(sc_boolean value);
  33. private:
  34. friend class ConditionalExpressions;
  35. sc_boolean e_raised;
  36. sc_integer condition;
  37. sc_boolean boolVar;
  38. };
  39. /*! Returns an instance of the interface class 'DefaultSCI'. */
  40. DefaultSCI* getDefaultSCI();
  41. /*! Raises the in event 'e' that is defined in the default interface scope. */
  42. void raise_e();
  43. /*! Gets the value of the variable 'condition' that is defined in the default interface scope. */
  44. sc_integer get_condition() const;
  45. /*! Sets the value of the variable 'condition' that is defined in the default interface scope. */
  46. void set_condition(sc_integer value);
  47. /*! Gets the value of the variable 'boolVar' that is defined in the default interface scope. */
  48. sc_boolean get_boolVar() const;
  49. /*! Sets the value of the variable 'boolVar' that is defined in the default interface scope. */
  50. void set_boolVar(sc_boolean value);
  51. /*
  52. * Functions inherited from StatemachineInterface
  53. */
  54. virtual void init();
  55. virtual void enter();
  56. virtual void exit();
  57. virtual void runCycle();
  58. /*!
  59. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  60. * 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.
  61. */
  62. virtual sc_boolean isActive() const;
  63. /*!
  64. * Checks if all active states are final.
  65. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  66. */
  67. virtual sc_boolean isFinal() const;
  68. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  69. sc_boolean isStateActive(ConditionalExpressionsStates state) const;
  70. private:
  71. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  72. static const sc_integer maxOrthogonalStates = 1;
  73. ConditionalExpressionsStates stateConfVector[maxOrthogonalStates];
  74. sc_ushort stateConfVectorPosition;
  75. DefaultSCI iface;
  76. // prototypes of all internal functions
  77. sc_boolean check_main_region_A_tr0_tr0();
  78. void effect_main_region_A_tr0();
  79. void enact_main_region_A();
  80. void enact_main_region_B();
  81. void enseq_main_region_A_default();
  82. void enseq_main_region_B_default();
  83. void enseq_main_region_default();
  84. void exseq_main_region_A();
  85. void exseq_main_region_B();
  86. void exseq_main_region();
  87. void react_main_region_A();
  88. void react_main_region_B();
  89. void react_main_region__entry_Default();
  90. void clearInEvents();
  91. void clearOutEvents();
  92. };
  93. #endif /* CONDITIONALEXPRESSIONS_H_ */