T Flip-Flop
A T flip-flop toggles its output on each clock edge when its input is high, making it a natural frequency divider.
What it does
A T flip-flop, for toggle, has a single input T. When T is high the output flips on every clock edge; when T is low the output holds. It is the simplest element for counting and dividing frequency.
Behavior table
| T | Q next |
|---|---|
| 0 | Q (hold) |
| 1 | NOT Q (toggle) |
How it is made
A T flip-flop is a JK flip-flop with J and K tied together, or a D flip-flop with D wired to NOT Q through the toggle logic: D = T XOR Q. Both give the same toggling behavior.
Frequency division
With T held high, a T flip-flop toggles once per clock edge, so its output completes one full cycle for every two input cycles. This halves the frequency. Chaining n of them divides by 2^n, which is exactly how a ripple counter works.
Uses
T flip-flops build binary ripple counters, clock dividers, and any circuit that needs to alternate state on a repeating trigger.
In code
if t:
q = not q # on each clock edge