Logic Design (CE 207, CE 213) Chapter No. 1 - Part No. 2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Logic Design (CE 207, CE 213)

Chapter No. 1 – Part No. 2


Problem 1.14: Obtain the 1’s and 2’s Complement of the following Binary
Numbers.
a) 10000000
Sol:
1’s complement of 10000000 = 11111111 – 10000000 = 01111111
Or 1’s complement of 10000000 = 01111111
2’s complement of 10000000 = 01111111 + 1 = 10000000

b) 00000000
Sol:
1’s complement of 00000000 = 11111111
2’s complement of 00000000 =11111111 + 1 = 00000000

c) 11011010
Sol:
1’s complement of 11011010 = 00100101
2’s complement of 11011010 = 00100101 +1 = 00100110

d) 01110110
Sol:
1’s complement of 01110110 = 10001001
2’s complement of 01110110 = 10001001 + 1 = 10001010

e) 10000101
Sol:
1’s complement of 10000101 = 01111010
2’s complement of 10000101 = 01111010 + 1 = 01111011

f) 11111111
Sol:
1’s complement of 11111111 = 00000000
2’s complement of 11111111 = 00000000 + 1 = 00000001

Page 1 of 5
Problem 1.15: Find the 9's and the 10's complement of the following decimal
numbers.
a. 52,784,630
Sol:
9's complement of 52,784,630 = 99,999,999 - 52,784,630 = 47,215,369
10's complement of 52,784,630 = 47,215,369 + 1 = 47,215,370

b. 63,325,600
Sol:
9's complement of 63,325,600 = 99,999,999 - 63,325,600 = 36,674,399
10's complement of 63,325,600 = 36,674,399 + 1 = 36,674,400

c. 25,000,000
Sol:
9's complement of 25,000,000 = 99,999,999 - 25,000,000 = 74,999,999
10's complement of 25,000,000 = 74,999,999 + 1 = 75,000,000

d. 00,000,000
Sol:
9's complement of 00,000,000 = 99,999,999 - 00,000,000 = 99,999,999
10's complement of 00,000,000 = 99,999,999 + 1 = 00,000,000

Problem 1.16:
a) Find the 16’s complement of B2FA
Sol:
15’s complement of B2FA = FFFF – B2FA = 4D05
16’s complement of B2FA = 4D05 + 1 = 4D06

b) Convert B2FA to Binary


Sol:
(B2FA)16 = B 2 F A
(B2FA)16 = 1011 0010 1111 1010
(B2FA)16 = (1011001011111010)2

c) Find the 2’s complement of the result in part (b)


Sol:
1’s complement of 1011001011111010 = 0100110100000101
2’s complement of 1011001011111010 = 1 + 0100110100000101
= 0100110100000110

Page 2 of 5
d) Convert the answer in part (c) to Hexadecimal and compare it with the
answer in (a)
Sol:
(0100110100000110)2 = 0100 1101 0000 0110
(0100110100000110)2 = 4 D 0 6
(0100110100000110)2 = (4D06)16

Problem 1.18: Perform subtraction on the given unsigned Binary numbers using the
2’s complement. Where the result should be negative, find it’s 2’s
complement and affix a minus sign.
a) 10011 – 10001
Sol:
1’s complement of 10001 = 01110
2’s complement of 10001 = 01111
Add 10011
Sum: = 100010
Discard the end carry: - 100000
Difference = 00010
So
10011 – 10001 = 00010

b) 100010 – 100011
Sol:
1’s complement of 100011 = 011100
2’s complement of 100011 = 011101
Add 100010
Sum: = 111111
As there is no end carry, therefore answer = - (2’s complement of 111111)
1’s complement of 111111 = 000000
2’s complement of 111111 = 000001
So
100010 – 100011 = -000001

c) 1001 – 101000
Sol:
1’s complement of 101000 = 010111
2’s complement of 101000 = 011101
Add 001001
Sum: = 100001
As there is no end carry, therefore answer = - (2’s complement of 100001)

Page 3 of 5
1’s complement of 100001 = 011110
2’s complement of 100001 = 011111
So
1001 – 101000 = -011111

d) 110000 – 010101
Sol:
1’s complement of 010101 = 101010
2’s complement of 010101 = 101011
Add 110000
Sum: = 1011011
Discard the end carry: - 1000000
Difference = 011011

Problem 1.20: Convert the Decimal 49 and 29 to Binary using singed 2’s
complement representation and enough digits to accommodate the
numbers and perform the following.

Sol:

+49 = 0_110001
Leading ‘0’ indicates positive value
1’s complement of 110001 = 001110
2’s complement of 110001 = 001111
-49 = 1_001111
Leading ‘1’ indicates negative value

+29 = 0_011101
Leading ‘0’ indicates positive value
1’s complement of 011101 = 100010
2’s complement of 011101 = 100011
-29 = 1_100011
Leading ‘1’ indicates negative value

Page 4 of 5
a) (+29) + (-49)
Sol:
(+29) + (-49) = (0_011101) + (1_001111) = 1_101100
Leading ‘1’ indicates negative value
1’s complement of 101100 = 010011
2’s complement of 101100 = 010100
Answer = 1_010100

(1_010100)2 = - (0 x 25 + 1 x 24 + 0 x 23 + 1 x 22 + 0 x 21 + 0 x 20)
(1_010100)2 = - (0 + 16 + 0 + 4 + 0 + 0)
(1_010100)2 = - (20)10
(+29) + (-49) = (-20)

b) (-29) + (+49)
Sol:
(-29) + (+49) = (1_100011) + (0_110001) = 0_010100
Leading ‘0’ indicates positive value
(0_010100)2 = (0 x 2 + 1 x 2 + 0 x 23 + 1 x 22 + 0 x 21 + 0 x 20)
5 4

(0_010100)2 = (0 + 16 + 0 + 4 + 0 + 0)
(0_010100)2 = (+20)10
(+29) + (-49) = (+20)

c) (-29) + (-49)
Sol:
(-29) + (-49) = (1_100011) + (1_001111) = 1_0110010
Leading ‘1’ indicates negative value
1’s complement of 0110010 = 1001101
2’s complement of 0110010 = 1001110
Answer = 1_1001110
(1_1001110)2 = -(1 x 26 + 0 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 1 x 21 + 0 x 20)
(1_1001110)2 = -(64 + 0 + 0 + 8 + 4 + 2 + 0)
(1_1001110)2 = (-78)10
(-29) + (-49) = (-78)

Page 5 of 5

You might also like