Complete the code to declare the state register.
reg [1:0] [1];
The state register holds the current state of the FSM and is declared as state.
Complete the code to define the next state logic using a case statement.
always @(*) begin
case (state)
2'b00: next_state = [1];
default: next_state = 2'b00;
endcase
endThe next state after 2'b00 is 2'b01 as per the FSM design.
Fix the error in the output logic to assign output based on the current state.
always @(*) begin case ([1]) 2'b00: out = 1'b0; 2'b01: out = 1'b1; default: out = 1'b0; endcase end
The output depends on the current state, not the next state or inputs.
Fill both blanks to complete the synchronous state update logic.
always @(posedge [1] or posedge [2]) begin if (reset) state <= 2'b00; else state <= next_state; end
The state updates on the rising edge of the clock clk or asynchronous reset reset.
Fill all three blanks to complete the FSM module header and port declarations.
module fsm( input wire [1], input wire [2], output reg [3] );
The FSM module has inputs clk and reset, and output out.
