3CS3-04: DIGITAL ELECTRONICS
UNIT – 1
Fundamental Concepts
Fundamental Concepts
Number Systems And Codes
Basic Logic Gates And Boolean Algebra:
Sign & Magnitude Representation, Fixed Point
Representation
Complement Notation
Various Codes & Arithmetic In Different Codes &
Their Inter Conversion.
Features Of Logic Algebra
Postulates Of Boolean Algebra
Theorems Of Boolean Algebra.
Number System
Binary Number
Octal Number
Decimal Number
Hexadecimal Number
Number Systems
Binary Numbers
Digits = {0, 1}
(11010.11)2 = 1 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20 + 1 x 2-1 + 1 x 2-2
= 1* 16+ 1 * 8 + 0* 4 + 1* 2 + 0 *1 + 1* 0.5 + 1 * 0.25
= 16 + 8 + 0 +2 +0+ 0.5+ 0.25
(11010.11)2 = (26.75)10
Octal Numbers
Digits = {0, 1, 2, 3, 4, 5, 6, 7}
(127.4)8 = 1 x 82 + 2 x 81 + 7 x 80 + 4 x 8-1 = 1 * 64 + 2 * 8 + 7*1+ 4/8
= 64 + 16 + 7 + 0.5
= (87.5)10
Hexadecimal Numbers
Digits = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
(B65F)16 = 11 x 163 + 6 x 162 + 5 x 161 + 15 x 160
= (46,687)10
Conversion of Bases
Example: Base 8 to base 10
(432.2)8 = 4 *82 + 3 * 81 + 2 * 80 + 2 *8-1 = (282.25)10
Example: Base 2 to base 10
(1101.01)2 = 1 *23 + 1 *22 + 0 *21 + 1 * 20 + 0 *2-1 + 1 * 2-2 = (13.25)10
Base b1 to b2, where b1 > b2:
Example
(55)5 = ( ? )10
= 5 * 51 + 5 * 50
= 25 + 5 = (30)10
(251 . 25) 7 = ( ? )10
= 2*72 + 5 * 71+ 1 * 70 + 2 * 7-1 + 5 * 7-2
= 2 * 49 + 5 *7 + 1 * 1 + 2/7 + 5/49
= 98 + 35 + 1 + 0.285 + 0.102
= (134.387) 10
Example
(102.57)8 = (?)10
(102.57)8 = 1*82 + 0 * 8 + 2 * 80 + 5 * 8-1 + 7* 8 -2
= 64 + 0 + 2 + 0.625 + 0.109
= (66.734)10
( 242)5 = (?)10
( 242)5 = 2* 52 + 4*51 + 2*50
= 2*25 + 4*5 + 2*1
= 50 + 20 + 2
= (72)10
(245)x = (131)10 Find the Value of x.
= 2 * x2 + 4 * x1 + 5 * x0 = 131
= 2x2 + 4x + 5 = 131
= 2x2 + 4x – 126 = 0
= X2 + 2x – 63 = 0
= X2 + 9x – 7x – 63 = 0
= X (x + 9) -7 (x + 9) = 0
= (x + 9) (x – 7) = 0
X = -9, 7
Base is not possible in –ive. So X = 7.
Conversion of Bases (Contd.)
Example: Convert (548)10 to base 8
Thus, (548)10 = (1044)8
Example: Convert (345)10 to base 6
Thus, (345)10 = (1333)6
Converting Fractional Numbers
Fractional number:
Example: Convert (0.3125)10 to base 8
0.3125 * 8 = 2.5000 hence a-1 = 2
0.5000 * 8 = 4.0000 hence a-2 = 4
Thus, (0.3125)10 = (0.24)8
Decimal to Binary
Example: Convert (432.354)10 to binary
0.354 * 2 = 0.708 hence a-1 = 0
0.708 * 2 = 1.416 hence a-2 = 1
0.416 * 2 = 0.832 hence a-3 = 0
0.832 * 2 = 1.664 hence a-4 = 1
0.664 * 2 = 1.328 hence a-5 = 1
0.328 * 2 = 0.656 hence a-6 = 0
a-7 = 1
etc.
Thus, (432.354)10 = (110110000.0101101…)2
Octal/Binary Conversion
Example: Convert (123.4)8 to binary
(123.4)8 = (001 010 011.100)2
Example: Convert (1010110.0101)2 to octal
(1010110.0101)2 = (001 010 110.010 100)2 = (126.24)8
Examples
• (105)6 = (51)8 = (101001)2
• (232)8 = (9A)16
• (101010)2 = ()5
(23)x = (233)8
2* x1+ 3 * x0 = 2*82+ 3*81 + 3*80
2x + 3 = 2*64 + 3*8 + 3*1
2x + 3 = 128 + 24 +3
2x +3 = 155
2x = 152
x = 76
Representation of Integers
Binary and Weighted Codes
Although binary systems have advantages in digital computers
(to control the switches), humans work in decimal systems.
It is convenient to represent decimal digits by sequence of
binary digits.
Several coding techniques have been developed to do so.
Decimal digits: 0, 1, …, 9 (10) can be represented by 4 bits.
Since, we need 10 out of 16 values, several codes possible.
Weighted Codes: If x1, x2, x3, x4 are the binary digits, with
weights w1, w2, w3, w4, then the decimal digit is:
N=w4x4+w3x3+w2x2+w1x1
We say, the sequence (x1, x2, x3, x4) denotes the code word for
N.
Binary Codes
Is this
unique?
BCD Self-complementing Codes
Self-complementing code: Code word of 9’s complement of N obtained by
interchanging 1’s and 0’s in the code word of N
Non weighted Codes
Can you see some Add 3 to
interesting BCD
properties in the
excess-3 code?
Binary Arithmetic
Binary Addition
1010 + 0111 = 1111
1110 + 1010 = 11000
1110 + 1111 = 11101
1111.00 + 1111 .01 = 1 1110.01
Binary Subtraction
• 1101 – 0101 = 1000
• 1011 – 0110 = 0101
• 0101 – 0111 = - 0010
Binary Multiplication
101
x 111
101
101
101
100011
Binary Division
11001 ) 1100111001 (100001
11001
0000011001
11001
00000
Binary Division
11001 ) 1000100110 (10110
011001
00100101
11001
000011001
11001
0000000000
Binary Addition/Subtraction
Example: Binary Addition
1111 = carries of 1
1111.01 = (15.25)10
0111.10 = ( 7.50)10
10110.11 = (22.75)10
Example: Binary subtraction
1 = borrows of 1
10010.11 = (18.75)10
01100.10 = (12.50)10
00110.01 = ( 6.25)10
Binary Multiplication/Division
Example: Binary multiplication
11001.1 = (25.5)10
110.1 = ( 6.5)10
110011
000000
110011
110011
10100101.11 = (165.75)10
Example: Binary division
10110 = quotient
11001 1000100110
11001
00100101
11001
0011001
11001
00000 = remainder
Review Of Boolean Algebra
• Not is a horizontal bar above the number
0 = 1
1 = 0
• Or is a plus
0+0 = 0
0+1 = 1
1+0 = 1
1+1 = 1
• And is multiplication
0*0 = 0
0*1 = 0
1*0 = 0
1*1 = 1
Types of Logic Gates
AND Gate
There are following three basic logic gates-
AND Gate
OR Gate
NOT Gate
1. AND Gate-
The output of AND gate is high (‘1’) if all of its inputs are high
(‘1’).
The output of AND gate is low (‘0’) if any one of its inputs is
low (‘0’).
Logic Symbol of AND Gate
Truth Table of And Gate
The truth table for AND Gate is as shown below-
A B Y = A.B
0 0 0
0 1 0
1 0 0
1 1 1
OR Gates
OR Gate-
•The output of OR gate is high (‘1’) if any one of its inputs is high (‘1’).
•The output of OR gate is low (‘0’) if all of its inputs are low (‘0’).
Logic Symbol-
The logic symbol for OR Gate is as shown below-
Truth Table of OR Gate
The truth table for OR Gate is as shown below-
A B Y=A+B
0 0 0
0 1 1
1 0 1
1 1 1
NOT Gate
NOT Gate-
The output of NOT gate is high (‘1’) if its input is low (‘0’).
The output of NOT gate is low (‘0’) if its input is high (‘1’).
Truth Table of Not gate
The truth table for NOT Gate is as shown below-
A Y = A’
0 1
1 0
NAND Gate
NAND Gate Using Basic Gate
AND + NOT = NAND
NAND Gate Using Basic Gate
NOR Gate
OR + NOT = NOR (A + B)’
NOR Gate Using Basic Gate
Exclusive- OR Gate
A’B + AB’
XOR Gate
XNOR Gate
Exclusive- NOR Gate
Basic Gate Using NAND Gate
(AB)’
(AB)’’ = AB
A’
(A’B’)’ = A’’ + B’’ = A+ B
B’
BASIC Gate Using NOR Gate
XOR Gate Using NOR
A’
(A’ + B’ )’ = A’’ B’’
= AB
B’
(A + B )’ = A’B’
(AB + A’B’ )’
= (AB)’ (A’B’)’
= (A’ + B’) (A” + B’’)
= (A’ + B’) (A + B)
= A’A + A’B + B’A + B’B
= 0 + A’B + AB’ + 0
= A’B + AB’
= XOR
XNOR Gate Using NAND Gate
A’
(A’.B’)’ = A’’ + B’’
=A+B
B’
(A.B)’ ((A + B). (A.B)’ )’
= (A + B)’ + (AB)’’
= A’.B’ + AB
= XNOR
XOR/ XNOR Gate Using NAND Gate
Equation Implement Using Logic Gates
• F = X’YZ + X’YZ’ + XZ
X’
X’YZ
X’YZ’
F = X’YZ + X’YZ’ + XZ
Z’
XZ
Binary To Gray
b3 b2 b1 b0
Binary = 1 0 1 0
Gray =
g3 = b3 = 1
g2 = b3 xor b2 = 1 xor 0 = 1
g1 = b2 xor b1 = 0 xor 1 = 1
g0 = b1 xor b0 = 1 xor 0 = 1
(1010)2 = (1111)G
Binary to Gray
Binary = 1101, Gray = ?
Gray =
g3 = b3 = 1
g2 = b3 xor b2 = 1 xor 1 = 0
g1 = b2 xor b1 = 1 xor 0 = 1
g0 = b1 xor b0 = 0 xor 1= 1
(1101)2 = (1011)G
Binary to Gray
Binary to Gray
Example:
Binary:
Gray:
Binary to Gray
4 Bit Gray to Binary
g3 g2 g1 g0
Gray = 1 1 1 1
Binary = ?
b3 = g3 = 1
b2 = b3 xor g2 = 1 xor 1 = 0
b1 = b2 xor g1 = 0 xor 1 = 1
b0 = b1 xor g0 = 1 xor 1 = 0
(1111)G = (1010)2
4 Bit Gray to Binary
g3 g2 g1 g0
Gray = 1 0 0 1
Binary = ?
b3 = g3 = 1
b2 = b3 xor g2 = 1 xor 0 = 1
b1 = b2 xor g1 = 1 xor 0 = 1
b0 = b1 xor g0 = 1 xor 1 = 0
(1111)G = (1110)2
4 Bit Gray to Binary
g3 g2 g1 g0
Gray = 0 1 1 1
Binary = ?
b3 = g3 = 0
b2 = b3 xor g2 = 0 xor 1 = 1
b1 = b2 xor g1 = 1 xor 1 = 0
b0 = b1 xor g0 = 0 xor 1 = 1
(0111)G = (0101)2
4 Bit Gray to Binary
Gray to Binary
4 Bit Gray to Binary
g5 g4 g3 g2 g1 g0
Gray = 0 1 1 1 0 1
Binary = ?
B5 = g5 = 0
B4 = b5 xor g4 = 0 xor 1 = 1
b3 = b4 xor g3 = 1 xor 1 = 0
b2 = b3 xor g2 = 0 xor 1 = 1
b1 = b2 xor g1 = 1 xor 0 = 1
b0 = b1 xor g0 = 1 xor 1 = 0
(011101)G = (010110)2
1’s Complement
There is a simple algorithm to convert a binary
number into 1’s complement. To get 1’s of a
binary number, simply invert the given
number.
1’s complement of binary number 110010 is
001101.
Simple implementation which uses only NOT
gates for each input bit.
2’s Complement
To get 2’s complement of a binary number,
simply invert the given number and add 1 to
the least significant bit (LSB) of given result.
2’s complement of binary number 110010 is
001110.
Uses NOT gate along with full adder for each
input bit.
2’s Complement
Find out 2’s complement of 100101011 ?
Give 100101011
• 011010100 – 1’s of 100101011
• + 1
= 011010101 – 2’s complement of 100101011
1’s & 2’s Complement
2’s = 1’s + 1
(1010)
1’s – 0101
2’s = 0101 + 0001 = 0110
(100101011)
1’s – 011010100
2’s = 011010100 + 000000001 = 011010101
Complements of Numbers
There are two types of complements for each
base-r system: the radix complement and
diminished radix complement.
the r's complement and the second as the (r -
1)'s complement.
r’s complement
rn – N
(r -1)'s complement
rn – N - 1
9’s & 10’s Compliment
10’s Compliment
10n – N
9’s + 1
9’s Compliment
10n – N – 1
10’s – 1
9n times - N
9’s & 10’s Compliment
10’s Compliment of 347
103 – 347 = 1000 – 347 = 653
9’s Compliment of 347
103 – 347 – 1 = 999 – 347 = 652
9’s Compliment of 5327
104 – 5327 – 1 = 9999 – 5327 = 4672
9’s & 10’s Compliment
9’s & 10’s Compliment
10’s Compliment of 567
103 – 567 = 1000 – 567 = 433
9’s Compliment of 567
999 – 567 = 432
9’s & 10’s Compliment
Subtract Using 9’s Compliment
Subtract Using 9’s Compliment
• 678 – 234 using 9’s complement
678 – 234 = 444
9’s of 234 = 999 – 234 = 765
678
+ 765 – 9’s complement of 234
=1443
+ 1 – Add carry
= 444
Subtract Using 9’s Compliment
• 228 – 485 = -257
• 228
+ 514 (9’s of 485)
= 742
No carry is generated so op is –ive.
Final op = - (9’s of 742) = -257
Subtract Using 9’s Compliment
Subtract Using 9’s Compliment
Subtract Using 10’s Compliment
Subtract Using 10’s Compliment
Subtract Using 10’s Compliment
• Subtract 228 – 445 using 10’s Complement
228 – 445 = -217
• 228
+ 555 (10’s of 445)
= 783
No carry is generate so out is –ive.
Final op = - (10’s 783) = -217
Subtract Using 1’s Compliment
• Subtract 101 – 100 using 1’s Complement
101 – 100 = 001
• 101
+ 011 – 1’s of 100
= 1000
+ 1 – Add carry
= 001
Subtract Using 2’s Compliment
• Subtract 101 – 100 Using 2’s Complement
• 101 – 100 = 001
• 101
+ 100 – 2’s of 100
=1001
Sign & Magnitude Representation
Sign & Magnitude Representation
Sign & Magnitude Representation
• +15 = 0 1111
• -15 = 1 1111
• +10 = 0 1010
• -10 = 1 1010
• +9 = 0 1001
• -9 = 1 1001
Sign & Magnitude Representation
Sign & Magnitude Representation
Sign & Magnitude Representation
Fixed Point Representation
Fixed Point Representation
BCD Number
BCD Addition
BCD Addition
BCD Addition of 4 + 7 BCD Addition of 9 + 7
BCD Addition
Find BCD Addition of 184 + 576
184 + 576 = 760
184 = 0001 1000 0100
576= 0101 0111 0110
Add= 0110 1111 1010
(Right Two Bit four bit group are Invalid BCD so add +6 on both)
Add= 0110 1111 1010
0110 0110
= 0111 0110 0000
Boolean Algebra
A Boolean algebra comprises...
– A set of elements B
– Binary operators {+ , •} Boolean sum and product
– A unary operation { ' } (or { }) example: A’ or A
…and the following axioms
Commutative: a+b = b+a a•b = b•a
Associative: a+(b+c) = (a+b)+c a•(b•c) = (a•b)•c
Identity: a+0 = a a•1 = a
Distributive: a+(b•c)=(a+b)•(a+c) a•(b+c)=(a•b)+(a•c)
Complementarily: a+a' = 1 a•a' = 0
Logic Functions and Boolean
Algebra
Any logic function that is expressible as a truth table
can be written in Boolean algebra using +, •, and '
X Y Z Z=X•Y X Y X' Z Z=X'•Y
0 0 0 0 0 1 0
0 1 0 0 1 1 1
1 0 0 1 0 0 0
1 1 1 1 1 0 0
X Y X' Y' X • Y X' •Y' Z Z=(X•Y)+(X' •Y')
0 0 1 1 0 1 1
0 1 1 0 0 0 0
1 0 0 1 0 0 0
1 1 0 0 1 0 1
Some Notation
Priorities: A B + C = ((A) B) + C
Variables and their complements are
sometimes called literals
3.2 Boolean Algebra
De Morgan’s Law
de Morgan’s Theorem
Procedure for complementing Boolean functions
Replace: all ANDs to ORs and all ORs to ANDs
Replace all variables with their complements
96
Principle of Duality
Duality
(a meta-theorem— a theorem about theorems)
All Boolean expressions have logical duals.
Any theorem that can be proved is also proved
for its dual.
Replace: • with +, + with •, 0 with 1, and 1 with
0.
Leave the variables unchanged
Useful Laws and Theorems
Identity: X+0=X Dual: X • 1 = X
Null: X+1=1 Dual: X • 0 = 0
Idempotent: X+X=X Dual: X • X = X
Involution: (X')' = X
Complementarily: X + X' = 1 Dual: X • X' = 0
Commutative: X+Y=Y+X Dual: X • Y = Y • X
Associative: (X+Y)+Z=X+(Y+Z) Dual: (X•Y)•Z=X•(Y•Z)
Distributive: X•(Y+Z)=(X•Y)+(X•Z) Dual: X+(Y•Z)=(X+Y)•(X+Z)
Uniting: X•Y+X•Y'=X Dual: (X+Y)•(X+Y')=X
Proving Theorems
Example 1: Prove the uniting theorem--
X•Y+X•Y'=X
Distributive X•Y+X•Y' = X•(Y+Y')
Complementarily = X•(1)
Identity =X
Example 2: Prove the absorption theorem-
X+X•Y=X
Identity X+X•Y = (X•1)+(X•Y)
Distributive = X•(1+Y)
Null = X•(1)
Identity =X
Proving Theorems
Example 3: Prove the consensus theorem--
(XY)+(YZ)+(X'Z)= XY+X'Z
Complementarity XY+YZ+X'Z = XY+(X+X')YZ + X'Z
Distributive = XYZ+XY+X'YZ+X'Z
• Use absorption {AB+A=A} with A=XY and B=Z
= XY+X'YZ+X'Z
Rearrange terms = XY+X'ZY+X'Z
• Use absorption {AB+A=A} with A=X'Z and B=Y
XY+YZ+X'Z = XY+X'Z
Example
Example:
Z = A'BC + AB'C' + AB'C + ABC' + ABC
= A'BC + AB'(C’ + C) + AB(C' + C) distributive
= A'BC + AB’ + AB complementary
= A'BC + A(B' + B) distributive
= A'BC + A complementary
= BC + A absorption #2 Duality
Example
• Prove that : a'b' + ab + a'b = a'+b
a’b’ + ab + a’b = ab + a’b’ + a’b
= ab + a’ (b’ + b)
= ab + a’ (we know that b+b’ = 1)
= a’ + b
(From absorption laws a + a’b = a+ b)
Hence Proved.
Example
Prove That: ab' + b'c' + a'c' = ab' + a' c'
ab’ + b’c’ + a’c’ = ab + a’c’ + bc.1
= ab + a’c’ + bc (a + a’)
(a + a’ =1)
= ab + a’c’ + abc + a’bc
= ab + abc + a’c’ + a’bc
= ab (1+c) + a’c’ ( 1+ b)
(1+c = 1 & 1+b = 1)
= ab’ + a’c’. Hence Proved.
Example
If AB’ + A’B = C then proved that
AC’ + A’C = B
AC’ + A’C = A (AB’ + A’B)’ + A’ (AB’ + A’B)
(Given that C = AB’ + A’B)
= A ( A’ + B) (A+B’) + A’AB’ + A’A’B
= (AA’ + AB) (A+B’) + A’B
(we know that AA’=0 & A’A’ = A’)
= AB (A+B’) + A’B
= AB + ABB’ + A’B (we know that BB’ = 0)
= AB + A’B
= B (A+A’)
=B (we know that A+A’ = 1)
So, AC’ + A’C = B. Hence Proved.
Unit-1
Important Questions
Convert (10101101)2 to Gray
(10101101)2 = (11111011)G
Convert (AB 6)16 to decimal
Realize the Logic expression
Y = (A+B) (A’+C) (B+D)
Using basic gate?
If A = 1001 and B= 0100 then find
out the value of A+B using BCD
addition?
Subtract 748 from 983 using 9’s
complement method
For the output 'F' to be ‘1’ the
logic circuit shown in figure find
the values of A, B & C
Draw the simplest possible logic
diagram that implements the
output of the logic diagram
shown below
DE Unit -1 Complete