3 - Arithmetic For Computers
3 - Arithmetic For Computers
Length of product is
the sum of operand
lengths
Initially 0
Can be pipelined
Several multiplication performed in parallel
Chapter 3 — Arithmetic for Computers — 19
MIPS Multiplication
Two 32-bit registers for product
HI: most-significant 32 bits
LO: least-significant 32-bits
Instructions
mult rs, rt / multu rs, rt
64-bit product in HI/LO
mfhi rd / mflo rd
Move from HI/LO to rd
Can test HI value to see if product overflows 32 bits
mul rd, rs, rt
Least-significant 32 bits of product –> rd
Initially dividend
Step 1
Step 2
Step 3
Step 4