1
CS240 Computer Organization
Department of Computer Science Wellesley College
Computer arithmetic
Integers and floats
Arithmetic 10-2
Multiplication hardware
- The multiplication
algorithm we learned in grammar school leads to a simple if somewhat inefficient design:
- 1000
Multiplicand
x 1001 Multiplier
- 1000
0000 0000 1000 1001000 Product
- Multiplicand
64-bit ALU
Product Multiplier Control
Write Shift left Shift right 64 bits 64 bits 0000 1000 0000 0000 0001 0000 0000 1000 0100 0010 0010 0000 0000 1000 1001 0001 0100 0000 0000 1000 0100 1000
Arithmetic 10-3
Refined version of mult hardware
Multiplicand
32-bit ALU
Product Control test
Write Shift right 32 bits 64 bits 1000 0000 1001 0100 0100 0010 0010 0001 0001 0100 1000
Twos-complement multiplication
- Multiplication of
signed integers could be done by multiplying numbers and then figuring out the sign.
- However, the above
algorithm works for twos-complement provided we extend the sign bit appropriately.
Arithmetic 10-4