Multiplication
Tom Kelliher, CS 240
Mar. 1, 2002
Homework due Monday.
Exam I in one week, covering all material through Section 4.5 (excepting
carry lookahead addition). Review on Wednesday. E-mail me one question by
Wednesday, 8:00 AM.
Read 5.1--2.
Carry lookahead addition.
- Paper and pencil multiplication.
- Shift and add multipliers.
- Booth recoding.
MIPS datapath.
- Consider paper and pencil binary unsigned multiplication:
- Shift multiplicand left one bit position after each add/hold cycle.
- Add/hold depending upon current multiplier bit (examine lsb; shift
right).
- Example:
.
- Multiplying two n-bit numbers results in a 2n-bit result.
- Naive 32-bit shift-and-multiply hardware:

How many bits in the datapath?
Running time?
- Observation: Shifting multiplicand left and keeping partial product
stationary is equivalent to keeping multiplicand stationary and shifting
partial product right.
- Bonus 1: only 32-bits are added at any one time.
- Bonus 2: the multiplier can be stored in the unused part of the
partial product register.
More sophisticated 32-bit shift-and-multiply hardware:

- Optimal running time: O
, achieved with tree of carry-save
adders with CLA adder at root.
- We can speed up multiplication by a factor of two by taking two
multiplier bits at a time.
Problem: must be able to form
!
- Solution:
- Adopt a signed digit set:
.
- The multiply unit's ALU lets us add or subtract.
- Observe that a run of 1's:

can be re-written as

Why? All runs of 1's are recoded this way.
- Advantage of recoding: now multiplicand need only be multiplied by
1, -1, 2, and -2 --- all easy to do with shift and add/subtract.
- Example multiply:
or
. (-29 = 100011). Recoded multiplier?
Perform in three cycles. Use 8-bit arithmetic and sign-extend.
Thomas P. Kelliher
Thu Feb 28 22:17:52 EST 2002
Tom Kelliher