T Flip-Flop

Design a toggle flip-flop with a synchronous active-high reset: on each rising clock edge q inverts when t is 1 and holds when t is 0. Reset forces q to 0.

Inputs: clk, rst, t.
Output: q.

The testbench drives the inputs on the falling clock edge and checks the outputs just before and just after every rising edge, against a reference model, for 40 cycles.

Contributed by Indicore

Compiler Output
Waveform Viewer