Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare the JK flip-flop module with inputs and outputs.
Verilog
module jk_ff(input clk, input [1], input j, input k, output reg q); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'reset' instead of 'rst' which is inconsistent with the module naming.
✗ Incorrect
The input is named rst to represent reset signal.
2fill in blank
mediumComplete the always block sensitivity list to trigger on the positive edge of clock and reset.
Verilog
always @(posedge clk or posedge [1]) begin
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using data inputs like 'j' or 'k' in sensitivity list instead of reset.
✗ Incorrect
The flip-flop reacts to the positive edge of the reset signal rst.
3fill in blank
hardFix the error in the reset condition to set output q to 0.
Verilog
if ([1]) q <= 0;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using clock or data inputs instead of reset in the condition.
✗ Incorrect
The reset condition checks if rst is high to clear q.
4fill in blank
hardFill both blanks to complete the JK flip-flop behavior inside the else block.
Verilog
else begin case([1], [2]) 2'b00: q <= q; 2'b01: q <= 0; 2'b10: q <= 1; 2'b11: q <= ~q; endcase end
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using clock or reset signals inside the case statement.
✗ Incorrect
The JK flip-flop behavior depends on inputs j and k.
5fill in blank
hardFill all three blanks to complete the module end and output declaration.
Verilog
endmodule assign [1] = q; // Module [2] with inputs [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using internal signal
q directly as output name.Incorrect module name or input list.
✗ Incorrect
The output is assigned to q_out. The module name is jk_ff with inputs clk, rst, j, k.