C740 of 57
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

C7 · Lesson 40 · Register-transfer design

A datapath that computes and a controller that steers it

A multiplier, a GCD engine or a checksum unit isn't one big formula; it's a sequence of small steps, each moving values between registers through an adder or a comparator. Digital designers describe such machines at the register-transfer level: what each register receives on each clock. The design splits into a datapath (the registers and the arithmetic) and a controller (a state machine that decides which transfer happens next). Every processor is built this way.

Play

  • The curves compare a combinational array multiplier, which finishes an n-bit product in one long clock, with a sequential shift-and-add multiplier, which reuses one adder for n short clocks, in units of a full adder's delay.
  • At small n the sequential design is slower; it always uses far less hardware.
  • Watch the area readouts: n full adders against n², the price of doing it all at once.

Predict

A sequential multiplier adds one shifted copy of the multiplicand per clock. How many clocks does it take to multiply two 8-bit numbers?

Name it

Register transfers

RTL notation writes what happens on a clock edge: A←A−B means register A loads the difference. Several transfers in the same state happen together, on the same edge.

Datapath and controller

  • The datapath holds the registers, the arithmetic units and the multiplexers that route values between them. It reports status signals, such as A>B or a counter reaching zero.
  • The controller is a state machine. In each state it asserts control signals: which registers load, what the ALU does, which multiplexer inputs pass. Its transitions depend on the status signals.

An ASM chart (algorithmic state machine) draws the controller: a box per state listing its transfers, diamonds for decisions on status signals.

Trading time for hardware

  • Single-cycle: all the work of one operation in one long clock.
  • Multi-cycle: one shared unit used over several short clocks: less hardware, the same or more time per result.
  • Pipelined: separate hardware for each step, with registers between, so a new operation starts every short clock: the most hardware and the most throughput.

Worked example

A GCD machine repeats "if A > B, then A ← A − B, else B ← B − A" until A = B. Trace it from A = 48, B = 18.

Show the solution
  1. Trace it. (48, 18) → (30, 18) → (12, 18) → (12, 6) → (6, 6): four subtractions, and the controller's equality test then stops it with A = B = 6.
  2. The datapath. It needs two registers, a subtractor (shared through multiplexers), and comparators for A > B and A = B.
  3. The controller. It has an idle state, a run state and a done state.
  4. Its weakness. Subtraction is slow for very different inputs: GCD(100, 1) takes 99 steps.

Answer four subtractions, stopping at A = B = 6.

Worked example

Multiply 13 by 11 with a 4-bit shift-and-add multiplier.

Show the solution
  1. Write the multiplier in binary. 11 = 1011.
  2. Bit 0 is 1. The accumulator gets 13.
  3. Bit 1 is 1. Add 13 shifted once, 26: 13+26=39
  4. Bit 2 is 0. Add nothing.
  5. Bit 3 is 1. Add 13 shifted three times, 104: 39+104=143
  6. Count the cost. Four clocks, one adder, and the product 143 = 13 × 11; the controller is little more than a counter that stops after four bits.

Answer 143, in four clocks.

Worked example

An operation has three steps of 4 ns each, plus 0.5 ns of register overhead per clock. Compare single-cycle, multi-cycle (one shared unit) and pipelined designs.

Show the solution
  1. Single-cycle. One 12.5 ns clock per result.
  2. Multi-cycle. Three 4.5 ns clocks per result: 3×4.5=13.5ns with a third of the arithmetic hardware.
  3. Pipelined. A 4.5 ns clock and a new result every clock: 12.54.5=2.8 times the throughput of single-cycle, though each result takes 13.5 ns to emerge.
  4. Choosing. The choice depends on whether hardware, latency or throughput matters most.

Answer single-cycle gives a result every 12.5 ns, multi-cycle every 13.5 ns with a third of the hardware, and pipelined every 4.5 ns, 2.8 times the throughput, with 13.5 ns of latency.

Check

An n-bit shift-and-add multiplier with n = 16 adds in 1 ns, plus 1 ns of register overhead per clock.

(a)

How many clocks per product?

(b)

How long does a product take?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

Check

An operation has 3 steps of 2 ns each, with 0.5 ns of register overhead per clock.

(a)

What's the time per result in a single-cycle design?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

(b)

And in a pipelined one, once it's full?

Check

The GCD machine starts with A = 50 and B = 12. How many times does it subtract B from A before A first drops below B?

Check

The GCD controller has states IDLE = 00, RUN = 01, DONE = 10. It loads A (with A − B) only in RUN when G = (A > B) is 1. Write load_A.

Write AND as · or & (or just AB), OR as +, XOR as ⊕, and NOT as ¬ or a trailing ': A·B + C' works.

Check

An operation of k steps, each taking t, runs N times; every clock costs r of register overhead.

Step 1

How long does a single-cycle design take?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Check

Write gcd_rtl(a, b) returning (g, steps): the GCD found by the subtraction machine, and the number of subtractions it performed.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why do designers split a digital system into a datapath and a controller?

Practice

Keep practicing

4 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.