Skip to content
BetterDL

Flip-flop

Also called: flip flop, flipflop, flip-flops, FF, edge-triggered flip-flop

An edge-triggered memory element that stores one bit and updates its output only at an active clock edge, holding it in between.

A flip-flop stores one bit and changes it only at an instant: the active edge of its clock. Between edges its output holds, no matter what the data inputs do.

That single-instant behavior is called edge-triggering, and it is what makes flip-flops the workhorse of clocked design. Every flip-flop in a circuit samples its inputs at the same moment, using the values from just before the edge, and only then do the outputs change. So data moves exactly one step per clock, which keeps large circuits predictable.

The common types differ only in how their inputs choose the next value:

Unless a question says otherwise, flip-flops in this course trigger on the rising edge. A bubble on the clock pin means the falling edge instead.

Many flip-flops also have preset and clear pins that act immediately, without waiting for an edge. Groups of flip-flops sharing one clock form a register.

CLKDQ

Worked example

Example

Reading the diagram above

A positive-edge D flip-flop, Q starting at 0. CLK rises in slots 3 and 7.

  1. 1.

    Slots 1–2: no rising edge yet, so Q shows its starting value, 0.

  2. 2.

    Slot 3: rising edge with D = 1. Q becomes 1.

  3. 3.

    Slots 4–6: D wiggles (0, 1, 0), but there is no edge. Q stays 1.

  4. 4.

    Slot 7: rising edge with D = 0. Q becomes 0.

  5. 5.

    Slots 8–10: D goes back to 1, but the next edge never comes. Q stays 0.

  6. 6.

    Q changed exactly twice: once per rising edge, never in between.

Common mistakes

  • Letting Q follow D while the clock is high. That is a latch. A flip-flop only samples at the edge.

  • Updating Q in the slot after the edge. In this course's diagrams, Q changes in the same slot as the rising edge.

  • Treating a clock that starts at 1 as having an edge in its first slot. An edge needs a change from 0.

Practice Flip-flop

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Flip-flop is taught in Latches and Flip-Flops, Registers and Counters.