LogicalAnd.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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_last_state,
  13. LogicalAnd_main_region_A
  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. /*! Define indices of states in the StateConfVector */
  24. #define SCVI_LOGICALAND_MAIN_REGION_A 0
  25. /*!
  26. * Type definition of the data structure for the LogicalAnd state machine.
  27. * This data structure has to be allocated by the client code.
  28. */
  29. typedef struct
  30. {
  31. LogicalAndStates stateConfVector[LOGICALAND_MAX_ORTHOGONAL_STATES];
  32. sc_ushort stateConfVectorPosition;
  33. LogicalAndIface iface;
  34. } LogicalAnd;
  35. /*! Initializes the LogicalAnd state machine data structures. Must be called before first usage.*/
  36. extern void logicalAnd_init(LogicalAnd* handle);
  37. /*! Activates the state machine */
  38. extern void logicalAnd_enter(LogicalAnd* handle);
  39. /*! Deactivates the state machine */
  40. extern void logicalAnd_exit(LogicalAnd* handle);
  41. /*! Performs a 'run to completion' step. */
  42. extern void logicalAnd_runCycle(LogicalAnd* handle);
  43. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  44. extern sc_integer logicalAndIface_get_x(const LogicalAnd* handle);
  45. /*! Sets the value of the variable 'x' that is defined in the default interface scope. */
  46. extern void logicalAndIface_set_x(LogicalAnd* handle, sc_integer value);
  47. /*! Gets the value of the variable 'b' that is defined in the default interface scope. */
  48. extern sc_boolean logicalAndIface_get_b(const LogicalAnd* handle);
  49. /*! Sets the value of the variable 'b' that is defined in the default interface scope. */
  50. extern void logicalAndIface_set_b(LogicalAnd* handle, sc_boolean value);
  51. /*!
  52. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  53. * 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.
  54. */
  55. extern sc_boolean logicalAnd_isActive(const LogicalAnd* handle);
  56. /*!
  57. * Checks if all active states are final.
  58. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  59. */
  60. extern sc_boolean logicalAnd_isFinal(const LogicalAnd* handle);
  61. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  62. extern sc_boolean logicalAnd_isStateActive(const LogicalAnd* handle, LogicalAndStates state);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* LOGICALAND_H_ */