Lecture 5 Multiplication and Division ECE 0142 Computer Organization Lecture 5 Multiplication and Division
Recitation Multiplying two numbers in 2’s complement, using the best hardware we learned (pp. 25) 11010 0101 0101 11010
Recitation (Implementation 3) Let’s do 11010 x 0101 (-6 x 5 = -30) Iteration Implementation 3 Step Multiplier Multiplicand Product|Multiplier initial values 0101 11010 00000 0101 1 1: 1 -> product = product + multiplicand 11010 0101 2: Multiplier shift right/ Product shift right ×010 11101 0010 2 1: 0 -> no op ××01 11110 1001 3 11000 1001 ×××0 11100 0100 4 ×××× 11110 0010
Recitation (Implementation 3) Let’s do 0101 x 11010 (5 x -6 = -30) Iteration Implementation 3 Step Multiplier Multiplicand Product|Multiplier initial values 11010 0101 0000 11010 1 1: 0 -> no op 2: Multiplier shift right/ Product shift right ×1101 0000 01101 2 1: 1 -> product = product + multiplicand 0101 01101 ××110 0010 10110 3 ×××11 0001 01011 4 0110 01011 ××××1 0011 00101 5 1: 1 -> product = product - multiplicand ××××1 0101 1110 00101 2: Multiplier shift right/ Product shift right ××××× 1111 00010
Use Booth Alg. Solve 0110 1111000
Booth’s Algorithm Example Let’s do 0110 x 1111000 (6 x -3) Iteration Implementation 3 Step Multiplicand Product initial values 0110 0000 1111000 0 1 00 -> no op shift right 0000 0111100 0 2 0000 0011110 0 3 0000 0001111 0 4 10 -> product = product – multiplicand 1010 0001111 0 1101 0000111 1 5 11 -> no op 0110 1101 0000111 1 shift right 1110 1000011 1 6 11 -> no op 0110 1110 1000011 1 shift right 1111 0100001 1 7 00 -> no op 0110 1111 0100001 1 shift right 1111 1010000 1