BitExpressions.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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_main_region_StateA,
  13. BitExpressions_main_region_StateB,
  14. BitExpressions_last_state
  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. /*!
  32. * Type definition of the data structure for the BitExpressions state machine.
  33. * This data structure has to be allocated by the client code.
  34. */
  35. typedef struct
  36. {
  37. BitExpressionsStates stateConfVector[BITEXPRESSIONS_MAX_ORTHOGONAL_STATES];
  38. sc_ushort stateConfVectorPosition;
  39. BitExpressionsIface iface;
  40. } BitExpressions;
  41. /*! Initializes the BitExpressions state machine data structures. Must be called before first usage.*/
  42. extern void bitExpressions_init(BitExpressions* handle);
  43. /*! Activates the state machine */
  44. extern void bitExpressions_enter(BitExpressions* handle);
  45. /*! Deactivates the state machine */
  46. extern void bitExpressions_exit(BitExpressions* handle);
  47. /*! Performs a 'run to completion' step. */
  48. extern void bitExpressions_runCycle(BitExpressions* handle);
  49. /*! Gets the value of the variable 'myBit1' that is defined in the default interface scope. */
  50. extern sc_integer bitExpressionsIface_get_myBit1(const BitExpressions* handle);
  51. /*! Sets the value of the variable 'myBit1' that is defined in the default interface scope. */
  52. extern void bitExpressionsIface_set_myBit1(BitExpressions* handle, sc_integer value);
  53. /*! Gets the value of the variable 'myBit2' that is defined in the default interface scope. */
  54. extern sc_integer bitExpressionsIface_get_myBit2(const BitExpressions* handle);
  55. /*! Sets the value of the variable 'myBit2' that is defined in the default interface scope. */
  56. extern void bitExpressionsIface_set_myBit2(BitExpressions* handle, sc_integer value);
  57. /*! Gets the value of the variable 'leftBitshift' that is defined in the default interface scope. */
  58. extern sc_integer bitExpressionsIface_get_leftBitshift(const BitExpressions* handle);
  59. /*! Sets the value of the variable 'leftBitshift' that is defined in the default interface scope. */
  60. extern void bitExpressionsIface_set_leftBitshift(BitExpressions* handle, sc_integer value);
  61. /*! Gets the value of the variable 'rightBitshift' that is defined in the default interface scope. */
  62. extern sc_integer bitExpressionsIface_get_rightBitshift(const BitExpressions* handle);
  63. /*! Sets the value of the variable 'rightBitshift' that is defined in the default interface scope. */
  64. extern void bitExpressionsIface_set_rightBitshift(BitExpressions* handle, sc_integer value);
  65. /*! Gets the value of the variable 'complementBitshift' that is defined in the default interface scope. */
  66. extern sc_integer bitExpressionsIface_get_complementBitshift(const BitExpressions* handle);
  67. /*! Sets the value of the variable 'complementBitshift' that is defined in the default interface scope. */
  68. extern void bitExpressionsIface_set_complementBitshift(BitExpressions* handle, sc_integer value);
  69. /*! Gets the value of the variable 'bitwiseAnd' that is defined in the default interface scope. */
  70. extern sc_integer bitExpressionsIface_get_bitwiseAnd(const BitExpressions* handle);
  71. /*! Sets the value of the variable 'bitwiseAnd' that is defined in the default interface scope. */
  72. extern void bitExpressionsIface_set_bitwiseAnd(BitExpressions* handle, sc_integer value);
  73. /*! Gets the value of the variable 'bitwiseOr' that is defined in the default interface scope. */
  74. extern sc_integer bitExpressionsIface_get_bitwiseOr(const BitExpressions* handle);
  75. /*! Sets the value of the variable 'bitwiseOr' that is defined in the default interface scope. */
  76. extern void bitExpressionsIface_set_bitwiseOr(BitExpressions* handle, sc_integer value);
  77. /*! Gets the value of the variable 'bitwiseXor' that is defined in the default interface scope. */
  78. extern sc_integer bitExpressionsIface_get_bitwiseXor(const BitExpressions* handle);
  79. /*! Sets the value of the variable 'bitwiseXor' that is defined in the default interface scope. */
  80. extern void bitExpressionsIface_set_bitwiseXor(BitExpressions* handle, sc_integer value);
  81. /*! Raises the in event 'e1' that is defined in the default interface scope. */
  82. extern void bitExpressionsIface_raise_e1(BitExpressions* handle);
  83. /*!
  84. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  85. * 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.
  86. */
  87. extern sc_boolean bitExpressions_isActive(const BitExpressions* handle);
  88. /*!
  89. * Checks if all active states are final.
  90. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  91. */
  92. extern sc_boolean bitExpressions_isFinal(const BitExpressions* handle);
  93. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  94. extern sc_boolean bitExpressions_isStateActive(const BitExpressions* handle, BitExpressionsStates state);
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif /* BITEXPRESSIONS_H_ */