Components of Marks Distribution
Lab Evaluation
Quiz - 10 Marks
30 Marks
Total
100 Marks
Mid-Term Examination End Sem Examination
20 Marks 40 Marks
1/14/2025
1/14/2025 1 1
Number systems
❑ In digital electronics, the number system is used for representing the information.
❑ The number system has different bases and the most common of them are the Decimal,
Binary, Octal, and Hexadecimal.
❑ The Base or Radix of the number system is the total number of the digit used in the number
system. Suppose if the number system representing the digit from 0 – 9 then the base of the
system is the 10.
1/14/2025 2
Decimal Number System
Example
Characteristics: (2586)10 = (2 x 103) + (5 x 102) + (8 x101) + (6x100)
• A positional number system has 10 = 2000 + 500 + 80 + 6
symbols or digits (0, 1, 2, 3, 4, 5, 6, 7, 8,
9). Hence, its base = 10
• The maximum value of a single digit is
9 (one less than the value of the base)
• Each position of a digit represents a
specific power of the base (10)
• We use this number system in our day-
to-day life
1/14/2025 3
Binary Number System
Characteristics:
• A positional number system has only 2 symbols or digits (0 and 1). Hence its
base = 2
• The maximum value of a single digit is 1 (one less than the value of the base)
• Each position of a digit represents a specific power of the base (2)
• This number system is used in computers
Example:
(10101)2 = (1 x 24) + (0 x 23) + (1 x 22) + (0 x 21) x (1 x 20)
= 16 + 0 + 4 + 0 + 1
= (21)10
1/14/2025 4
LSB vs MSB
1/14/2025 5
Octal Number System
Characteristics:
• A positional number system has total 8 symbols or digits Hence, its base = 8 (0,
1, 2, 3, 4, 5, 6, 7).
• The maximum value of a single digit is 7 (one less than the value of the base
• Each position of a digit represents a specific power of the base (8)
• Since there are only 8 digits, 3 bits (23 = 8) are sufficient to represent any octal
number in binary
Example
(2057)8 = (2 x 83) + (0 x 82) + (5 x 81) + (7 x 80)
= 1024 + 0 + 40 + 7
= (1071)10
1/14/2025 6
Hexadecimal Number System
Characteristics:
• A positional number system has total 16 symbols or digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C,
D, E, F). Hence its base = 16
• The symbols A, B, C, D, E and F represent the decimal values 10, 11, 12, 13, 14 and 15
respectively
• The maximum than the value of a single digit is 15 (one less of the base)
• Each position of a digit represents a specific power of the base (16)
• Since there are only 16 digits, 4 bits (24 = 16) are sufficient to represent any hexadecimal
number binary.
Example:
(1AF)16 = (1 x 162) + (A x 161) + (F x 160)
=1 x 256 + 10 x 16 + 15 x 1
= 256 + 160 + 15 = (431)10
1/14/2025 7
Decimal Vs Binary Vs Octal Vs Hexadecimal
1/14/2025 8
Decimal Vs Binary Vs Octal Vs Hexadecimal
1/14/2025 9
Conversion Across the Number Systems
2510 = 110012 = 318 = 1916
1/14/2025 10
1. Binary ➔ Decimal:
1/14/2025 11
2. Octal ➔ Decimal:
1/14/2025 12
3. Hexadecimal➔ Decimal
1/14/2025 13
4. Decimal ➔ Binary
1/14/2025 14
5. Octal ➔ Binary
1/14/2025 15
6. Hexadecimal ➔ Binary
1/14/2025 16
7. Decimal ➔ Octal
1/14/2025 17
8. Decimal ➔ Hexadecimal
1/14/2025 18
9. Binary➔ Octal
1/14/2025 19
10. Binary ➔ Hexadecimal
1/14/2025 20
11. Octal➔ Hexadecimal
1/14/2025 21
12. Hexadecimal➔ Octal
1/14/2025 22
Why Binary Arithmetic's?
• A Computer understands only Binary
• The Arithmetic and Logical operation is done also in Binary
3+5 =8
0011 + 0101 = 1000
Binary Arithmetic
1) Addition
2) Subtraction
3) Multiplication
4) Division
1. Binary Addition
• Adding bits:
• 0+0= 0
• 0+1= 1
• 1+0= 1
• 1 + 1 = (1) 0
• Adding integers:
1 1 0
0 0 0...... 0 1 1 1 two = 7ten
+ 0 0 0...... 0 1 1 0 two = 6ten
= 0 0 0 . . . . . . 1 (1)1 (1)0 (0)1 two = 13ten
2. Binary Subtraction
• Bitwise:
• 0-0= 0
• 0 - 1 = (1)1
• 1-0= 1
• 1-1= 0
• Direct Subtraction:
0 0 0......0 1 1 1 two = 7ten
– 0 0 0......0 1 1 0 two = 6ten
= 0 0 0...... 0 0 0 1two = 1ten
3. Binary Multiplication
• Bitwise:
• 0*0= 0
• 0*1= 0
• 1*0= 0
• 1*1= 1
• Direct Multiplication: 1 0 0 0 two = 8ten multiplicand
1 0 0 1 two = 9ten multiplier
____________
1000
0000 partial products
0000
1000
____________
1 0 0 1 0 0 0two = 72ten
4. Binary Division
• Bitwise:
• 0 / 0 = not defined
• 0/1= 0
• 1 / 0 = not defined
• 1/1= 1
• Direct Division:
Exercise
1) 1111 + 1010 Ans: 11001
2) 1101 – 1001 Ans: 0100
3) 1001 – 0111 Ans: 0010
4) 1011 * 1101 Ans: 10001111
5) 11001 / 101 Ans: 101
Application of Complements:
Subtraction
Complements
❑ Why Complements ?
✓To simplify the subtraction operation and for logical manipulation
✓Computer does not directly subtract, it adds…
❑ Two Types of Complements
1) (r-1)’s complement
Diminished Radix Complement = (rn - 1) - N
2) r’s complement rn - N for N 0 and
Radix Complement =
0 for N = 0
r is the radix of a given number
(r-1)’s Complements
• Given a number ‘N’ in base ‘r’ having ‘n’ digits
• The r’s complement is given by:
(rn - 1) - N
• Hence in computing system: there exists
• 9’s complement
• 7’s complement
• 1’s complement
• 15’s complement
(r-1)’s Complements
• Example (rn - 1) - N
For r = 10, N = 123410, n = 4 (4 digits),we have:
(rn - 1) = 10,000 -1 = 999910
The 9's complement of 123410 is then:
999910 - 123410 = 876510
Use of (r-1)s Complement
Subtract/Difference = Minuend (M) - Subtrahend(N)
• Case 1: M-N, when M>=N
• Take (r-1)s complement of N = N
• Add M + N
• Add carry propagated to the result to obtain the answer
•
• Case 2: M-N, when M<N
• Take (r-1)s complement of N = N
• Add M + N
• Take (r-1)s complement of the result to obtain the final answer
Example: (r-1)s = (1)s Complement
• Case 1: M-N 1010 - 1000
• Take (1)s complement of N = N 0111
• Add M + N 1010 + 0111 = 10001
• Add carry propagated to the result to obtain the answer
0001 + 0001 = 0010
• Case 2: M-N, when M<N 1000-1010
• Take (1)s complement of N = N 0101
• Add M + N 1000+0101 = 1101
• Take (1)s complement of the result to obtain the final answer
1s complement of 1101 is 0010
r’s Complements
• Given a number ‘N’ in base ‘r’ having ‘n’ digits
• The r’s complement is given by:
rn - N for N 0 and
0 for N = 0
• Hence in computing system: there exists
• 10’s complement
• 8’s complement
• 2’s complement
• 16’s complement
r’s Complements
• Example rn - N for N 0 and
0 for N = 0
For r = 10, N = 123410, n = 4 (4 digits), we have:
rn = 10,00010
The 10's complement of 123410 is then
10,00010 - 123410 = 876610 or 8765 + 1 (9's complement
plus 1)
• Important note from the equation
Note that the Radix Complement is obtained by adding 1 to the
Diminished Radix Complement.
Use of (r)s Complement
• Case 1: M-N, when M>=N
• Take (r)s complement of N = N
• Add M + N
• Ignore the carry to get the final answer
• Case 2: M-N, when M<N
• Take (r-1)s complement of N = N
• Add M + N
• Take (r)s complement of the result to obtain the final answer
Example (r)s = (10)s Complement
Example: Find 543 - 123
10 10
1). Form 10's complement of 123: 1000
- 123
-----------
877
2). Add the two: 543
(+) 877
-------------
1420
3). Since M > N, we discard the carry. Ans: 420
Example: (r)s = (2)s Complement
• Case 1: M-N 1010 - 1000
• Take (2)s complement of N 1000
• Add M + N 1010 + 1000 = 10010
• Ignore the carry to get the final answer
10010= 0010
• Case 2: M-N, when M<N 1000-1010
• Take (2)s complement of N 0110
• Add M + N 1000+0110 = 1110
• Take 2s complement of the result to obtain the final answer
2s complement of 1110 is 0010
Exercise (Solve Using both 1s and 2s both)
• 11111 - 10101
• 11110 - 1001
• 10101 - 11111
• 1001 - 11110
Binary 1’s Complement Example
Binary 2’s Complement Example
For r = 2, N = 011100112, n = 8 (8 digits), we have:
(rn ) = 25610 or 1000000002
The 2's complement of 011100112 is then:
1000000002
- 011100112
----------------
100011012
Note that this is the 1's complement plus 1.
Exercise
• Find 1’s complement of:
• 1000 = ?
• 1010 = ?
• 0101 = ?
• Find 2’s complement of:
• 1000 = ?
• 1010 = ?
• 0101 = ?
Sign Magnitude Representation
• Sign Magnitude Representation of Binary Numbers
Sign Magnitude Representation
• Positive numbers and zero can be represented by unsigned n-digit, radix r numbers.
• Need a representation for negative numbers
• To represent a sign (+ or -) we need exactly one more bit of information (1 binary digit
gives 21 = 2 elements which is exactly what is needed)
• Since most computers use binary numbers, the most significant bit is interpreted as a
sign bit as shown below:
S Bn-1 Bn-2 … B2 B1 B0
Where: S = 0 for Positive numbers
S = 1 for Negative numbers
and Bn can be 0 or 1 (data)
Sign Magnitude Representation
• We have the following interpretations for signed integer representation of
three bits in binary
Number Sign-Mag. 1's Comp. 2's Comp.
+3 011 011 011
+2 010 010 010
+1 001 001 001
+0 000 000 000
-1 101 110 111
-2 110 101 110
-3 111 100 101
Codes
• Codes are the symbolic representation of discrete information, which
may be presented in the form of numbers, letters or physical
quantitates.
• The symbols used for binary digits are 0 and 1 which are arranged
according to the specified rule to make it as information.
• These codes are formed for communication information using digital
computers.
ENCODER
Numbers/letters/Words
+ /10101100
-/*/?
• (Information) (Digital Codes)
Process ins Called
ENCODING
Codes Classification
Binary Codes are broadly classified into five groups
1. Weighted Binary Codes 3. Error Detecting Codes
✓ 8421 ✓ Even-Parity code
✓ 2421 ✓ Odd-Parity code
✓ BCD codes ✓ Check sums
2. Non-Weighted Binary Codes 4. Error Correcting Codes
✓ Exess-3 Code ✓ Hamming Code
✓ Grey Codes
5. Alphanumeric codes
✓ ASCII Codes
Weighted Binary Codes
❑These codes obey the Positional Weighting Principles.
❑Each number represents a specific weight.
❑The bits are multiplied with indicated weights, the sum gives the decimal equivalent number
✓ 8421 Code
✓ 2421 Code
✓ BCD Code
Weighted Binary Codes : 8421 and 2421 codes
Weights
8 4 2 1 Decimal Equivalent 2 4 2 1 Decimal Equivalent
0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 0 0 0 1 1
0 0 1 0 2 0 0 1 0 2
0 0 1 1 3 0 0 1 1 3
0 1 0 0 4 0 1 0 0 4
0 1 0 1 5 1 0 1 1 5
0 1 1 0 6 1 1 0 0 6
0 1 1 1 7 1 1 0 1 7
1 0 0 0 8 1 1 1 0 8
1 0 0 1 9 1 1 1 1 9
Weighted Binary Codes : BCD Codes
• Binary Coded Decimals (BCD): Uses Binary number to specify decimal equivalent
• Uses four bits case for each decimal value
8 4 2 1 Decimal Equivalent 8 4 2 1 8 4 2 1 Decimal Equivalent
0 0 0 0 0 0 0 0 1 0 0 0 0 10
0 0 0 1 1 0 0 0 1 0 0 0 1 11
0 0 1 0 2 0 0 0 1 0 0 1 0 12
0 0 1 1 3 0 0 0 1 0 0 1 1 13
0 1 0 0 4 0 0 0 1 0 1 0 0 14
0 1 0 1 5 0 0 0 1 0 1 0 1 15
0 1 1 0 6 0 0 0 1 0 1 1 0 16
0 1 1 1 7 0 0 0 1 0 1 1 1 17
1 0 0 0 8 0 0 0 1 1 0 0 0 18
1 0 0 1 9 0 0 0 1 1 0 0 1 19
Non-Weighted Binary Codes
• These codes not obey any Positional Weighting Principles.
• Each number is not assigned a fixed value.
• They obey a special rule hat an encoder decides
• Eg.: Excess-3 and Grey Codes
Non-Weighted Binary Codes : Excess-3
• It is obtained by adding “3” to a decimal number. Its binay gives the exact code.
• It also uses four bits format as that of BCD codes
BCD XS-3 DE
0 0 0 0 0 0 1 1 0
0 0 0 1 0 1 0 0 1
0 0 1 0 0 1 0 1 2 10 and 11 in XS-3
0 0 1 1 0 1 1 0 3 0 1 0 0 0 0 1 1 10
0 1 0 0 0 1 1 1 4
0 1 0 1 1 0 0 0 5 0 1 0 0 0 1 0 0 11
0 1 1 0 1 0 0 1 6
0 1 1 1 1 0 1 0 7
1 0 0 0 1 0 1 1 8
1 0 0 1 1 1 0 0 9
Non-Weighted Binary Codes : Gray Code
• Are also called MINIMUM CHANGE CODES
• In these codes only one bit in code group changes when moving from one step to next
Binary Gray Codes DE
0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1 1
0 0 1 0 0 0 1 1 2 Also Called Unit Distant Codes
0 0 1 1 0 0 1 0 3
Used in Analog to Digital Converters
0 1 0 0 0 1 1 0 4
0 1 0 1 0 1 1 1 5
Mirror Image Codes
0 1 1 0 0 1 0 1 6
0 1 1 1 0 1 0 0 7
1 0 0 0 1 1 0 0 8
1 0 0 1 1 1 0 1 9
Example: Binary to Gray Code Conversion Circuit Diagram
1/14/2025 56
Example: Gray Code to Binary Conversion Circuit Diagram
1/14/2025 [email protected] 57
Conversion of Excess-3 to BCD(8421)
1/14/2025 58
BCD(8421) to Excess-3 Conversion
1/14/2025 59
Excess-3 to BCD Conversion
1/14/2025 60