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

S3 · Lesson 9 · Multipliers and dividers

Partial products, Booth recoding, reduction trees and iterative division

An N-bit multiplier forms N rows of partial products, each a copy of one operand ANDed with one bit of the other, and adds them. Adding N rows one after another is slow; the art of multiplier design is cutting the number of rows (Booth recoding) and adding them in a tree of carry-save adders that never propagate a carry until the very end (Wallace and Dadda trees). Division is harder still: it's inherently sequential in its simple forms, so fast dividers either do several bits per cycle or switch to Newton–Raphson iteration, which doubles the number of correct bits every step.

  • The depth of the partial-product reduction against the operand width N, in carry-save adder stages. A linear array adds one row per stage (N − 2 stages); a Dadda tree of 3:2 counters reduces the heights through 2, 3, 4, 6, 9, 13, 19, 28, 42, 63, … so its depth grows logarithmically.
  • Radix-4 Booth recoding halves the rows before the tree, saving a stage or two.
  • After reduction, two rows remain, and one fast carry-propagate adder (lesson 8) finishes the product.

Predict

A 32 × 32-bit multiplier's partial products are reduced by a Dadda tree. About how many carry-save stages does that take?

Name it

Partial products

Multiplying an M-bit number by an N-bit number gives N rows of M partial-product bits (M × N AND gates), shifted and summed into an M + N bit product.

Carry-save reduction

A full adder used as a 3:2 counter takes three bits of the same weight and outputs a sum bit (same weight) and a carry bit (next weight), without propagating anything. A layer of them turns three rows into two in one full-adder delay. Wallace and Dadda trees apply layers until two rows remain; Dadda's schedule reduces the column heights to the sequence 2, 3, 4, 6, 9, 13, 19, 28, 42, 63, …, each ⌊1.5×⌋ the last, using the fewest counters. The depth is the number of entries in that sequence below N.

Booth recoding

Radix-4 Booth recoding scans the multiplier two bits at a time (with one bit of overlap) and turns each pair into one of 0, ±1, ±2 times the multiplicand, all easy to form by shifting and negating. It halves the number of rows, to about N/2. It also handles two's complement operands naturally.

Sequential and FPGA multipliers

A shift-and-add multiplier uses one adder for N cycles. FPGAs provide hard multiplier blocks (for example 18 × 27 bits) that are far faster and smaller than LUT-built ones; larger multiplies are tiled from several.

Division

  • Restoring and non-restoring division produce one quotient bit per cycle by trial subtraction: N cycles for N bits.
  • SRT division uses a redundant digit set so each step's guess needn't be exact, allowing faster steps or radix 4.
  • Newton–Raphson iterates xk+1=xk(2−dxk) toward 1/d. The error squares each step, so the number of correct bits doubles: from an 8-bit seed in a lookup table, 3 iterations give 64 bits. Each step costs two multiplications, so it pays off when a fast multiplier already exists.

Worked example

Size a 32 × 32 multiplier: partial-product bits, product width, rows after Booth recoding, and Dadda stages with and without Booth.

Show the solution
  1. Partial products. 32×32=1024bits one AND gate each, and the product is 64 bits wide.
  2. Booth recoding. Booth radix-4 cuts the 32 rows to 16 (17 for unsigned operands).
  3. Dadda stages. From 32 rows it takes 8 stages (28<32≤42); from 16 rows, 6 stages (13<16≤19).
  4. Final add. A 64-bit prefix adder finishes the product.

Answer 1024 partial-product bits and a 64-bit product; Booth makes 16 rows (17 unsigned); Dadda takes 8 stages without Booth and 6 with it.

Worked example

A divider starts Newton–Raphson from an 8-bit-accurate table lookup. How many iterations reach 53 bits (a double's mantissa)?

Show the solution
  1. Double the bits each iteration. 8→16→32→64 so three iterations exceed 53, at six multiplications.
  2. Against restoring division. A one-bit-per-cycle restoring divider would take 53 cycles. That's why high-performance floating-point units use multiplicative division, while small microcontrollers use the restoring kind.

Answer three iterations (six multiplications).

Worked example

A Newton–Raphson divider computes 1/0.75 from the seed x0 = 1.3. Follow the error εk=1−dxk for two iterations.

Show the solution
  1. Starting error. ε0=1−0.75×1.3=0.025
  2. First iteration. x1=x0(2−dx0)=1.3×1.025=1.3325 and the error squares: ε1=ε02=6.25×10−4
  3. Second iteration. ε2=ε12=3.9×10−7
  4. Correct bits. That's about 5, 11 and 21 correct bits, doubling each time toward 1.33333.

Answer the error goes 0.025, 6.25×10−4, 3.9×10−7: about 5, 11 and 21 correct bits.

Check

A 16-bit number is multiplied by an 8-bit number. How wide is the product?

Check

How many partial-product bits (AND gates) does a 16 × 8-bit multiplier form?

Check

How many Dadda reduction stages does it take to bring 19 rows of partial products down to 2?

Check

Radix-4 Booth recoding of a 24-bit signed multiplier gives how many partial-product rows?

Check

Newton–Raphson division starts from a 4-bit-accurate seed. How many iterations reach 24 correct bits?

Check

A restoring divider produces one quotient bit per cycle at 100 MHz. How long does a 32-bit division take?

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

Check

An unsigned 16 × 8 multiplier reduces its partial products with a Dadda tree (heights 2, 3, 4, 6, 9, 13, 19, 28, …).

(a)

How many partial-product bits (AND gates) does it form?

(b)

How wide is the product?

(c)

How many reduction stages does the Dadda tree need for its 8 rows?

Check

A Newton–Raphson reciprocal of d starts from a seed whose error is ε0=1−dx0 = e.

Step 1

What is the seed x0?

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°.

Explain why

Why does a carry-save adder tree add many rows faster than adding them one at a time with ordinary adders?

Practice

Keep practicing

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