Digital Logic Design Lec03
Digital Logic Design Lec03
Digital Logic Design Lec03
• Subtract: 3250-72532
M=03250 03250
N=72532
10’s complement of N 27468
No carry 30718
Answer: -69282=(10’s complement of 30718)
Example
• Use 2’s complement to perform M-N with the given binary numbers.
M=1010100
N=1000100
1010100
2’s complement of N + 0111100
End carry 1 0010000
M= 1000100
N=1010100
1000100
2’s complement of N + 0101100
No carry 1110000
Answer: -0010000 = -(2’s complement of 1110000)
Subtraction with (r-1)’s
complement
• The procedure for subtraction with the (r-1)’s
complement is exactly the same as with the previous
one with one variation, called, “end-around carry” as
shown in example.
Subtraction with (r-1)’s complement
• The subtraction of M-N, both positive numbers in base r,
may be calculated in the following manner.
M= 03250
N= 72532
03250
9’s complement of N + 27467
No carry 30717
Answer: -69282= -(9’s complement of 30717)
Example
M= 1010100
N= 1000100
1010100
1’s complement of N + 0111011
End-around carry 1 0001111
1+
0010000
Answer: 10000
M=1000100
N=1010100
1000100
1’s complement of N + 0101011
No carry 1101111
Answer: -10000 = -(1’s complement of 1101111)
Comparison between 1’s and 2’s
Complements
•A comparison between 1’s and 2’s complements reveals the advantages
digital components since the only thing that must be done is to change
0’s to 1’s and 1’s to 0’s.
1)by adding 1 to the least significant digit of the 1’s complement, and
2)by leaving all leading 0’s in the least significant positions and the first 1
unchanged, and only then changing all 1’s into 0’s and all 0’s into 1’s.
Comparison between 1’s and 2’s
Complements
• During subtraction of two numbers by complement, the
2’s complement is advantageous in that only arithmetic
addition operation is required.