Types of Logic Gates Explained
Types of Logic Gates Explained
Logic Gates
In digital electronics, logic gate is physical device implementing a boolean
function, it perform logical operation, takes one or more inputs and produce
single binary output signals.
Logic gates are implemented generally using diodes, transistors, semiconducto
devices etc.
Basic building blocks from which many kinds of logic circuits can be
constructed.
a
a+b
a b a+b
b 0 0 0
0 1 1
1 0 1
OR gate diagram
1 1 1
truth table
AND gate
An AND gate has two or more inputs and give single output.
It multiplies the input, it is denotedd by dot (.) sign.
Its diagram and truth table are shown below.
a
a.b
a b a.b
b 0 0 0
0 1 0
1 0 0
AND gate diagram
1 1 1
truth table
Characteristics: An AND gate gives output 1 when all inputs are 1 other
wise it gives 0.
NAND gate
It is simple AND gate followed by a NOT gate.
So the output will be low (0) if and only if all the input are high (1).
It complements the output of AND gate.
A NAND gate has two or more inputs and give single output.
a
a.b
a b a.b
b 0 0 1
0 1 1
1 0 1
1 1 0
truth table
NOR gate
It is simple OR gate followed by a NOT gate.
So the output will be high (1) if and only if all inputs are low (0).
a
a+b
a b a+b
b 0 0 1
0 1 0
1 0 0
1 1 0
truth table
a truth table
a + b Y=A + B +C
b a b a+b A B C Y
0 0 0 0 0 0 0
0 1 1 0 0 1 1
It is combination of gates 1 0 1 0 1 0 1
1 1 0 0 1 1 0
A B
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
AB
A + B = AB + AB
AB
XNOR gate
A XNOR gate has 2 or more I/Ps and single O/P.
The Exclusive NOR gate is sometimes reffered to as the ‘COINCIDENCE’
or ‘EQUIVALENCE’ gate.
Its logic diagram and truth table is shown below:
A
Y=A . B
B = AB + A′B′
Observe that it is the XOR symbol with the added invert bubble
on the output side. The Boolean expression for XNOR is
therefore, the complement of XOR function denoted by symbol .
A . B = (A + B)'
= (AB′ + A′B)′
= (A′ + B) . (A + B′)
= AA′ + A′B′ + AB + BB′
= AB + A′B′
truth table
a b a.b
0 0 1
0 1 0
1 0 0
1 1 1
Notice that the output of XNOR gate is the complement of XOR truth table.
A B C Y
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0
=A′BC + AB′C + ABC′ + A′B′C′
Questions
Generate output for the given logic circuit ↓
Solution ↓
A Y1 = A+B
Input Output
x x.y
y x.y + x'y'
x'
x'.y'
y'
Universal gates
A logic gate can be an universal gate if we implement AND, OR, and NOT
gate by using it.
NAND and NOR gates are called universal gate because we can design any
Boolean function using either NAND or NOR gate only.
A A
AND A.B
B B A.B
A
A
OR A+B
B
A+B
B
A
A
AND A.B
B A.B
B
A A
OR A+B B A+B
B
replaced
x (xy)'
((xy)'(x'y')')'
y
x'
(x'y')'
y'
((xy)'(x'y')')'
= (xy)''+(x'y')''
= (xy)+(x'y')
A'
A'BC'
C'
((AB'C)'(A'BC'))'
= (AB'C)''+(A'BC')'
=(AB'C) + (A'BC')
A' + B'.C' ↓
step 1 = Draw logic diagram using basic gates.
A
B
C
B
C
B
C
step 4 = Cancelling double not gate
A
B
C
B
C
B
C
ab' + a'b ↓
a
b
ab + a'b' ↓
a
b
Boolean Algebra
Boolean algebra is a branch of algebra in which the values of the variables
are truth value T/F, usually denoted by 1/0.
Main operations are negation (~), disjunction (∨)(+) and conjunction (∧)(.)
a ~a a b avb a b a^b
F T F F F F F F
T F F T T F T F
T F T T F F
T T T T T T
Boolean Laws
1: Idempotent law 5: De-Morgan's law
a.a=a
a+a=a (a + b) = a . b
(a . b) = a + b
2: Associative law
a . (b . c) = (a . b) . c 6: Identity law
a + (b + c) = (a + b) + c
a+0=a
a.0=0
3: Commutative law a+1=1
a.b=b.a a.1=a
a+b=b+a
7: Compliment law
8: Invaluation law
(a)=a
. = intersection (⋂)
+ = union (⋃)
Postulate 2 x + 0 = x x . 1 = x
------------------------------------------------------------------------
Postulate 3 x + y = y + x xy = yx
(Commutative)
------------------------------------------------------------------------
Postulate 4 x.(y + z) = x.y + x.z x + (y.z)
(Distributive)
------------------------------------------------------------------------
Postulate 5 x + x' = 1 x . x' = 0
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
Theorem 1 x + x = x x . x = x
------------------------------------------------------------------------
Theorem 2 x + 1 = 1 x . 0 = 0
------------------------------------------------------------------------
Theorem 3 (x')' = x
(Involution)
------------------------------------------------------------------------
Theorem 4 x + (y + z) = (x + y) + z x(yz) = (x
(Associative)
------------------------------------------------------------------------
Theorem 5 (x + y)' = x'y' (xy)' = x'
(De Morgan)
------------------------------------------------------------------------
Theorem 6 x + xy = x x(x + y) =
(Absorption)
some questions
LHS = xy + xz + yz'
= xy(z+z') + xz(y+y') + yz'(x+x') [as x+x' = 1]
= xyz + xyz' + xyz + xy'z + xyz' + x'yz'
= xyz + xyz' + xy'z + x'yz' [as xyz + xyz = xyz]
= xyz + xy'z + xyz' + x'yz' [rearranging]
= xz(y+y') + yz'(x+x')
= xz + yz' [as y+y' = 1]
= ABCD + ABCD'
= ABC(D+D')
= ABC [as D+D' = 1]
Boolean Expression
Boolean expression is a method using which we represent information about
boolean function i.e. when it give 0 or 1.
We convert truth table of boolean function into boolean expression which
contains all information.
Two types of boolean expression:
SOP
It contains product term (AND term) which are sum (OR) together that's
why called sum of product.
Each product term consists of one or more literals (variables) appearing
either in complemented or uncomplemented form, e.g. a'b' + a'b.
truth table
a b f
-------------
0 0 1
0 1 0
1 0 1
1 1 0
A product term which contains all the literals (variables) either in
complemented or uncomplemented for is called minterm. In a n variable
function 2n minterm can be there.
If a leteral have value 1 then ok, but if not, then we complement one
which is zero.
There is only one input sequence for any minterm on which output is 1 so
it represent info.
Function will have value 1, if atleast one of the product term is 1.
Another example with 3 variable. ↓
a b c f
--------------
0 0 0 0 m0
0 0 1 1 m1
0 1 0 1 m2
0 1 1 0 m3
1 0 0 1 m4
1 0 1 0 m5
1 1 0 0 m6
1 1 1 0 m7
a b c f
--------------
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
POS
Contains SUM (OR) terms which are AND (product) together.
Each sum term consist of one or more literals (variables), either in
complemented or uncomplemented form.
a b c f
-------------
0 0 0 0 M0
0 0 1 0 M1
0 1 0 1 M2
0 1 1 1 M3
1 0 0 0 M4
1 0 1 1 M5
1 1 0 1 M6
1 1 1 0 M7
Practise question
1. Simplify - (P+Q'+R') . (P+Q'+R) . (P+Q+R')
2. Obtain boolean eq. for:
F(x,y,z) = ∑(4,6,7)
F(a,b,c) = π(1,3,6)
Karnaugh Map
In 1953, Maurice Karnaugh developed K-map for reducing boolean
equations so that we have a small logic circuit.
The K-map is a diagram made up of squares, and each square represent
one minterm/maxterm.
Problems with other methods: The algebraic procedure using boolean
laws and rule for minimizing boolean expression becomes difficult when a
function becomes complex, because we have to identify where is the
scope of minimization based on some boolean laws and it is difficult to
understand where we reach saturation point or not.
Karnaugh map is one of the most extensively used tool, it is a graphical
representation, represents truth table by pictorial form, provides a
systematic method for simplifying or minimizing a boolean expression.
For n-variable K-map, there will be 2n cells addressed by a gray code.
Each cell corresponds to one minterm or maxterm.
we are using gray code here because that it is cyclic and we can easily
minimize adjacent term.
K-MAP
2 Variable K-MAP
A 2 variable K-map is used for the boolean equation that has only two
binary variables. For example → xy + xy'.
With 2 i/ps, there are 4 possible combinations, so we have 4 squares in a
2 variable K-map. Each square shows one minterm or maxterm.
y
x y' y
x'
m0 m1
x
m2 m3
3 variable K-MAP
The number of cells in 3 variable K-map is eight, since the number of
variable is three, the following figure shows 3 variable K-map.
x' 0
m0 m1 m3 m2
x 1
m4 m5 m7 m6
4 variable K-MAP
The number of cells in 4 variable K-map is sixteen, since the number of
variables if four. The following figure shows 4 variable K-Map.
w'x' 00
m0 m1 m3 m2
w'x 01
m4 m5 m7 m6
wx 11
m12 m13 m15 m14
wx' 10
m8 m9 m11 m10
5 variable K-MAP
The number of cells in 5 variable K-map is thirty two since the number of
varaibles is 5. The following figure shows 5 variable K-map, we combine 2
maps of 16 boxes.
st
qr 00 01 11 10 00 01 11 10
00
0 1 2 3 16 17 19 18
01
4 5 7 6 20 21 23 22
11
12 13 15 14 28 29 31 30
10
8 9 11 10 24 25 27 26
p=0 p=1
a+b 00
0 1 2 3
a+b' 01
4 5 7 6
a'+b' 11
12 13 15 14
a'+b 10
8 9 11 10
K-MAP questions:
f(x,y,z) = (0, 1, 5, 6)
2
3
x 1 1 1
f(x,y,z) = (0, 1, 3)
x 1
x'y' + x'z
1 2
1 1
x' 0 1 1
2
x 1 1 1
x'z' + xy'
1 2
f(w,x,y,z) = (2,3,5,6,11,12,15)
f(w,x,y,z) = (0,1,4,7,8,9,10,13,14)
yz y'z' y'z yz yz'
wx 00 01 11 10
w'x' 00 1 1
w'x 01 1 1
wx 11 1 1
wx' 10 1 1 1
x' 0 1 1
x 1 1 1
x'y'z' + yz + xz
f(x,y,z) = x'y'z' + x'yz' + xy'z' + d(6)
yz y'z' y'z yz yz'
x 00 01 11 10
x' 0 1 1
x 1 1 X
x'y' + y'z'
5-variable K-MAP
Video one ⇗
Video two ⇗
6-variable K-MAP
Video one ⇗
Obtain:
1. Minimal sum of product and
2. Product of sum expressions for the function given below:
F(A, B, C, D) = ∑m(1, 3, 7, 11, 15) + ∑d(0, 2, 5)
Design a circuit:
1. That obtain AND opertion using NAND gate.
2. That obtain OR opertion using NAND gate.
3. That obtain OR opertion using NOR gate.
4. That obtain AND opertion using NOR gate.