State_diagram Keyword
state_reg
Use
The state description describes the operation of a sequential state machine
implemented with programmable logic. You can use state descriptions to describe
logic as an alternative to Boolean equations or truth tables.
Example
The following is an example of a simple state machine that advances from one
state to the next, setting the output to the current state, and then starting
over again. Note that the states do not need to be specified in any particular
order. Note also that state 2 is identified by an expression rather than by a
constant. The state register is composed of the signals a and b.
[-> state_out]
STATE state_exp : [equation]
[equation]
:
:
trans_stmt ;]
state 3: y = 3 ;
goto 0 ;
state 1: y = 1 ;
goto S2 ;
state 0: y = 0 ;
goto 1 ;
state S2; y = S2 ;
goto 3 ;
See Also