FSM: Sequence 00,01,11,10 Example
A complete FSM is constructed by combining the next state function and D flip-flops. This exercise provides the next_pattern, the dff module, and the fsm module. Only the next_pattern has to be completed.
Complete the next_pattern module, that provides the next state table for a sequence generator. The sequence is 00, 01, 11, and 10. The reset state is 00.
0001111000011110
The dff module provides a positive edge trigger D flip-flop with a specified reset state give by the init parameter.
The fsm module connects next_pattern and dff modules together. You should copy the bodies of these modules for the following sequence generator exercises (some modification might be required).
Editor
module next_pattern(output logic [1:0] next, input logic [1:0]
cur);
// complete next pattern for sequence 0,1,3,2
endmodule
// pos edge d flip-flop with init
module dff #(parameter N=4, init=0) (
output logic [N-1:0] q, input logic [N-1:0] d,
input logic clk, reset );
always_ff @(posedge clk) q <= reset ? init : d;
endmodule
module fsm #(parameter init=0) (
output logic [1:0] cur, input logic clock, reset );
logic [1:0] next;
dff #(2, init) state( cur, next, clock, reset);
next_pattern next_fn( next, cur );
endmodule
Get Answers For Free
Most questions answered within 1 hours.