Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare the state register in the FSM.
Verilog
reg [1] ; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using clock or reset as the state register name.
Forgetting to declare the state register.
✗ Incorrect
The state register holds the current state of the FSM.
2fill in blank
mediumComplete the code to define the next state logic in the FSM.
Verilog
always @(*) begin
case (state)
IDLE: next_state = [1];
default: next_state = IDLE;
endcase
end Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning signals like clock or reset as next state.
Using undefined state names.
✗ Incorrect
The next state after IDLE is usually START or another defined state.
3fill in blank
hardFix the error in the state update block by completing the sensitivity list.
Verilog
always @(posedge clk or posedge [1]) begin if (reset) state <= IDLE; else state <= next_state; end
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using signals other than reset in the sensitivity list.
Omitting reset from the sensitivity list.
✗ Incorrect
The reset signal is usually asynchronous and included in the sensitivity list.
4fill in blank
hardFill both blanks to complete the output logic block for the FSM.
Verilog
always @(*) begin
case (state)
IDLE: output_signal = [1];
START: output_signal = [2];
default: output_signal = 0;
endcase
end Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using signals like enable or reset as output values.
Assigning outputs incorrectly for states.
✗ Incorrect
Outputs depend on the current state; IDLE usually outputs 0, START outputs 1.
5fill in blank
hardFill all three blanks to complete the three-block FSM style: state register, next state logic, and output logic.
Verilog
reg [1]; reg [2]; always @(posedge clk or posedge reset) begin if (reset) [1] <= IDLE; else [1] <= [2]; end always @(*) begin case ([3]) IDLE: [2] = START; START: [2] = IDLE; default: [2] = IDLE; endcase end always @(*) begin output_signal = 0; case ([3]) START: output_signal = 1; endcase end
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using clock as a variable in the FSM logic.
Mixing up state and next_state variables.
✗ Incorrect
The state register is state, the next state variable is next_state, and the case uses state.