LogicalAnd.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef LOGICALAND_H_
  2. #define LOGICALAND_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'LogicalAnd'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. LogicalAnd_main_region_A,
  13. LogicalAnd_last_state
  14. } LogicalAndStates;
  15. /*! Type definition of the data structure for the LogicalAndIface interface scope. */
  16. typedef struct
  17. {
  18. sc_integer x;
  19. sc_boolean b;
  20. } LogicalAndIface;
  21. /*! Define dimension of the state configuration vector for orthogonal states. */
  22. #define LOGICALAND_MAX_ORTHOGONAL_STATES 1
  23. /*!
  24. * Type definition of the data structure for the LogicalAnd state machine.
  25. * This data structure has to be allocated by the client code.
  26. */
  27. typedef struct
  28. {
  29. LogicalAndStates stateConfVector[LOGICALAND_MAX_ORTHOGONAL_STATES];
  30. sc_ushort stateConfVectorPosition;
  31. LogicalAndIface iface;
  32. } LogicalAnd;
  33. /*! Initializes the LogicalAnd state machine data structures. Must be called before first usage.*/
  34. extern void logicalAnd_init(LogicalAnd* handle);
  35. /*! Activates the state machine */
  36. extern void logicalAnd_enter(LogicalAnd* handle);
  37. /*! Deactivates the state machine */
  38. extern void logicalAnd_exit(LogicalAnd* handle);
  39. /*! Performs a 'run to completion' step. */
  40. extern void logicalAnd_runCycle(LogicalAnd* handle);
  41. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  42. extern sc_integer logicalAndIface_get_x(const LogicalAnd* handle);
  43. /*! Sets the value of the variable 'x' that is defined in the default interface scope. */
  44. extern void logicalAndIface_set_x(LogicalAnd* handle, sc_integer value);
  45. /*! Gets the value of the variable 'b' that is defined in the default interface scope. */
  46. extern sc_boolean logicalAndIface_get_b(const LogicalAnd* handle);
  47. /*! Sets the value of the variable 'b' that is defined in the default interface scope. */
  48. extern void logicalAndIface_set_b(LogicalAnd* 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 logicalAnd_isActive(const LogicalAnd* 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 logicalAnd_isFinal(const LogicalAnd* 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 logicalAnd_isStateActive(const LogicalAnd* handle, LogicalAndStates state);
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif /* LOGICALAND_H_ */