Skip to content
BetterDL

Shift register

Also called: shifter register, shift-register, shifting register, serial shift register

A register whose flip-flops are chained so each one loads its neighbor's value, moving every bit one place along at each clock edge.

A shift register is a register whose flip-flops pass bits along a chain. Each flip-flop's D input is driven by its neighbor's Q, so at every rising edge each bit moves one place.

  • The first flip-flop's D is the serial input (SI): a new bit enters there each edge.
  • The last flip-flop's Q is the serial output: its bit leaves at the next edge.

The course's direction convention, with contents written Q3 Q2 Q1 Q0:

  • Shift right: bits move toward Q0. SI enters Q3; the old Q0 drops out. Wiring: D3 = SI, D2 = Q3, D1 = Q2, D0 = Q1.
  • Shift left: bits move toward Q3. SI enters Q0; the old Q3 drops out.

Why it works: at an edge, every flip-flop samples its neighbor's value from just before the edge, then all update together. That is why edge triggered flip-flops are essential: with transparent latches a bit could race through several stages in one pulse.

What shift registers are used for:

CLKSIQ3Q2Q1

Worked examples

Example

Reading the diagram above

A shift-right chain SI → Q3 → Q2 → Q1, all starting at 0. Rising edges are in slots 2, 4, 6, 8 and 10.

  1. 1.

    Q3 is a D flip-flop on SI. At the edges SI is 0, 1, 1, 0, 0, so Q3 changes to 1 at slot 4 and back to 0 at slot 8.

  2. 2.

    Q2 copies Q3's value from just before each edge. At slot 6 Q3 was 1, so Q2 becomes 1. At slot 10 Q3 was 0, so Q2 becomes 0.

  3. 3.

    Q1 copies Q2 the same way, one edge later: it becomes 1 at slot 8.

  4. 4.

    Each stage is the previous stage delayed by one clock period.

Example

Tracing contents

A 4-bit shift-right register starts at 1001. The serial input is 1, 1, 0, 1 on edges 1–4.

  1. 1.

    Edge 1: SI = 1 enters Q3, the rest move right, Q0's 1 drops out: 1100.

  2. 2.

    Edge 2: SI = 1: 1110.

  3. 3.

    Edge 3: SI = 0: 0111.

  4. 4.

    Edge 4: SI = 1: 1011.

  5. 5.

    Quick method each edge: cross off the rightmost bit and write SI on the left.

Common mistakes

  • Updating the bits one at a time. Shifting 1011 right with SI = 0 that way smears the 0 across everything; the real answer is 0101, because every flip-flop reads its neighbor's old value.

  • Putting SI at the wrong end. For shift right it enters Q3; for shift left it enters Q0.

  • Forgetting that the bit at the far end is lost unless it is fed back.

Practice Shift register

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

Learn it step by step

Shift register is taught in Registers and Counters.