Figure: an example of a SMCube state machine. This state machine is used to model the various states of a Digital Clock.
The idea driving the development of SMCube was the need for a lightweight State Machine editor, simulator, and code generator
which could be used in conjunction with ScicosLab or XCos and the E4Coder Code Generator
, allowing the creation of hybrid diagrams composed of both a data-flow part as well as finite state machines. Examples of State Diagrams made with E4Coder
Using SMCube, you can easily:
- Design your own state machine, drawing State Diagrams with states and transitions, configuring their parameters.
- Define a data model for the state machine, with inputs, outputs and local variables.
- Simulate the state machine response given an input pattern. The simulation can be interactive (you can monitor graphically the evolution of the simulation with a proper highlighting of the states) or in background (no graphical output is given, useful for simulating at maximum speed). Generate a C++ language implementation of the state machine for simulation purposes.
- Generate a C language implementation of the state machine, for execution on embedded targets.
Please also note that the semantic behind SMCube has been derived from UML state machines, with the notable exception that the evaluation order of outgoing transactions is prioritized. That change allows a clear specification of the semantic, with the result that the behavior of a state machine during simulation is well specified and it is coincident with the behavior of the code generated.
The current version of SMCube provides the following additional functionalities:
- Integration of a SMCube state machine inside a ScicosLab / XCos diagram, using a customized SMCube block.
- Integration of the simulation and code generator engines of ScicosLab / XCos with SM-Cube for starting, running, stopping a simulation.
- Code generation of a ScicosLab / XCos diagram including one or more state machine with the E4Coder Code Generator and ERIKA Enterprise.
- Efficient microcontroller code generation for stand-alone and parallel state machines.
- Editing of parallel state machines, with undo support.
- XML file format.
- Possibility to specify more than one data input and data output with different types.
- Possibility for the state machine to be triggered by and to generate one or more ScicosLab / XCos events.
- Export of a state machine in a bitmap format (BMP, JPG, PNG).