The Clock and the D Flip-Flop

The eleventh intro answers the question of when exactly a circuit writes data. The experiment uses a D flip-flop and a WRITE button.

Experiment: the write button

On the left are the data D and the WRITE button. Toggle D — lamp Q does not change. Press WRITE: at that moment Q copies D. Until the button is pressed, D can be toggled freely — Q stays put.

The rule: the clock edge

The moment the clock switches from 0 to 1 is called the edge: at the edge the flip-flop captures D. What gets written is what was on the input exactly at the press: change D from 1 to 0 and only then press WRITE, and Q becomes 0 — the one missed the press. Between edges the data can change however it likes; the circuit does not notice.

Transfer: will the write catch it

Check yourself: right now D=1 and WRITE has not been pressed, so Q=0. You change D to 0 and press WRITE. What will Q show? Zero: the circuit keeps no history of D, only what is on the input at the press gets written.

Where it is used

The D flip-flop you build on this level is the key part of a processor. Eight flip-flops sharing one clock make a register. On each tick the processor takes exactly one step — the way music moves to the beats of a metronome.

Take the intro in the game · Level 11 guide · All intros