Skip to content
BetterDL

Register

Also called: n-bit register, parallel register, storage register, registers, data register, basic register

A group of n flip-flops sharing one clock that together store an n-bit value, capturing the whole word at once on each active clock edge.

A register stores a whole binary word. It is n D flip-flops side by side, all driven by the same clock. Flip-flop i holds bit i: its input is Dᵢ and its output is Qᵢ.

Why it matters: a single flip-flop remembers one bit, but hardware works with numbers, addresses and instructions. A register lets a circuit keep an n-bit value from one clock cycle to the next, which is what makes counting, running totals and programs possible.

How it behaves:

  • At each rising edge, every flip-flop samples its own D at the same instant, so the whole word is captured together.
  • Between edges the register holds its value, whatever the inputs do.
  • An n-bit register can hold 2ⁿ different values (0 to 2ⁿ − 1 if unsigned).

The course writes a 4-bit register's contents as Q3 Q2 Q1 Q0, with Q3 (the MSB) on the left.

The most basic register loads at every edge. Practical registers add control:

A CPU is full of registers: the program counter, the instruction register, and the general-purpose registers in its register file.

0
8
1
4
1
2
0
1

Worked examples

Example

Loading a basic register

A basic 4-bit register (each Dᵢ wired straight to an input line) holds 0110, the value shown above. At the next rising edge the input lines carry 1001.

  1. 1.

    At the edge, each flip-flop copies its own D: Q3 ← 1, Q2 ← 0, Q1 ← 0, Q0 ← 1.

  2. 2.

    The register now holds 1001. The old 0110 is gone.

  3. 3.

    If the input lines change to 1111 after the edge, nothing happens until the next edge.

Example

Sizing a register

How many flip-flops does a 20-bit register need, and how many values can a 10-bit register hold?

  1. 1.

    One flip-flop per bit: a 20-bit register needs 20 flip-flops.

  2. 2.

    A 10-bit register has 2¹⁰ = 1024 different patterns.

  3. 3.

    Unsigned, those are the values 0 to 1023.

Common mistakes

  • Giving each flip-flop its own clock. A register's flip-flops share one clock so they all sample at the same instant.

  • Thinking n flip-flops store 2n values. They store 2ⁿ.

  • Expecting a register's output to change when its inputs change. It only changes at an active edge (or on an asynchronous clear).

Practice Register

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

Learn it step by step

Register is taught in Registers and Basic CPU / Computer Architecture.