Courses / Computer Science I
Basic Digital Design

Flip-Flops and Registers

Computer Science I 255 words Free to read

Flip-Flop Basics & Memory

A flip-flop is a one-bit memory element that changes state only on a clock edge (the instant the clock transitions from 0 to 1). This edge-triggering ensures predictable, once-per-tick updates, unlike a level-sensitive latch.

The D flip-flop ("data" flip-flop) is the most common type: on each clock edge, its output QQ takes the value of its input DD. In short, it remembers whatever DD was at the tick.

FeatureLatchFlip-Flop
SensitivityLevel-sensitiveEdge-triggered
TransparencyTransparent when enabledSamples only at clock edge
Timing RiskHigh risk of timing bugsStable, predictable updates

Common pitfall: Confusing an edge-triggered flip-flop with a level-sensitive latch. A latch lets outputs follow inputs continuously while active, causing subtle timing bugs if used where strict edge-sampling is required.

The same D signal, kept two different ways -- continuously and once

Registers and Sequential Circuits

Wiring nn D flip-flops side by side, driven by the same clock, creates an nn-bit register. This unit stores an nn-bit value and updates all bits simultaneously on each clock edge.

Registers form the fast working storage inside a CPU. Feed a register's output back through combinational logic to build stateful machines:

All sequential circuits follow this core pattern: flip-flops hold the state, combinational logic computes the next state, and the clock advances it.

Practise this lesson

The explanation above is free to read. The graded practice for this lesson lives in the Tryals app.

10practice questions
2interactive scenes

Basic Digital Design