Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Shift registers

Shift registers store and move binary data serially or in parallel using flip-flops; engineers use them for data buffering, serial–parallel conversion, counters, and simple memory in digital systems.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Shift registers are used whenever digital data must be delayed, serialized, deserialized, or rotated. Engineers use them in serial communication interfaces, digital signal pipelines, built-in self-test, simple counters (ring/Johnson), and as small fast memories inside CPUs or controllers.

Key ideas

  • SISO (Serial-In Serial-Out): one serial data input, bits enter at one end and exit serially at the other end after shifting. Draw: a row of N D flip-flops labeled from left to right QN−1 ... Q0. Connect serial input to D of leftmost flip-flop; connect Q of each flip-flop to D of the next; output is Q of rightmost flip-flop.

  • SIPO (Serial-In Parallel-Out): serial input, parallel outputs available at each flip-flop (Q0..QN−1) after shifting. Draw: same as SISO but show outputs from every Q.

  • PISO (Parallel-In Serial-Out): parallel data loaded into all flip-flops simultaneously, then shifted out serially. Draw: D inputs of each flip-flop connected to separate input lines with a control signal labelled LOAD that enables loading.

  • PIPO (Parallel-In Parallel-Out): parallel input to parallel output; this is simply an N-bit register.

  • Bidirectional shift register: can shift left or right under control of a direction signal. Draw: multiplexers at each D input selecting from left neighbor or right neighbor.

  • Universal shift register: supports parallel load, serial in/out, left/right shift, hold; realized with multiplexers on each D input and control lines specifying mode.

  • Special shift-register counters:

    • Ring counter: a SISO where the serial output is fed back to the serial input. For N flip-flops, the valid states are the N cyclic single-1 or single-0 patterns (depending on initialization); sequence length ≤ N.
    • Johnson (twisted ring) counter: feedback uses inverted output: for the left-to-right labeling QN−1 ... Q0 and right-shift operation, feed inverted Q0 back to the D input of the leftmost stage (QN−1); produces a sequence of length 2N distinct states (good for building modulo counters).
  • Timing basics (assumptions: edge-triggered D flip-flops): important timing parameters are t_clock-to-Q (t_cq) — time from active clock edge to stable Q output; t_setup (t_su) — time before clock edge that D must be stable; t_hold (t_h) — time after clock edge that D must remain stable; t_pd (propagation delay) sometimes used synonymously with t_cq for the flip-flop output delay. These determine maximum safe clock frequency and correct operation when flip-flops are connected in series.

    Commonly-used timing relation for a synchronous chain of flip-flops with no combinational logic between them:

    • Minimum clock period T must satisfy T ≥ t_cq + t_su.
    • Maximum clock frequency f_max = 1 / (t_cq + t_su).
  • Data width, latency and throughput:

    • Width: number of parallel bits N stored in the register.
    • Latency: how many clock cycles before an input bit reaches a target stage (for SISO, latency in cycles from input to k-th flip-flop equals k).
    • Throughput: bits processed per second equals clock frequency for single serial stream.
  • Initialization and reset: shift registers must be initialized (synchronous or asynchronous clear/preset) to a known state. For ring counters, a single 1 or 0 must be set to create correct cycles.

  • Design considerations: propagation delay between flip-flops is small but the setup and hold times still limit clock speed. Adding combinational logic in the path (e.g., multiplexers for direction control) increases the required T because extra propagation delay must be accounted.

Formulas

T ≥ t_cq + t_su where T is the clock period (s); t_cq is clock-to-Q propagation delay (s); t_su is data setup time before clock (s). Applies for flip-flop chains with no extra combinational delay.

f_max = 1 / (t_cq + t_su) where f_max is maximum clock frequency (Hz). Same assumptions as above.

T ≥ t_cq + t_mux + t_su where t_mux is propagation delay of any multiplexer or combinational logic between flip-flops. Use when mode selection logic sits on the D inputs.

Hold-time check (no extra logic, zero skew): t_cq(min) ≥ t_h; with added logic: t_cq(min) + t_logic(min) ≥ t_h.

Latency (cycles from input to output at stage k) = k where k counts stages from the input end starting at 1. Unit: clock cycles.

Number of distinct states in an N-bit Johnson counter = 2N for N flip-flops, assuming ideal behavior.

Number of distinct states in an N-bit single-1 ring counter ≤ N (usually equals N if properly initialized).

Worked examples

  1. Maximum clock frequency of a 4-bit SIPO made of D flip-flops

Given: four identical edge-triggered D flip-flops connected serially (no extra logic). t_cq = 10 ns, t_su = 5 ns, ignore t_h for frequency calculation.

Step 1: Write formula: T ≥ t_cq + t_su.

Step 2: Substitute numbers: T ≥ 10 ns + 5 ns = 15 ns.

Step 3: f_max = 1 / T = 1 / 15e-9 s = 66.666... MHz.

Final answer: f_max = 66.67 MHz (rounded). Units: Hz. (Show working as above in exam.)

  1. Operation of a 4-bit PISO (parallel-load, serial-out)

Problem: You have a 4-bit PISO with flip-flops Q3 (left) to Q0 (right). A control signal LOAD=1 means parallel load from inputs D3..D0 into flip-flops on next clock. LOAD=0 means shift-right; serial-out appears at Q0; for shift-right the connections are D3 ≤ SI (external serial input), D2 ≤ Q3, D1 ≤ Q2, D0 ≤ Q1 (i.e., Q3 → Q2 → Q1 → Q0). Initial parallel data to load is 1101 (D3=1, D2=1, D1=0, D0=1). Show contents after each clock if we load first then shift three times.

Step 0 (t=0): before clock, SET LOAD=1 and present D=1101.

Clock 1 (LOAD=1): parallel load occurs. New state: Q3 Q2 Q1 Q0 = 1 1 0 1.

Now set LOAD=0 to shift-right.

Clock 2 (LOAD=0): shift-right. Q0 output (serial out) is previous Q0=1; new state after shift: Q3 = 0 (serial input assumed 0 unless specified), Q2 = old Q3=1, Q1 = old Q2=1, Q0 = old Q1=0. So state = 0 1 1 0.

Clock 3: shift-right again. State becomes 0 0 1 1.

Clock 4: shift-right again. State becomes 0 0 0 1.

Write these step-by-step states in the answer; label which clock produced them and show the serial output bits read at each shift.

  1. 4-bit Johnson counter sequence (theory question)

Design: N=4 flip-flops, shift right each clock with inverted Q0 fed back to D3. Assume initial state 0000.

Sequence (list of 2N=8 states): Clock 0: 0000 Clock 1: 1000 (inverted Q0=1 fed into MSB position) — update rule for right shift: D3 = NOT(Q0), Q2 ≤ Q3, Q1 ≤ Q2, Q0 ≤ Q1 Clock 2: 1100 Clock 3: 1110 Clock 4: 1111 Clock 5: 0111 Clock 6: 0011 Clock 7: 0001 Clock 8: 0000 (back to start)

Show this as a table with clock number and state for full marks.

Common mistakes

  • For ring counters, assuming 2N states instead of N for simple single-1 ring; this is true only for Johnson counters.
  • Not initializing the ring counter (leads to all-0 state which in a single-1 ring never changes unless you force a 1).
  • Mixing hold-time constraints with setup-time formulas; hold time must be verified separately but does not directly reduce f_max.
  • Omitting draw labels: exam wants which flip-flop is Q0, which is Qn−1, and where serial input/output are.

For your exam

Typical question types:

  • Definitions and short notes: define types (SISO, SIPO, PISO, PIPO), ring vs Johnson, and timing definitions (t_cq, t_su, t_h).
  • Derivations: derive the maximum clock frequency relation T ≥ t_cq + t_su for chained flip-flops; show effect of added combinational delay.
  • Numericals: compute f_max given t_cq and t_su; trace states of ring/Johnson counters; compute latency and show bit positions after given clocks.
  • Drawings/diagrams: draw N-stage shift register, label Qs, input, output, clock, and show feedback for ring/Johnson.
  • Design: show a small universal shift register with multiplexers and control signals; explain how to achieve hold, shift-left, shift-right, parallel-load.

What full-marks answers include:

  • Clear diagram with labeled flip-flops (Q indices), inputs, outputs, clocks and control signals.
  • Correctly stated timing formulas and explicit substitution of numbers with units when solving numericals.
  • Step-by-step state tables for sequential problems, showing clock number and state bits.
  • Mention of assumptions (edge-triggered D flip-flops, neglect or inclusion of mux delay) and initialization for ring counters.

Quick check

  1. Define SIPO in one sentence.
  2. For a chain of flip-flops with t_cq = 8 ns and t_su = 4 ns, what is f_max (approx)?
  3. How many distinct states does a 5-bit Johnson counter have?

Answers: SIPO = Serial-In Parallel-Out register where serial data enters and parallel outputs are available; f_max ≈ 1 / (8 ns + 4 ns) = 83.33 MHz; 10 states.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?