0% found this document useful (0 votes)
11 views25 pages

Number Systems: Module-1:Lecture-4

Uploaded by

srideepika2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views25 pages

Number Systems: Module-1:Lecture-4

Uploaded by

srideepika2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

DIGITAL LOGIC DESIGN

(Course Code: ECE 1003)

Module-1:Lecture-4
Number Systems
CONTENTS

Module-1 (Part-1)

❖ Number systems and conversions


❖ Binary arithmetic operations
❖ b’s and (b-1)’s compliment
❖ Binary signed and unsigned numbers
❖ Weighted and non-weighted binary codes

Number Systems 2
CONTENTS

Lecture-4

❖ (b-1)’s Complement
▪ 1’s Complement
▪ 9’s Complement
❖ b’s Complement
▪ 2’s Complement
▪ 10’s Complement

Number Systems 3
COMPLEMENT OF NUMBERS

✓ In general, complements are used to simplify the subtraction operation and for logical
manipulation.
✓ There are two types of complement method in any base-b number system.
▪ b’s Complement (Radix Complement)
▪ (b-1)’s Complement (Diminished Radix Complement)
✓ In base-2 number system
▪ 2’s complement
▪ 1’s complement
✓ In base-10 number system
▪ 10’s complement
▪ 9’s complement

Number Systems 4
DIMINISHED RADIX [(b-1)’s] COMPLEMENT

✓ If a number N having n digits with base b, then the (b-1)’s complement is given by

𝒃𝒏 − 𝟏 − 𝑵
✓ For binary number, it is 1’s complement and can be represented as

𝟐𝒏 − 𝟏 − 𝑵
✓ For Example: 1’s complement of (10101)2

(𝟐𝟓 −𝟏) − 𝟏𝟎𝟏𝟎𝟏 𝟐

⇒ 𝟑𝟐 − 𝟏 − 𝟏𝟎𝟏𝟎𝟏 𝟐

⇒ 𝟑𝟏 − 𝟏𝟎𝟏𝟎𝟏 𝟐 ⇒ 𝟏𝟏𝟏𝟏𝟏 𝟐 − 𝟏𝟎𝟏𝟎𝟏 𝟐 = 𝟎𝟏𝟎𝟏𝟎 𝟐

Number Systems 5
DIMINISHED RADIX [(b-1)’s] COMPLEMENT

Note:
✓ The 1’s complement of a binary number can be obtained by changing each 0’s to 1’s and
each 1’s to 0’s.
✓ For example: 1’s complement of (11101)2

1 1 1 0 1

0 0 0 1 0

1’s complement of (11101)2 = (00010)2

Number Systems 6
DIMINISHED RADIX [(b-1)’s] COMPLEMENT

✓ For decimal number, it is 9’s complement and can be represented as

𝟏𝟎𝒏 − 𝟏 − 𝑵
✓ For Example: 9’s complement of (54230)10

(𝟏𝟎𝟓 −𝟏) − 𝟓𝟒𝟐𝟑𝟎 𝟏𝟎

⇒ 𝟏𝟎𝟎𝟎𝟎𝟎 − 𝟏 − 𝟓𝟒𝟐𝟑𝟎
⇒ 𝟗𝟗𝟗𝟗𝟗 − 𝟓𝟒𝟐𝟑𝟎
⇒ 𝟒𝟓𝟕𝟔𝟗

Number Systems 7
DIMINISHED RADIX [(b-1)’s] COMPLEMENT

Note:
✓ The 9’s complement of a decimal number can be obtained by subtracting each digit from 9.
✓ For example: 9’s complement of (12345)10

9 9 9 9 9
−1 2 3 4 5
8 7 6 5 4

9’s complement of (12345)10 = (87654)10

Number Systems 8
RADIX (b’s) COMPLEMENT

✓ If a number N having n digits with base b, then the b’s complement is given by

𝒃𝒏 − 𝑵 = 𝒃𝒏 − 𝟏 − 𝑵 + 𝟏 = (b-1)’s Complement + 1

✓ For binary number, it is 2’s complement and can be represented as

𝟐𝒏 − 𝑵
✓ For Example: 2’s complement of (10111)2
1’s complement of (10111)2 = (01000)2
𝟐𝟓 − 𝟏𝟎𝟏𝟏𝟏 𝟐
2’s complement of (10111)2
⇒ 𝟑𝟐 − 𝟏𝟎𝟏𝟏𝟏 𝟐
= 1’s complement of (10111)2 + 1
⇒ 𝟏𝟎𝟎𝟎𝟎𝟎 𝟐 − 𝟏𝟎𝟏𝟏𝟏 𝟐 ⇒ 𝟎𝟏𝟎𝟎𝟏 𝟐 = (01000)2 + 1 = (01001)2

Number Systems 9
RADIX (b’s) COMPLEMENT

✓ For binary number, it is 2’s complement and can be represented as

Number Systems 10
RADIX (b’s) COMPLEMENT

Note:
✓ The 2’s complement of a binary number can be obtained by leaving the least significant 0’s
and the first 1 unchanged and then remaining bits, replace 1’s with 0’s and 0’s with 1’s.

✓ For example: 2’s complement of (1110100)2 2’s complement of (100000)2

1 1 1 0 1 0 0 1 0 0 0 0 0

unchanged unchanged

0 0 0 1 1 0 0 1 0 0 0 0 0

2’s complement of (1110100)2 = (0001100)2 2’s complement of (100000)2 = (100000)2

Number Systems 11
RADIX (b’s) COMPLEMENT

✓ For decimal number, it is 10’s complement and can be represented as

𝟏𝟎𝒏 − 𝑵
✓ For Example: 10’s complement of (54230)10

𝟏𝟎𝟓 − 𝟓𝟒𝟐𝟑𝟎 9’s complement of (54230)10 = (45769)10


𝟏𝟎

⇒ 𝟏𝟎𝟎𝟎𝟎𝟎 − 𝟓𝟒𝟐𝟑𝟎 10’s complement of (54230)10


= 9’s complement of (54230)10 + 1
⇒ 𝟒𝟓𝟕𝟕𝟎 = (45769)10 + 1 = (45770)10

Number Systems 12
RADIX (b’s) COMPLEMENT

Note:
✓ The 10’s complement of a decimal number can be obtained by leaving the least significant
0’s unchanged and the first least non-zero element should be subtracted from 10 and other
digits from 9.
✓ For example: 10’s complement of (2860010)10

2 8 6 0 0 1 0
unchanged

9 9 9 9 9 10 0
− 2 8 6 0 0 1 10’s complement of
(2860010)10 = (7139990)2
7 1 3 9 9 9 0

Number Systems 13
SUBTRACTION WITH COMPLEMENT

✓ In digital hardware, complement method for subtraction provides more efficient results
compared to borrow concept method.
✓ Here, the subtraction is pursued for unsigned numbers using the following method
▪ Subtraction of unsigned numbers with b’s Complement
▪ Subtraction of unsigned numbers (b-1)’s Complement

Number Systems 14
SUBTRACTION WITH b’s COMPLEMENT

Subtraction of unsigned numbers with b’s Complement


✓ The subtraction of two n‐digit unsigned numbers M - N in base b can be done as follows:

1. Add the minuend M to the b’s complement of the subtrahend N. Mathematically,


M + (bn - N) = M - N + bn

2. If M ≥ N, the sum will produce an end carry bn, which can be discarded; what is left is the
result M - N.
3. If M < N, the sum does not produce an end carry and is equal to bn - (N - M), which is the
b’s complement of (N - M). To obtain the answer in a familiar form, take the b’s
complement of the sum and place a negative sign in front.

Number Systems 15
SUBTRACTION WITH b’s COMPLEMENT

Example-1:
✓ Using 2’s complement, subtract (101111)2 − (100110)2.

Solution: Here, M = (101111)2 and N = (100110)2 11 1 1 1


2’s complement of N = (011010)2 1 0 1 1 1 1
+ 0 1 1 0 1 0
Step -1: Add M with 2’s complement of N ---------------------
1 0 0 1 0 0 1
Discard End Carry

Step -2: Here M>N, hence, the result is (101111)2 − (100110)2 = (001001)2

Number Systems 16
SUBTRACTION WITH b’s COMPLEMENT

Example-2:
✓ Using 2’s complement, subtract (100)2 − (110000)2.

Solution: Here, M = (100)2 and N = (110000)2

2’s complement of N = (010000)2 0 0 0 1 0 0


+ 0 1 0 0 0 0
Step -1: Add M with 2’s complement of N ----------------------
0 1 0 1 0 0

Step -2: Here M<N, hence, the result is obtained by taking the 2’s complement of sum with a
negative sign in front.
(100)2 − (110000)2 = −[2’s complement of (010100)2] = −(101100)2

Number Systems 17
SUBTRACTION WITH b’s COMPLEMENT

Example-3:
✓ Using 10’s complement, subtract 52532 − 3250.

Solution: Here, M = 52532 and N = 3250

10’s complement of N = (99999 − 03250) + 1 1 1


= 96749 + 1 = 96750 5 2 5 3 2
+ 9 6 7 5 0
Step -1: Add M with 10’s complement of N -------------------
1 4 9 2 8 2
Discard End Carry

Step -2: Here M>N, hence, the result is 52532 − 3250 = 49282

Number Systems 18
SUBTRACTION WITH b’s COMPLEMENT

Example-4:
✓ Using 10’s complement, subtract 1020 − 2056.

Solution: Here, M = 1020 and N = 2056

10’s complement of N = (9999 − 2056) + 1


1 0 2 0
= 7943 + 1 = 7944 + 7 9 4 4
Step -1: Add M with 10’s complement of N ---------------
8 9 6 4
Step -2: Here M<N, hence, the result is obtained by taking the 10’s complement of sum with a
negative sign in front.
1020 − 2056 = −[10’s complement of 8964] = −[(9999 − 8964) + 1] = − [1035 + 1] = − 1036

Number Systems 19
SUBTRACTION WITH (b-1)’s COMPLEMENT

Subtraction of unsigned numbers with (b-1)’s Complement


✓ The subtraction of two n‐digit unsigned numbers M - N in base b can be done as follows:

1. Add the minuend M to the (b-1)’s complement of the subtrahend N. Mathematically,


M + ((bn – 1) - N) = M - N + bn - 1

2. If M ≥ N, the sum will produce an end carry bn. To obtain the result, remove the end
carry and add 1 to the sum which also termed as end around carry.
3. If M < N, the sum does not produce any carry. To obtain the answer in a familiar form,
take the (b-1)’s complement of the sum and place a negative sign in front.

Number Systems 20
SUBTRACTION WITH (b-1)’s COMPLEMENT

Example-1:
✓ Using 1’s complement, subtract (101111)2 − (100110)2.
1 1 1 1 1
1
Solution: Here, M = (101111)2 and N = (100110)2 1 0 1 1 1 1
+ 0 1 1 0 0 1
1’s complement of N = (011001)2 ---------------------
1 0 0 1 0 0 0
Step -1: Add M with 1’s complement of N
End Around Carry
+ 1
---------------------
0 0 1 0 0 1

Step -2: Here M>N, hence, the result is (101111)2 − (100110)2 = (001001)2

Number Systems 21
SUBTRACTION WITH (b-1)’s COMPLEMENT

Example-2:
✓ Using 1’s complement, subtract (100)2 − (110000)2.

Solution: Here, M = (100)2 and N = (110000)2 1 1


1’s complement of N = (001111)2 0 0 0 1 0 0
+ 0 0 1 1 1 1
Step -1: Add M with 1’s complement of N ----------------------
0 1 0 0 1 1

Step -2: Here M<N, hence, the result is obtained by taking the 1’s complement of sum with a
negative sign in front.
(100)2 − (110000)2 = −[1’s complement of (010011)2] = −(101100)2

Number Systems 22
SUBTRACTION WITH (b-1)’s COMPLEMENT

Example-3:
✓ Using 9’s complement, subtract 52532 − 3250.
1 1 1
Solution: Here, M = 52532 and N = 3250 5 2 5 3 2
+ 9 6 7 4 9
9’s complement of N = (99999 − 03250)
-------------------
= 96749 1 4 9 2 8 1
End Around Carry
Step -1: Add M with 9’s complement of N + 1
-------------------
4 9 2 8 2

Step -2: Here M>N, hence, the result is 52532 − 3250 = 49282

Number Systems 23
SUBTRACTION WITH (b-1)’s COMPLEMENT

Example-4:
✓ Using 9’s complement, subtract 1020 − 2056.

Solution: Here, M = 1020 and N = 2056

9’s complement of N = (9999 − 2056)


1 0 2 0
= 7943 + 7 9 4 3
Step -1: Add M with 9’s complement of N ---------------
8 9 6 3
Step -2: Here M<N, hence, the result is obtained by taking the 9’s complement of sum with a
negative sign in front.
1020 − 2056 = −[9’s complement of 8963] = −(9999 − 8963) = − 1036

Number Systems 24
ASSIGNMENT QUESTIONS

1. Using 1’s, 2’s, 9’s and 10’s complement perform the following
(a) 23-56
(b) 98-34

Number Systems 25

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy