Beyond the forbidden state
The SR latch has an undefined, forbidden combination: S=R=1. The JK flip-flop is what an SR-style element looks like once that gap is closed โ it defines a useful behaviour for every one of its four input combinations.
- J=0, K=0: hold the current output unchanged.
- J=1, K=0: set the output to 1.
- J=0, K=1: reset the output to 0.
- J=1, K=1: toggle โ flip the output to whatever it wasn't. This is exactly the case that was forbidden in an SR latch, now made well-defined because the JK flip-flop only samples J and K on a clock edge, never continuously.
The T flip-flop: toggle only
Tie a JK flip-flop's J and K inputs together and you get a T (toggle) flip-flop: a single input T that, when 1, flips the output on every clock edge, and when 0, holds it. Boolflow ships the T flip-flop as its own ready-made block alongside the JK flip-flop.
Why T flip-flops build counters
Chain T flip-flops so each one's output clocks the next, with every T input tied permanently to 1: the first bit toggles every clock edge, the second toggles every time the first falls from 1 to 0, the third toggles every time the second falls, and so on โ exactly binary counting. Boolflow's flip-flops react to rising edges, and the ~Q output rises at the very moment Q falls, so wire each stage's ~Q pin to the next stage's clock input (wiring Q directly gives a counter that counts down instead). This is called a ripple counter, because each stage only changes after the previous one has. Boolflow's own CNT4 block is the synchronous alternative: all four bits change on the same clock edge.
Try it yourself
Chain four T flip-flops by hand in the circuit editor, each one's output feeding the next one's clock input, and compare against a ready-made CNT4 block driven by the same CLOCK โ the sequence is the same, but the chain settles stage by stage instead of all at once. Try wiring Q instead of ~Q and watch it count down.