The Initialize Statement
We've seen that State Machines are built from tables, and tables are built from rows. So far, rows have been built from When/State/Then statements. A row can also be built from an Initialize statement.
Above is a table with one row containing an Initialize statement. This table isn't very interesting. It doesn't respond to any events, because it has no When statements. Instead, it tells a State Machine what to do at initialization time. Here, it tells its State Machine to set its "out" signal to
Like the When/State/Then statements, you can write multi-signal Initialize statements.
And you can initialize input signals as well.
How They Work
Initialize statements are similar to Then statements - they both generate events. Then statements generate events when their When and State statements are satisfied. Initialize statements generate events at initialization time.
Initialization time happens after a State Machine is created and before it has seen any non-initialization time events. The events from an Initialize statement are among the first events a State Machine sees (the only other events it might see first are events from other Devices creating events at initialization time).
If we made a slightly more complex State Machine table:
The State Machine would set its "in" signal terminal
How They are Used
Initialize statements let your State Machines generate events when they start up. Other than causally, Initialize statements are the only way State Machine terminals can create events. At initialization time, your State Machine could be stuck in limbo, waiting to get to state which allows it to do something, but unable to get to that state until it does something. If you find yourself using a Reset Device to kick off your State Machine, you probably should be using an Initialize statement.
Here's a trivial example of a State Machine which generates a setpoint (which could be used by another Device to learn if a value is above or below the setpoint).
Clocking Edge-triggered Devices
Here's an example of a State Machine clocking an edge-triggered Device. Sometimes you want your State Machines to clock edge-triggered Devices (e.g. OneShots, Registers). Your table will have When statements telling it when to turn the clock
Start Up Sequencing
Here's an example where you want to generate a sequence of events. Sequences can come in handy when you have Devices which need to be initialized in a particular order. The Initialize statement starts up the sequence.
This table creates a State Machine which starts up with an