Documente Academic
Documente Profesional
Documente Cultură
Ch ter
4 Logic Gates
4.1 Introduction
Logic gates are the most fundamental digital circuit that can be constructed from
diodes, transistors and registers connected in such a way that circuit output is the
result of basic logic operation (OR, AND, NOT) performed on the inputs.
A logic gate is an electronic device with one output and one or more inputs
where the output always depends on the input combinations.
Logic symbols used to represent the logic gates are in accordance with ANSI/IEEE
standard 91-1984. This standard has been adopted by private industry and the mil-
itary for use in the internal documentation as well as published literature.
Note:
1. AND, OR, NOT gates are called Basic Gates.
2. NAND and NOR gates are called universal gates, because by using only
NAND gates or by using only NOR gates, we can realise any logic gate or
any basic logic circuit.
3. Special gates are EXCLUSIVE-OR (XOR) & EXCLUSIVE-NOR (X-NOR)
gate.
0 (Low)
Low 1
For example, the truth table for AND gate for both the logics is given below.
Truth table for positive Truth table for negative
logic AND gate logic AND gate
Note: By looking at the Tables 4.3 and 4.4, it can be concluded that negative logic
AND gate is same as positive logic OR gate.
Symbol
A F
Input waveform
Output waveform
Logic expression
If A is input, then output,
F = A0
Symbol
A F
B
F
t
Logic expression
For a 2-input AND gate having inputs A & B, the output, F is given
F = A.B
Similarly for 3 input AND gate with inputs A, B, & C the output is given as
F = A.B.C
4.5 OR Gate
The OR gate may have two or more inputs, but has only a single output.
The OR gate produces a HIGH output, when any of its input is HIGH. The
output is low when, all the inputs are LOW.
Symbol
A F
B
A
B
F
t
Logic expression
For a 2-input OR gate having inputs A & B, output F is given by
F =A+B
Similarly for 3-input OR gate with inputs A, B, & C, the output is given as
F =A+B+C
Symbol
A F A F
B B
Logic expression
F = A.B
Similarly for 3-input NAND gate with inputs A, B, & C, the output is given as
F = A.B.C
Note: NAND gate are called universal gate as any logic circuit realisation is pos-
sible by using NAND gate alone and any logic gate can also be realised in
terms of NAND gate.
Symbol
A F A F
B B
B
F
t
Logic expression
For 2-input NOR gate having inputs A & B, output F is given by
F =A+B
Similarly for 3-input OR gate with inputs A, B, & C, the output is given as
F =A+B+C
Note: NOR gate is called universal gate as any logic circuit realisation is possible
by using NOR gate alone and any logic gate can also be realised in terms of
NOR gate.
Symbol
A F
B
B
F
t
Logic expression
For 2-input XOR gate having inputs A & B, output F is given by
FACT:
1. XOR gate is also called stair
F = A B = AB + AB
case switch.
Symbol of XOR 2. It is mostly used in parity gen-
eration and detection.
Note: When one of the inputs of 2 input XOR gate is at logic 0 then, the XOR
gate acts as a buffer circuit for the other input.
2 Concept: The XOR gate gives logic 1 output for odd numbers of logic 1 inputs.
4.10 Digital Electronics, an easy approach to learn
For example,
Symbol
A The bubble on the output of the
F XNOR symbol indicates that its
B output is complement of XOR
gate.
Symbol
F
A
Truth table
A F
0 0
1 1
F A 1 F A
F
NOT A F=A 0 1
1 0
A B F
A
F 0 0 0
A F &
AND B F = A.B 0 1 0
B 1 0 0
1 1 1
A B F
A 0 0 0
A F F
OR B B 1 F = A+B 0 1 1
1 0 1
1 1 1
A B F
A 0 0 1
A F F
NAND B & F = A.B 0 1 1
B
1 0 1
1 1 0
A B F
A 0 0 1
A F F
NOR B B 1 F = A+B 0 1 0
1 0 0
1 1 0
A B F
A
F 0 0 0
A F =1
XOR B F=AB 0 1 1
B
1 0 1
1 1 0
A B F
A 0 0 1
A F F
XNOR B =1 F=AB 0 1 0
B
1 0 0
1 1 1
A F F A
BUFFER A F 1 F=A 0 0
GATE
1 1
F1=AB F2=AB
F2 = A B F1 = A B
A F A F
B B
F1 = A B F1 = A B
F2 = F1 = A B F2 = F1 = A B
=A B =AB
I Solution
L.H.S, A B = AB + AB
Let B=x
So, A B = Ax + A x
=Ax
=AB
= R.H.S (Hence Proved)
2. (A + B)(AB) = A B
Logic Gates 4.13
I Solution
1. Proof:
L.H.S, AB + A + B = AB + A B (De Morgans law)
= A B = R.H.S (Hence Proved)
2. Proof:
L.H.S, (A + B)(AB) = (A + B)(A + B) (De Morgans law)
= AA + AB + BA + BB
= AB + A B
=AB
= R.H.S (Hence Proved)
Example 4.3 Show the output waveforms for the 2-input AND, OR, NAND,
NOR, XNOR gate, if the inputs are given as,
A
B
AND
OR
NAND
NOR
XOR
XNOR
Example 4.4 Show the output waveforms for the 2-input AND, OR, NAND,
NOR, XNOR gate, if the inputs are given as,
4.14 Digital Electronics, an easy approach to learn
AND 0
OR
NAND 1
NOR
XOR
XNOR
4.11 IC Gates
1 14 Vcc
2 13
3 IC 12
74LS08
4 11
10
5
6 9
8
GND 7
Practically logic gates are available in the forms of ICs (integrated circuits).
One IC may contain one or more than one number of gates. The kind of gates
that an IC contains is determined by an IC number written on the top of the IC.
For example,
74LS08 represents 2-input AND gate IC having 14 number of pins, and con-
tains 4 number of AND gate in a single chip.
IC number contain different information about the IC as shown below,
74 LS 08
The table given below shows the IC numbers with their corresponding gates,
one can easily identify which IC contains what types of gate.
Table 4.12 Representation of IC number and corresponding gates
Sl. No IC number Types of gates
1 7400 Quad 2 input NAND
2 7402 Quad 2 input NOR
3 7404 Hex inverter
4 7408 Quad 2 input AND
5 7410 Triple 3 input NAND
6 7411 Triple 3 input AND
7 7420 Dual 4 input NAND
8 7421 Dual 4 input AND
9 7432 Quad 2 input OR
10 7486 Quad 2 input XOR
14 13 12 11 10 9 8 14 13 12 11 10 9 8
1 2 3 4 5 6 7 1 2 3 4 5 6 7
GND GND
Fig.4.24 7400 Quad 2 input NAND Fig.4.25 7402 Quad 2 input NOR
4.16 Digital Electronics, an easy approach to learn
VCC VCC
14 13 12 11 10 9 8 14 13 12 11 10 9 8
1 2 3 4 5 6 7 1 2 3 4 5 6 7
GND GND
VCC VCC
14 13 12 11 10 9 8 14 13 12 11 10 9 8
1 2 3 4 5 6 7 1 2 3 4 5 6 7
GND GND
I Solution
There is neither parenthesis nor NOT operation. So, we 1st perform AND opera-
tion and then OR operation.
Logic Gates 4.17
A
B AB+BC+AC
C
I Solution
In the given expression, there are two sum terms which can be implemented using
two input OR gates and their outputs are AND operated by a 2 input AND gate.
A NOT gate is used to invert the input D.
A
(A+B)(B+D)
B
I Solution
In the given logic expression there are two sum terms and two product terms
which is implemented using two OR and two AND gates. As the result needs to
be inverted, we use an inverter for that purpose.
A
AB+(B+C)D
B
C
D
A
B o/p=sum of
product
C Level 2
D
Level 1
Output
A F A F
=
B B
F = A + B = AB F = AB = A + B
A F A F
=
B B
F = A.B F = (AB) = AB
F=A+B F = (A +B) = A + B
A A
=
C
D
Step-1: Convert the OR gate into NAND by giving bubbles at its input terminals.
Step-2: Give a bubble to each of the outputs of AND gates to convert it into
NAND.
4.20 Digital Electronics, an easy approach to learn
A
B
NAND
C NAND
D
NAND
Step-3: Here all the four bubbles introduced in the logic network cancels out each
other so, there is no need of putting additional bubbles.
A
B
C
D
A
B
F
C
D
Step-1: Convert the OR gate into NAND by giving bubbles at its input terminals.
Step-2: Give a bubble to the output of AND gate to convert it into NAND.
A
B
NAND F
C NAND
D
NAND
A
B
NAND F
C NAND
D
NAND
F
C
D
C
D
A
B
NOR F
C NOR
D
NOR
A
B
F
C
D
Step-1: Convert the OR gate to NOR gate by giving bubbles at each of its output.
Step-2: Convert the AND gate to NOR gate by giving a bubble at its inputs.
A
B
F
C
D
Step 3: For each bubble we need one inverter to cancel out the inversion effect of
the bubble in the logic circuit.
A
B
NOR F
C NOR
D
B
F
C
F = B(A + CD) + AC
as,
4.24 Digital Electronics, an easy approach to learn
F = B(A + CD) + AC
B
C
D
A F
A
C
C
D
A F
A
C
C
D F = B(A+CD)+AC
A
A
C
F = B(A + CD) + AC
C
D
A F
A
C
Step-2: Convert each OR gate into NOR gate by giving bubble to its output,
and convert each AND gate to NOR gate, by giving bubble to its input.
C
D
F
A
A
C
F = B(A+CD)+AC
D
E
D
E NAND
A
B
C F
D
E
D
E
Step-2: Convert each OR gate into NOR gate by giving bubble to its output,
and convert each AND gate into NOR gate, by giving bubble to its input.
Step-3: Place the additional bubble (if required) to cancel the effect of
bubble placed in step-2.
NOR
A NOR
B
F
C
D NOR
E
NOR
A
B
C
F
D
E
Each small square block represents NOR gates with shorted inputs.
The above implementation is the required NOR-NOR implementation.
Inhibitive inputs
For a particular input, if the output of a logic gate does not depend on that partic-
ular input, the gate is said to be inhibitive to that particular input.
For example,
AND gate is inhibitive to logic 1.
Logic Gates 4.29
A
A
1
A
A
1
A
A
A A
A AB
B AB.CD
C
D CD
A A+B
B (A+B) + (C+D)
C
D
C+D
1. The wired AND logic can be implemented when the outputs of the NAND
gates are tied together.
2. The wired OR logic can be implemented when the outputs of the NOR gates
are tied together.
Example 4.10 Realise the 2-input XOR gate using NAND gates only.
I Solution
Let the two inputs be A and B.
output, F = A B = AB + AB
Step-1: Implement the function using basic gates
A
B
F
A
B
NAND
A
B
Each small square block represents NAND gates with shorted inputs.
A
B
F
A
B
Here 5 NAND gates are used, but the XOR gate can also be implemented
using 4 numbers of NAND gates which is more efficient.
A
A.A.B = A+AB = A+B
A AB F = (A+B)(B+A)
B = (A+B)+(B+A)
= AB + AB
=AB
B B.B.B = B+AB = B+A
Example 4.11 Realise the 2-input XNOR gate using NAND gates only.
I Solution
Let the two inputs be A and B.
output, F = A B = A B + AB
Step-1: Implement the function using basic gates
A
B
F
A
B
Step-2: Convert each AND gate to NAND gate by placing bubbles at its output,
and convert each OR gate to NAND gate by placing bubble at its input.
4.32 Digital Electronics, an easy approach to learn
A
B
F
A NAND
B
A
B
F
A
B
The XNOR gate can also be realised by putting an inverter at the output of
XOR gate. Hence in Fig.4.47(d) by putting an additional NOT gate (shorted input
NAND) we can get XNOR gate.
A
A.A.B = A+AB = A+B
F = (A+B)(B+A)
A AB F = (A+B)(A+B)
B
= AB + AB
=A B
B B.B.B = B+AB = B+A
Example 4.12 Realise the 2-input XOR gate using NOR gates only.
I Solution
Let the two inputs be A and B.
output, F = A B = AB + AB
Step-1: Implement the function using basic gates
A
B
F
A
B
Step-2: Convert each AND gate to NOR gate by placing bubbles at its inputs, and
convert each OR gate to NOR gate by placing bubble at its output. Also place
additional bubbles (if required) to cancel the inversion effect.
NOR
A
B F
A NOR
B
NOR
A
B
Example 4.13 Realise the 2-input XNOR gate using NOR gates only.
I Solution
Let the two inputs be A and B.
output, F = A B = A B + AB
Step-1: Implement the function using basic gates
A
B
F
A
B
NOR
A
B F
A NOR
B
NOR
Each small square block represents NOR gates with shorted inputs.
A
B
Example 4.14 Use minimum number of NOR gate to implement XOR and
XNOR logic.
I Solution
Implementation of XNOR gate:
A A+(A+B) = A.(A+B)
= AB
A A+B AB + AB
=AeB
B
B (B+A+B) = B.(A+B)
= AB
B (B+A+B) = B.(A+B)
= AB
Example 4.15 How many NAND gates are required to design an OR gate and a
NOR gate.
I Solution
OR gate implementation:
So, four number of NAND gates are required to implement the NOR gate.
Example 4.16 How many NAND gates are required to implement the Boolean
function,
F = AB + BC + AC
I Solution
F = AB + BC + AC
Step-1: Implement the above function using basic gates.
A
B
B
C F
A
C
NAND
A
C
B
C F
A
C
Example 4.17 How many NAND gates are required to implement the Boolean
function,
F (A, B, C, D) = A(CD + B) + BC
I Solution
F (A, B, C, D) = A(CD + B) + BC
Step-1: Implement the above function using basic gates.
C
D
B
F
A
B
C
C
D
B
A F
C
B
Example 4.18 What is the minimum number of NAND gates required to imple-
ment the function
F = A + AB + ABC
I Solution
F = A + AB + A B C
= A(1 + B) + ABC
= A + ABC ( 1 + B = 1)
= A(1 + BC) ( 1 + BC = 1)
=A
Hence, no gate is required.
Example 4.19 What is the minimum number of 2 input NOR gates required to
implement the function
X
F (A, B, C, D) = m(0, 1, 2, 3, 8, 9, 10, 11)
I Solution
To implement a function using NOR gate we prefer POS(product of sum) form,
So, we first convert the given min term to corresponding max term as,
Y
F (A, B, C, D) = M (4, 5, 6, 7, 12, 13, 14, 15)
Drawing the K-map,
CD
00 01 11 10
AB
00 0 1 3 2
01 0 0 0 0
4 5 7 6
11 0 12 0 0 0
13 15 14
10 8 9 11 10
Fig. 4.55(b) Implementation of the given function using only NOR gate
Logic Gates 4.39
A AB AB+C
B
C = A+B+C
A A+B+C
B
C
Brain teasers
P
1. F (A, B, C) = m(1, 2, 3, 4, 5, 7). Assuming inverting inputs are al-
lowed, find out
(i) Minimum number of two input NAND gates that are required
(ii) Minimum number of NOR gates that are required
I Solution
P
(i) F (A, B, C) = m(1, 2, 3, 4, 5, 7)
To represent the above function in NAND-NAND realisation, we should
write the above function using SOP form.
Since, it is required to use minimum number of NAND gates we go
for K-map minimisation
NAND NAND
A NAND
B F
C
A
B
NAND
A
B F
C
A
B
L1
BC
A 00 01 11 10
0 0 0 1 3 2
1 0 6 L:2
4 5 7
L1 (A + B + C)
L2 (A + B + C)
F (A, B, C) = (A + B + C)(A + B + C)
Representing the above reduced expression using basic gates, we get,
4.42 Digital Electronics, an easy approach to learn
A
B
F
C
A
B
Convert each AND gate to NOR gate by placing bubbles at its inputs,
and convert each OR gate to NOR gate by placing bubble at its output.
Also, place additional bubbles (if required) to cancel the inversion
effect.
NOR
A
B
F
C
A NOR
B NOR
A
B
F
C
A
B
2. Simplify the given logic circuit and represent it using a NAND gate, assum-
ing inverted inputs are available.
I Solution
The logic circuit given above can be simplified as,
F = F = A + B + C = A.B.C
So, the simplified NAND representation is,
3. Assuming that both the inverted and non-inverted inputs are available, find
out the minimum number of two input NOR gates required to implement a
two input XOR gate.
I Solution
A two input XOR gate needs to be implemented. So for NOR implementa-
tion we will go for POS form.
From truth table
Input Output
A B F=(AB)
0 0 0
0 1 1
1 0 1
1 1 0
X
F =AB = m(1, 2)
Y
= M (0, 3) (K-map minimisation)
= (A + B)(A + B)
4.44 Digital Electronics, an easy approach to learn
A
B
A NOR
B
A
B
F
A
B
4.
I Solution
Level 1 gives x x = 0
Level 2 gives x 0 = x
Now F = x x = 0
F =0
I Solution
I Solution
We know that,
In even parity for even number of 1s in input, we get output as 0
So for 3-bit, parity generator, the truth table can be drawn as,
Table 4.13 Truth table of parity generator
A B C Pe
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
Pe = A BC + A B C + A B C + ABC
= A(B C + B C) + A(B C + BC)
(Let X = BC + BC = B C)
= AX + AX
=AX
Pe = A B C
Pe Even parity generated bit. For each XOR operation we need four
NAND gates. So total number of NAND gates required for a 3-bit even
parity generation = 4 + 4 = 8.
Notes:
XOR operation is used for even parity generation.
XNOR operation is used for odd parity generation.
For 4-bit even parity checker, we need to check four bits by using XOR
operation (In a similar way as that of parity generation)
Pc = P e A B C
Pc Parity checker
Logic Gates 4.47
I Solution
We know that for TTL circuit when the inputs are floating for AND gate we
take the inputs as 1.
So,
A AB
B Y
1
Y = (AB + 1)
=1
Y =0
I Solution
1X=X
1 1X=1
Y
1X =X
X X =1
Objective Questions
1. If a 3-input NOR gate has eight input possibilities, how many of those pos-
sibilities will result in a HIGH output?
A. 1 B. 2 C. 7 D. 8
2. The output of an AND gate with three inputs, A, B, and C is HIGH, when
.
A. A = 1, B = 1, C = 0 C. A = 1, B = 1, C = 1
B. A = 0, B = 0, C = 0 D. A = 1, B = 0, C = 1
A. A = 0, B = 0, C = 0 C. A = 0, B = 1, C = 1
B. A = 0, B = 0, C = 1 D. all of the above
Logic Gates 4.49
A. X = AB C. X = A + B + C
B. X = ABC D. X = AB + C
6. What are the pin numbers of the outputs of the gates in a 7432 IC?
A. 3, 6, 10 and 13 C. 3, 6, 8 and 11
B. 1, 4, 10 and 13 D. 1, 4, 8 and 11
7. How many inputs of a four-input AND gate must be HIGH in order for the
output of the logic gate to go HIGH?
8. If the output of a three-input AND gate must be a logic LOW, what must
the condition of the inputs be?
A. 7400 has two four-input NAND gates; 7411 has three three-input
AND gates
B. 7400 has four two-input NAND gates; 7411 has three three-input
AND gates
C. 7400 has two four-input AND gates; 7411 has three three-input NAND
gates
D. 7400 has four two-input AND gates; 7411 has three three-input NAND
gates
12. How many input combinations would a truth table have for a six-input AND
gate?
A. 32 B. 48 C. 64 D. 128
13. What is the circuit number of the IC that contains four two-input AND gates
in standard TTL?
16. The 8-input XOR circuit shown has an output of Y = 1. Which input com-
bination below (ordered A - H) is correct?
A. 10111100 C. 11100111
B. 10111000 D. 00011101
C C
D D
A. E C. E
A A
B B
C C
D D
B. E D. E
18. How many gates the expression X = AB(CD +EF ) would require before
a SOP implementation
A. 1 B. 2 C. 4 D. 5
X
4.52 Digital Electronics, an easy approach to learn
A. 1 B. 2 C. 3 D. 4
23. With how many NAND gates the inverter can be produced?
A. 1 B. 2 C. 3 D. 4
X
Logic Gates 4.53
25. How many 2-input NOR gates does it take to produce a 2-input NAND
gate?
A. 1 B. 2 C. 3 D. 4
1. C 2. C 3. A 4. D 5. B 6. C
7. D 8. C 9. B 10. B 11. B 12. C
13. C 14. C 15. B 16. A 17. A 18. D
19. B 20. A 21. D 22. C 23. A 24. A
25. D 26. C
Exercises
4.1 A pulse is applied to each input of a 2-input NAND gate. One pulse goes
HIGH at t = 0 and goes back LOW at t = 1ms. The other pulse goes HIGH at
t = 0.8ms and goes back LOW at t = 3ms. The output pulse can be described
as follows
Fig. 4.65
4.3 Determine the output waveforms for a four input AND and four input XOR
gate, when the input waveforms are as shown below.
A
B
Fig. 4.66
1) AND-OR 3) OR-NOR
2) OR-AND 4) NAND-OR
1) A
B
F
A
B
Fig. 4.67(a)
2) A
A
F
B
B
Fig. 4.67(b)
1) A
B
C Y
D
E
F
Fig. 4.68(a)
2) A
B
F
A
B
Fig. 4.68(b)
Table 4.14
A B C F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
4.2
XOR
4.3
A
B
C
D
logic 0
AND
XOR
4.4
A
B F(A,B,C,D)
C
B
D
4.5 1)
Logic Gates 4.57
A
B
F
C
D
2)
4.6 1)
B
C F
A
A
C
2)
A F
B
C
A
C
4.8 i) A + B
ii) 0
4.10 F = A B C
A
B