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. This ripple structure is what Boolflow's own CNT4 block implements internally.
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 the waveform against a ready-made CNT4 block driven by the same CLOCK — they should count in lockstep.