Concept Flow - Moore machine vs Mealy machine
Input Signal
State Update
Output depends
only on state
Output Signal
Shows how Moore and Mealy machines process input and produce output differently based on state and input.
module moore_example(input clk, input x, output reg y); reg state; always @(posedge clk) begin state <= x; y <= state; end endmodule
| Step | clk edge | Input x | State before | State after | Output y |
|---|---|---|---|---|---|
| 1 | rising | 0 | 0 | 0 | 0 |
| 2 | rising | 1 | 0 | 1 | 0 |
| 3 | rising | 1 | 1 | 1 | 1 |
| 4 | rising | 0 | 1 | 0 | 1 |
| 5 | rising | 0 | 0 | 0 | 0 |
| Variable | Start | After 1 | After 2 | After 3 | After 4 | After 5 |
|---|---|---|---|---|---|---|
| state | 0 | 0 | 1 | 1 | 0 | 0 |
| y | 0 | 0 | 0 | 1 | 1 | 0 |
| x | 0 | 0 | 1 | 1 | 0 | 0 |
Moore machine: output depends only on state, changes on clock edge. Mealy machine: output depends on state and input, can change immediately. Moore outputs lag input by one cycle. Mealy outputs react faster to input changes. Use Moore for simpler timing, Mealy for faster response.