FSM code

Common FSM encoding methods
Normally, we use two always blocks to encode FSM, one of which uses sequential logic to describe state and next_state state transitions, and the other uses combinational logic to describe state transitions and output result logic. The following example 1 gives RTL coding, and attaches the state transition diagram.
Insert picture description here
One-hot FSM coding
adopts the indexing method to indicate the state jump. The key is to realize that the parameter no longer represents the state code, but the index of the state vector. Now the comparison and assignment of the state vector or the next state vector are single Bit, notice how the case statement now performs a 1-bit comparison with onehot status bit.
Insert picture description here
Registering the FSM output
Encoding the output of the FSM in the form of a register can ensure zero glitches and improve the synthesis result through standardized input and output. The output of FSM can realize the form of register output by adding a process block to the FSM code.
Insert picture description here

Guess you like

Origin blog.csdn.net/lilliana/article/details/106639662