Challenge - 5 Problems
T Flip-Flop Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of T Flip-Flop with Toggle Input
What is the output
q after 4 positive clock edges if t = 1 and initial q = 0?Verilog
module t_ff(input clk, input t, output reg q); always @(posedge clk) begin if (t) q <= ~q; end endmodule // Initial q = 0, t = 1, 4 clock cycles
Attempts:
2 left
💡 Hint
Remember that T flip-flop toggles output on each clock edge when T=1.
✗ Incorrect
Starting from q=0, toggling 4 times results in q=0 again (0->1->0->1->0).
❓ Predict Output
intermediate2:00remaining
Behavior with T=0 Input
What will be the output
q after 3 positive clock edges if t = 0 and initial q = 1?Verilog
module t_ff(input clk, input t, output reg q); always @(posedge clk) begin if (t) q <= ~q; end endmodule // Initial q = 1, t = 0, 3 clock cycles
Attempts:
2 left
💡 Hint
When T=0, the flip-flop should hold its value.
✗ Incorrect
With T=0, q does not toggle and remains at initial value 1.
🔧 Debug
advanced2:00remaining
Identify the Syntax Error in T Flip-Flop Code
Which option contains a syntax error preventing the T flip-flop from compiling?
Verilog
always @(posedge clk) begin if t == 1 q <= ~q; end
Attempts:
2 left
💡 Hint
Check the syntax for if statements in Verilog.
✗ Incorrect
Option A misses parentheses, causing syntax error.
🧠 Conceptual
advanced2:00remaining
Effect of Asynchronous Reset on T Flip-Flop
What is the effect of adding an asynchronous active-low reset
rst_n to a T flip-flop?Attempts:
2 left
💡 Hint
Asynchronous reset acts immediately, not waiting for clock.
✗ Incorrect
Active-low asynchronous reset forces output to 0 immediately when asserted.
❓ Predict Output
expert3:00remaining
Output Sequence of T Flip-Flop with Mixed T Input
Given initial
q = 0, and t input sequence over 5 clock cycles: [1, 0, 1, 1, 0], what is the output q after the 5th clock edge?Verilog
module t_ff(input clk, input t, output reg q); always @(posedge clk) begin if (t) q <= ~q; end endmodule // Initial q=0, t sequence: 1,0,1,1,0
Attempts:
2 left
💡 Hint
Toggle q only when t=1 at clock edge.
✗ Incorrect
Toggle steps: 0->1 (t=1), hold (t=0), 1->0 (t=1), 0->1 (t=1), hold (t=0). Final q=1.