LogicalOr.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef LOGICALOR_H_
  2. #define LOGICALOR_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'LogicalOr'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. LogicalOr_main_region_A,
  13. LogicalOr_last_state
  14. } LogicalOrStates;
  15. /*! Type definition of the data structure for the LogicalOrIface interface scope. */
  16. typedef struct
  17. {
  18. sc_integer x;
  19. sc_boolean b;
  20. } LogicalOrIface;
  21. /*! Define dimension of the state configuration vector for orthogonal states. */
  22. #define LOGICALOR_MAX_ORTHOGONAL_STATES 1
  23. /*!
  24. * Type definition of the data structure for the LogicalOr state machine.
  25. * This data structure has to be allocated by the client code.
  26. */
  27. typedef struct
  28. {
  29. LogicalOrStates stateConfVector[LOGICALOR_MAX_ORTHOGONAL_STATES];
  30. sc_ushort stateConfVectorPosition;
  31. LogicalOrIface iface;
  32. } LogicalOr;
  33. /*! Initializes the LogicalOr state machine data structures. Must be called before first usage.*/
  34. extern void logicalOr_init(LogicalOr* handle);
  35. /*! Activates the state machine */
  36. extern void logicalOr_enter(LogicalOr* handle);
  37. /*! Deactivates the state machine */
  38. extern void logicalOr_exit(LogicalOr* handle);
  39. /*! Performs a 'run to completion' step. */
  40. extern void logicalOr_runCycle(LogicalOr* handle);
  41. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  42. extern sc_integer logicalOrIface_get_x(const LogicalOr* handle);
  43. /*! Sets the value of the variable 'x' that is defined in the default interface scope. */
  44. extern void logicalOrIface_set_x(LogicalOr* handle, sc_integer value);
  45. /*! Gets the value of the variable 'b' that is defined in the default interface scope. */
  46. extern sc_boolean logicalOrIface_get_b(const LogicalOr* handle);
  47. /*! Sets the value of the variable 'b' that is defined in the default interface scope. */
  48. extern void logicalOrIface_set_b(LogicalOr* handle, sc_boolean value);
  49. /*!
  50. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  51. * 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.
  52. */
  53. extern sc_boolean logicalOr_isActive(const LogicalOr* handle);
  54. /*!
  55. * Checks if all active states are final.
  56. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  57. */
  58. extern sc_boolean logicalOr_isFinal(const LogicalOr* handle);
  59. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  60. extern sc_boolean logicalOr_isStateActive(const LogicalOr* handle, LogicalOrStates state);
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif /* LOGICALOR_H_ */