07.1 - CA (Computer+Arithmetic Mul Div)
07.1 - CA (Computer+Arithmetic Mul Div)
Chapter 3
Arithmetic for Computers
Arithmetic for Computers
Operations on integers
Addition and subtraction
Multiplication and division
Dealing with overflow
Floating-point real numbers
Representation and operations
Length of product is
the sum of operand
lengths
Initially 0
Multiplier is initially
placed here
Can be pipelined
Several multiplication performed in parallel
Chapter 3 — Arithmetic for Computers — 12
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
Step 1
Step 2
Step 3
Step 4