|
发表于 2004-4-23 00:22:02
|
显示全部楼层
FSM问题
parameter [4:0] IDLE = 5'b00001,
S1 = 5'b00010,
S2 = 5'b00100,
S3 = 5'b01000,
ERROR = 5'b10000;
Example 2 - Parameter definitions for verbose one-hot encoding
parameter [4:0] IDLE = 5'd0,
S1 = 5'd1,
S2 = 5'd2,
S3 = 5'd3,
ERROR = 5'd4;
Example 3 - Parameter definitions for simplified one-hot encoding
The simplified one-hot encoding shown Example 3 uses decimal numbers to index into the state
register. This technique permits comparison of single bits as opposed to comparing against the
entire state vector using the full state parameters shown in Example 2.
parameter [4:1] // ERROR is 4'b0000
IDLE = 4'd1,
S1 = 4'd2,
S2 = 4'd3,
S3 = 4'd4;
Example 4 - Parameter definitions for one-hot with zero-idle encoding
The one-hot with zero-idle encoding can yield very efficient FSMs for state machines that have
many interconnections with complex equations, including a large number of connections to one
particular state. Frequently, multiple transitions are made either to an IDLE state or to another
common state (such as the ERROR-state in this example).
以上引自 《State Machine Coding Styles for Synthesis》 Clifford E. Cummings |
|