BitExpressions.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef BITEXPRESSIONS_H_
  2. #define BITEXPRESSIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'BitExpressions'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. BitExpressions_last_state,
  13. BitExpressions_main_region_StateA,
  14. BitExpressions_main_region_StateB
  15. } BitExpressionsStates;
  16. /*! Type definition of the data structure for the BitExpressionsIface interface scope. */
  17. typedef struct
  18. {
  19. sc_integer myBit1;
  20. sc_integer myBit2;
  21. sc_integer leftBitshift;
  22. sc_integer rightBitshift;
  23. sc_integer complementBitshift;
  24. sc_integer bitwiseAnd;
  25. sc_integer bitwiseOr;
  26. sc_integer bitwiseXor;
  27. sc_boolean e1_raised;
  28. } BitExpressionsIface;
  29. /*! Define dimension of the state configuration vector for orthogonal states. */
  30. #define BITEXPRESSIONS_MAX_ORTHOGONAL_STATES 1
  31. /*! Define indices of states in the StateConfVector */
  32. #define SCVI_BITEXPRESSIONS_MAIN_REGION_STATEA 0
  33. #define SCVI_BITEXPRESSIONS_MAIN_REGION_STATEB 0
  34. /*!
  35. * Type definition of the data structure for the BitExpressions state machine.
  36. * This data structure has to be allocated by the client code.
  37. */
  38. typedef struct
  39. {
  40. BitExpressionsStates stateConfVector[BITEXPRESSIONS_MAX_ORTHOGONAL_STATES];
  41. sc_ushort stateConfVectorPosition;
  42. BitExpressionsIface iface;
  43. } BitExpressions;
  44. /*! Initializes the BitExpressions state machine data structures. Must be called before first usage.*/
  45. extern void bitExpressions_init(BitExpressions* handle);
  46. /*! Activates the state machine */
  47. extern void bitExpressions_enter(BitExpressions* handle);
  48. /*! Deactivates the state machine */
  49. extern void bitExpressions_exit(BitExpressions* handle);
  50. /*! Performs a 'run to completion' step. */
  51. extern void bitExpressions_runCycle(BitExpressions* handle);
  52. /*! Gets the value of the variable 'myBit1' that is defined in the default interface scope. */
  53. extern sc_integer bitExpressionsIface_get_myBit1(const BitExpressions* handle);
  54. /*! Sets the value of the variable 'myBit1' that is defined in the default interface scope. */
  55. extern void bitExpressionsIface_set_myBit1(BitExpressions* handle, sc_integer value);
  56. /*! Gets the value of the variable 'myBit2' that is defined in the default interface scope. */
  57. extern sc_integer bitExpressionsIface_get_myBit2(const BitExpressions* handle);
  58. /*! Sets the value of the variable 'myBit2' that is defined in the default interface scope. */
  59. extern void bitExpressionsIface_set_myBit2(BitExpressions* handle, sc_integer value);
  60. /*! Gets the value of the variable 'leftBitshift' that is defined in the default interface scope. */
  61. extern sc_integer bitExpressionsIface_get_leftBitshift(const BitExpressions* handle);
  62. /*! Sets the value of the variable 'leftBitshift' that is defined in the default interface scope. */
  63. extern void bitExpressionsIface_set_leftBitshift(BitExpressions* handle, sc_integer value);
  64. /*! Gets the value of the variable 'rightBitshift' that is defined in the default interface scope. */
  65. extern sc_integer bitExpressionsIface_get_rightBitshift(const BitExpressions* handle);
  66. /*! Sets the value of the variable 'rightBitshift' that is defined in the default interface scope. */
  67. extern void bitExpressionsIface_set_rightBitshift(BitExpressions* handle, sc_integer value);
  68. /*! Gets the value of the variable 'complementBitshift' that is defined in the default interface scope. */
  69. extern sc_integer bitExpressionsIface_get_complementBitshift(const BitExpressions* handle);
  70. /*! Sets the value of the variable 'complementBitshift' that is defined in the default interface scope. */
  71. extern void bitExpressionsIface_set_complementBitshift(BitExpressions* handle, sc_integer value);
  72. /*! Gets the value of the variable 'bitwiseAnd' that is defined in the default interface scope. */
  73. extern sc_integer bitExpressionsIface_get_bitwiseAnd(const BitExpressions* handle);
  74. /*! Sets the value of the variable 'bitwiseAnd' that is defined in the default interface scope. */
  75. extern void bitExpressionsIface_set_bitwiseAnd(BitExpressions* handle, sc_integer value);
  76. /*! Gets the value of the variable 'bitwiseOr' that is defined in the default interface scope. */
  77. extern sc_integer bitExpressionsIface_get_bitwiseOr(const BitExpressions* handle);
  78. /*! Sets the value of the variable 'bitwiseOr' that is defined in the default interface scope. */
  79. extern void bitExpressionsIface_set_bitwiseOr(BitExpressions* handle, sc_integer value);
  80. /*! Gets the value of the variable 'bitwiseXor' that is defined in the default interface scope. */
  81. extern sc_integer bitExpressionsIface_get_bitwiseXor(const BitExpressions* handle);
  82. /*! Sets the value of the variable 'bitwiseXor' that is defined in the default interface scope. */
  83. extern void bitExpressionsIface_set_bitwiseXor(BitExpressions* handle, sc_integer value);
  84. /*! Raises the in event 'e1' that is defined in the default interface scope. */
  85. extern void bitExpressionsIface_raise_e1(BitExpressions* handle);
  86. /*!
  87. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  88. * A state machine is active if it was entered. It is inactive if it has not been entered at all or if it has been exited.
  89. */
  90. extern sc_boolean bitExpressions_isActive(const BitExpressions* handle);
  91. /*!
  92. * Checks if all active states are final.
  93. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  94. */
  95. extern sc_boolean bitExpressions_isFinal(const BitExpressions* handle);
  96. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  97. extern sc_boolean bitExpressions_isStateActive(const BitExpressions* handle, BitExpressionsStates state);
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101. #endif /* BITEXPRESSIONS_H_ */