P02-Digital Systems - Lecture - 5-8
P02-Digital Systems - Lecture - 5-8
P02-Digital Systems - Lecture - 5-8
19CSE203
XOR and XNOR Logic Gates
Exclusive-OR (XOR) Gate
• So far we have encountered AND, OR, and NOT gates as
the basic elements from which logic circuits can be
constructed.
• There is another basic element that is very useful in practice,
particularly for building circuits that perform arithmetic
operations.
• This element realizes the Exclusive-OR function.
SOP Implementation
NAND and NOR Logic Networks
• The NAND and NOR gates are called Universal gates since
with either all other logic gates can be implemented.
• NAND Gate-
➢ NAND gate is equal to AND gate followed by NOT gate.
2) AND Gate
3) OR Gate
NAND and NOR Logic Networks
Various Logic Gates Using Only NAND Gates-
4) NOR Gate
5) XOR Gate
NAND and NOR Logic Networks
Various Logic Gates Using Only NAND Gates-
6) XNOR Gate
NAND and NOR Logic Networks
Various Logic Gates Using Only NOR Gates-
1) NOT Gate
2) AND Gate
3) OR Gate
NAND and NOR Logic Networks
Various Logic Gates Using Only NOR Gates-
4) NAND Gate
5) XOR Gate
NAND and NOR Logic Networks
Various Logic Gates Using Only NOR Gates-
6) XNOR Gate
NAND and NOR Logic Networks
Function Implementation Using NAND Gates Only
Example 1-
Implement the function f (a, b, c) = Ʃ m (2,3,4,6,7) using NAND
gates only.
(a) In SOP form (b) In POS form
Solution- The canonical SOP expression for the function is
derived using minterms-
f = m2 + m3 + m4 + m6 + m7
f = a’bc’ + a’bc + ab’c’ + abc’ + abc
f = a’b (c’+ c) + ac’ (b’+ b) + ab (c’+c) {x + x’ =1}
f = a’b + ac’ + ab = (a’+a) b + ac’
f = b + ac’
NAND and NOR Logic Networks
Function Implementation Using NAND Gates Only
Example 1 Solution-
(a) SOP form
f = b + ac’ = b + ac’ x’ = x = complement of x}
f = b’ . (ac’)’
F (x, y) = Ʃm (1,2,3)
= x’y + xy’ +xy
After minimization
F (x, y) = x + y
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
• A three-variable Karnaugh map is constructed by placing 2 two-
variable maps side by side.
• Eight minterms
• The Gray code sequence
• Any two adjacent squares in the map differ by only on variable.
• In a three-variable map it is possible to combine cells to produce
product terms that correspond to
➢ a single cell – gives 3 variable term
➢ two adjacent cells (pair) – gives 2 variable term
➢ a group of four adjacent cells (quad)- gives single variable term
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
Example 1. Simplify the Boolean function
f(x1,x2,x3) = Ʃm(1,4,5,6)
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
Solution-
a) F = A’C +A’B +AB’C + BC
= A’ (B + B’) C + A’B (C + C’) +AB’C + (A+ A’)BC
= A’BC +A’B’C + A’BC + A’BC’ +AB’C +ABC + A’BC
= m3 + m1 + m3 + m2 + m5 + m7 + m3
F = Ʃ m(1, 2, 3, 5, 7)
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
Solution of Example 3-
b)
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
Solution of Example 3-
b)
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
Example 4. Design a 3-bit Majority function.
Solution- Majority function is a threshold function that produces a 1 if and
only if the majority of the inputs are 1.
Truth Table
F = Ʃm (3,5,6,7)
F = BC + AB + AC
Optimized Implementation of Logic
Functions – Karnaugh Map
Three-Variable K-Map
Solution of Example 4-
Logic Circuit for 3-bit Majority function-
F = AB + AC + BC
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
• A four-variable map is constructed by placing 2 three-variable
maps together to create four rows in the same fashion as we
used 2 two-variable maps to form the four columns in a three-
variable map.
• In a four-variable map it is possible to combine cells to produce
product terms that correspond to a single cell, two adjacent cells
(pair), a group of four adjacent cells (quad) and a group of eight
adjacent cells(octa).
• Corner cells also can be combined to produce product term that
correspond to a pair, quad or octa.
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
• 16 minterms
• Combinations of 16 adjacent squares
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Example 1: Simplify the Boolean function-
f1(x1,x2,x3,x4) = Ʃm(2,3,9,10,11,13)
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Example 1: Simplify the Boolean function-
f1(x1,x2,x3,x4) = Ʃm(2,3,9,10,11,13)
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Example 2: Simplify the Boolean function-
f1(x1,x2,x3,x4) = Ʃm(0,2,3,6,7,8,10,15)
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Example 2: Simplify the Boolean function-
f1(x1,x2,x3,x4) = Ʃm(0,2,3,6,7,8,10,15)
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Example 3: Simplify the Boolean function-
f1(x1,x2,x3,x4) = ΠM(2,3,6,7,8,9)
Solution- Write the function in other canonical form
f1(x1,x2,x3,x4) = Ʃm(0,1,4,5,10,11,12,13,14,15)
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Example 3: Simplify the Boolean function-
f1(x1,x2,x3,x4) = Ʃm(0,1,4,5,10,11,12,13,14,15)
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Example 4: Simplify the complement of Boolean function-
f(x1,x2,x3,x4) = ΠM(2,3,5,6,7,8,9,12,13)
Solution- Take the complement of function both the sides-
f(x1,x2,x3,x4) = ΠM(2,3,5,6,7,8,9,12,13)
f’(x1,x2,x3,x4) = M2.M3.M5.M6.M7.M8.M9.M12.M13
= M2+M3+M5+M6+M7+M8+M9+M12+M13
Complement of a maxterm is a minterm and vice versa
m0 = x’y’z’ ; M0 = (x +y +z)
m0 = x’y’z’ = (x’)’ + (y’)’ + (z’)’ = x + y + z = M0
So f’(x1,x2,x3,x4) = Ʃm(2,3,5,6,7,8,9,12,13)
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Solution for example 4-
f’(x1,x2,x3,x4) = Ʃm(2,3,5,6,7,8,9,12,13)
f’(x1,x2,x3,x4) =
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Example 5. Simplify the given Boolean function using Karnaugh
Map.
F(w, x, y, z) = w’x’y’z+ x’yz + wy’z’ + wxy’z + wx’y’z
Solution – First we need to express the function in sum of
minterms form:
F = w’x’y’z + (w +w’)x’yz + w(x + x’) y’z’ + wxy’z +
wx’y’z
= w’x’y’z +wx’yz + w’x’yz + wxy’z’ + wx’y’z’ +
wxy’z + wx’y’z
= m1+m11 + m3 + m12 + m8 + m13 + m9
F = Ʃ m(1,3,8,9,11,12,13)
Optimized Implementation of Logic
Functions – Karnaugh Map
Four-Variable K-Map
Solution for Example 5-
F = wy’ + x’z
Optimized Implementation of Logic
Functions – Karnaugh Map
Five-Variable K-Map
• We can use 2 four-variable maps to construct a five-variable
map.
• It is easy to imagine a structure where one map is directly behind
the other, and they are distinguished by A = 0 for one map and A
= 1 for the other map.
Optimized Implementation of Logic
Functions – Karnaugh Map
Five-Variable K-Map
Example 1. Simplify the Boolean function
f1(a, b, c, d, e) = Ʃ m(2,3,6,7,9,13,18,19,22,23,24,25,29)
Optimized Implementation of Logic
Functions – Karnaugh Map
Five-Variable K-Map
Example 2. Simplify the Boolean function
F (A,B,C,D,E) = ∑ m(0, 1, 4, 8, 10, 12, 13, 15, 16, 17, 20, 23, 24, 28, 29, 31)
Optimized Implementation of Logic
Functions – Karnaugh Map
# of Adjacent Squares and # of Literals
• The relationship between the number od adjacent squares and
the number of literals in term-