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?
Eight. Each stage of 3:2 counters reduces the height of the partial-product matrix by about a factor of 1.5, following the Dadda heights 2, 3, 4, 6, 9, 13, 19, 28: 32 rows need eight steps to come down to 2. A linear array would need 30. With radix-4 Booth recoding, 16 rows need only 6 stages.
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 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 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
- Partial products. one AND gate each, and the product is 64 bits wide.
- Booth recoding. Booth radix-4 cuts the 32 rows to 16 (17 for unsigned operands).
- Dadda stages. From 32 rows it takes 8 stages (); from 16 rows, 6 stages ().
- 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
- Double the bits each iteration. so three iterations exceed 53, at six multiplications.
- 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 = 1.3. Follow the error for two iterations.
Show the solution
- Starting error.
- First iteration. and the error squares:
- Second iteration.
- Correct bits. That's about 5, 11 and 21 correct bits, doubling each time toward 1.33333.
Answer the error goes 0.025, , : 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 = e.
Step 1
What is the seed ?
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°.
Step 2
What is ?
Step 3
What is the error after two iterations?
Explain why
Why does a carry-save adder tree add many rows faster than adding them one at a time with ordinary adders?
An ordinary adder must propagate carries across its full width before its result is valid, so adding N rows one after another costs N carry propagations in series. A carry-save adder never propagates: each full adder takes three bits of the same weight and passes its carry to the next column as a separate output, to be added in the next layer. A layer of them turns three rows into two in the time of one full adder, regardless of width. Arranged as a tree, the layers cut the number of rows by a factor of about 1.5 each, so N rows come down to two in a number of steps that grows only logarithmically. Only then does one carry-propagate adder resolve the carries, once.
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.