Arithmatic Algorithms Computer Organization and Architecture by Ravinder Nath Rajotiya - June 1, 2021December 23, 20220 Share on Facebook Share Send email Mail Print Print Table of Contents Toggle Binary MultiplicationSimple binary multiplication2’sComplement Multiplication Booth’s AlgorithmBinary Division Algorithm Binary Multiplication Binary multiplication is is explained using two approaches Using the simple binary multiplication Using the Binary 2’s complement Booth’s Multiplication Algorithm first we explain using the first approach Simple binary multiplication Fig: Binary multiplication Algo Example-1: Multiply 22 and 21 using binary multiplication algorithm explain figure above Multiplicand Register B = 22 = 10110 Multiplier Register Q = 21= 10101 Step Qn Operation Carry (E) Acc (A) Multiplier (Q) Count initialize x x 0 00000 10101 5 1, 1, A=A+B 00000 10110 ——— 10110 Shr EAQ 0 01011 01010 4 2 0 Shr EAQ 0 00101 10101 3 3 1 Add 0 00101 10110 ——– 11011 Shr EAQ 0 01101 11010 2 4 0 Shr EAQ 0 00110 11101 1 5 1 Add 0 00110 10110 ——– 11100 Shr EAQ 0 01110 01110 0 ANSWER 22 x 21 = 462 = 00111001110 Example-2 : Multiply 30 and 26 using Binary Multiplication Algorithm Multiplicand Register B = 30 = 11110 Multiplier Register Q = 26= 11010 Step Qn Operation Carry (E) Acc (A) Multiplier (Q) Count initialize x x 0 00000 11010 5 1, 0 Shr EAQ 0 00000 01101 4 2 1 Add A, B 0 00000 11110 ——– 11110 Shr EAQ 0 01111 00110 3 3 0 Shr EAQ 0 00111 10011 2 4 1 Add 1 00111 11110 ——– 00101 10011 Shr EAQ 0 10010 11001 1 5 1 Add 1 10010 11110 ——— 10000 0 Shr EAQ 0 11000 01100 0 ANSWER 30×26 = 780 = 01100001100 2’sComplement Multiplication Booth’s Algorithm Example multiply -12 x -20 using Booth’s Algorithm Let multiplicand = -20 ; Reg B(- 20) =101100 2’s Complement B’+1 = (+20) = 010100 Multipler Reg Q = -12 = 10100 -20 x -12 = 240 Fig: Booth’s Algo for 2’s compliment multiplication Booth’s Algorith Step Qn Qn+1 Operation Acc Q = -12 Qn+1 Count initialize 0 Initialize Acc, Q, B, Qn+1 000000 10100 0(initial value) 5 1 0 0 Arithmetic shift right (AQQn+1) 000000 01010 0 4 2 0 0 Arithmetic shift right (AQQn+1) 000000 00101 0 3 3 1 0 A-B=A+B’+1 000000 010100 ———- 010100 Arithmetic shift right (AQQn+1) 001010 00010 1 2 4 0 1 A+B 001010 101100 ———- 110110 Arithmetic shift right (AQQn+1) 111011 00001 0 1 5 1 0 A-B 111011 010100 ———- 001111 Arithmetic shift right (AQQn+1) 000111 10000 1 0 stop ANSWER -20 x -12 = +240 = 00011110000 Binary Division Algorithm Figure- Binary Division algorithm Example: Share on Facebook Share Send email Mail Print Print