   Next: Division Up: Arithmetic and Logical Operations Previous: Addition and Subtraction

# Multiplication

## The 64 bit HI/LO algorithm may also be implemented in SAL: ``` ``` The algorithm works without modification for a negative multiplier and a positive multiplicand. It can be extended to work for 2's complement integers. To multiply two negative numbers or a positive multiplier and negative multiplicand, two approaches are possible: Convert negative numbers to positive, multiply positive numbers and then convert result to correct sign. Sign extend both numbers to 64 bits and perform 64 bit multiplication. The correct result will be found in the least significant 64 bits of the product. An example of method #2 applied to 4-bit 2's complement integers is shown below. The 4-bit integers 1101 (-3) and 0110 (6) are sign extended to 8 bits before multiplication. The correct result (-18) is found in the rightmost 8 bits. ``` 11111101 (-3) x 00000110 (6) ---------- 00000000 11111101 11111101 00000000 00000000 00000000 00000000 + 00000000 ----------------- 11101110 (-18)```   Next: Division Up: Arithmetic and Logical Operations Previous: Addition and Subtraction

CS 301 Class Account
Thu Nov 5 12:25:05 AST 1998