Complements In digital computer to simplify the subtraction
Complements In digital computer to simplify the subtraction operation and for logic manipulation Complements are used. There are two types of Complements: 1. The Radix Complement (r’ Complement) 2. Diminished radix complement ( (r-1)’ Complement)
Decimal Number System 9’s and 10’s Complements 9’ Complement: The 9’s complement of the decimal number is obtained by subtracting each digit of that decimal number from 9.
9’s Complement subtraction of ØFind the 9’s complement of the subtracted number & add it to the main no. ØIf carry is present in the intermediate results, it indicates that the answer is +ve, Add the carry to LSB. ØIf carry doesn't present, then the answer is –ve. place –ve sign before the answer and find its 9’complement.
10’ Complement: The 10’s complement of the decimal number is obtained by adding a 1 to its 9’s complement.
10’s Complement of subtraction ØFind the 10’s complement of the subtracted number & add it to the main no. ØIf carry is present in the intermediate results, it indicates that the answer is +ve, and neglect the carry. ØIf carry doesn't present, then the answer is –ve. place –ve sign before the answer and find its 10’complement.
Binary complements. Ø 1’s Complement Ø 2’s Complement
1’s Complement The 1’ complement of a binary number is the number that results when we change all 1’s to zeros and zeros to 1’s. 2’s Complement The 2’ complement of a binary number is the number that results when we add 1 to LSB of its 1’s complement no.
Binary Arithmetic ØBinary addition ØThe four possible elementary operations are 0+0=0 0+1=1 1+0=1 1+1=0 with carry 1.
Binary Arithmetic ØBinary Substraction ØThe four possible elementary operations are 0 -0=0 0 -1=1 with borrow 1. 1 -0=1 1 -1=0
Binary Arithmetic ØBinary Multiplication ØThe four possible elementary operations are 0*0=0 0*1=0 1*0=0 1*1=1
Binary Arithmetic ØBinary Division ØThe two possible elementary operations are 0/1=0 1/1=1 Note: In Binary numbers divide by ‘ 0’ has no meaning.
Binary Subtraction using 1’s Complement Method In this method Operation A-B is performed using following Steps. ØTake 1’s complement of B. ØResult=A+1’s complement of B. ØIf carry is generated then the result is +ve and add carry to the result to get the final answer. ØIf carry is not generated then the result is -ve and for final result find the 1’s complement of the intermediate results.
Binary Subtraction using 2’s Complement Method In this method Operation A-B is performed using following Steps. ØTake 2’s complement of B. ØResult=A+2’s complement of B. ØIf carry is generated then the result is +ve and add Ignor the carry. ØIf carry is not generated then the result is -ve and for final result find the 2’s complement of the intermediate results.
Representation of sign numbers using 1’s and 2’s complement method. ØIf the number is +ve the magnitude is represent in its true binary form and a sign bit ‘ 0’ placed in front of MSB. ØIf the number is -ve the magnitude is represent in its 1’s or 2’s complement form and a sign bit ‘ 1’ placed in front of MSB.
2. perform the following i) Subtract by using 10’s compliment for the given 3456 -245 ii) Subtract by using 2’s compliment for the given 111001 -1010
- Slides: 15