BitFlow

T Flip-Flop

intermediate · sequential · 110 XP

Sign in to write your solution, run it in the simulator and submit it for grading.

Sign in or create a free account →

Problem

T Flip-Flop The T (Toggle) flip-flop toggles its output on every clock edge when T=1, and holds when T=0. It is a special case of the JK flip-flop where J=K=T. On every `posedge clk`: - `t=0`: Q holds - `t=1`: Q toggles (Q = ~Q) **Interface** | Port | Direction | Description | |-------|-----------|---------------------------| | `clk` | input | Clock (rising-edge) | | `rst` | input | Synchronous reset (active-high) | | `t` | input | Toggle enable | | `q` | output | State output | **Why T flip-flops matter:** A T flip-flop with T=1 permanently divides the clock by 2. Chain N of them to build a ripple counter that divides by 2^N. They are the core of every binary counter.

Constraints

  • Use always @(posedge clk).
  • Synchronous reset has priority over T.
  • Use non-blocking assignments (<=).

Examples

Input: rst=1, clk↑

Output: q=0

Input: rst=0, t=1, clk↑ (q was 0)

Output: q=1

Input: rst=0, t=1, clk↑ (q was 1)

Output: q=0

Input: rst=0, t=0, clk↑

Output: q=prev

Common questions

What does the T Flip-Flop problem ask you to build?
T Flip-Flop The T (Toggle) flip-flop toggles its output on every clock edge when T=1, and holds when T=0. It is a special case of the JK flip-flop where J=K=T.
What constraints does T Flip-Flop have?
Use always @(posedge clk).; Synchronous reset has priority over T.; Use non-blocking assignments (<=).
What is an example input and output for T Flip-Flop?
Input rst=1, clk↑ gives output q=0.
Which Verilog concepts does T Flip-Flop practise?
sequential, flip-flop, T, toggle, counter.