Ch 3. Arithmetic for computers - (2)
2. Multiplication
- Multiplying = ‘add’ + ‘shift’ operation
- with binary numbers
- Positive integer에 대해서만 고려
- Ex)
- 0010 (multiplicand)
- 1001 (multiplier)
- 0010010 (product)
Multiplication: Implementation
- Version 1
- Multiplicand: Shift Left
- Product: doesn’t move
- Multiplicand: 64bits
- Multiplier: 32bits
- Product: 64bits
- 64-bit ALU
- Version 2
- Multiplicand: doesn’t move
- Product: Shift Right
- Multiplicand: 32bits
- Multiplier: 32bits
- Product: 64bits
- 32-bit ALU
- Version 1 → Version2: Save Spaces & Hardware reducing
- Final Version
- Multiplier -> Product register
Multiplication of negative numbers
- Negate negative number(s)
- -3 => 3
- unsigned multiplication 수행
- 3 * 4 = 12
- negate the result
- 12 => -12
- Another way: Booth algorithm