Skip to content
Tactiverge

Digital logic

D flip-flop

Also called: flip-flop · register bit · edge-triggered · latch · sequential logic

Definition

A D flip-flop stores one bit. On each rising clock edge it copies its D input to its Q output and holds that value until the next edge.

Picture it

It is a camera that takes one snapshot of D per clock tick. Between ticks the input can wobble without affecting Q. A row of n flip-flops sharing a clock is an n-bit register; feed a register's output back through logic and you have a state machine.

The maths

Q(next) = D at the rising clock edge
SI units used in this entry
QuantityUnitSymbol
informationbitbit

Worked example

A 4-bit register of D flip-flops is loaded on each rising edge with its own value plus 1. Starting at 0, what does it hold after 18 edges?

  1. It counts 0, 1, 2, … and wraps after 15
  2. 18 mod 16 = 2

AnswerIt holds 2 (binary 0010).

✓ The number in this answer is recomputed from scratch by an automated test.

Common misconceptions

  • Misconception: A flip-flop does not follow its input continuously; that is a latch, which is transparent while enabled.
  • Misconception: Changing D just before a clock edge can violate setup time and give an unpredictable result.