Chapter IIa Logic Gates
Chapter IIa Logic Gates
Logic gates are electronic circuits that can be used to implement the most elementary logic expressions,
also known as Boolean expressions. The logic gate is the most basic building block of combinational
logic. There are three basic logic gates, namely the OR gate, the AND gate and the NOT gate. Other
logic gates that are derived from these basic gates are the NAND gate, the NOR gate, the EXCLUSIVE-
OR gate and the EXCLUSIVE-NOR gate. This chapter deals with logic gates and some related devices
such as buffers, drivers, etc., as regards their basic functions. The treatment of the subject matter is
mainly with the help of respective truth tables and Boolean expressions.
A
Logic
Y
System
B
(a)
A B Y
0 0 0
0 1 1
1 0 1
1 1 1
(b)
A B C Y
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
4.3.1 OR Gate
An OR gate performs an ORing operation on two or more than two logic variables. The OR operation
on two independent logic variables A and B is written as Y = A + B and reads as Y equals A OR B
and not as A plus B. An OR gate is a logic circuit with two or more inputs and one output. The output
of an OR gate is LOW only when all of its inputs are LOW. For all other possible input combinations,
the output is HIGH. This statement when interpreted for a positive logic system means the following.
The output of an OR gate is a logic ‘0’ only when all of its inputs are at logic ‘0’. For all other possible
input combinations, the output is a logic ‘1’. Figure 4.3 shows the circuit symbol and the truth table
of a two-input OR gate. The operation of a two-input OR gate is explained by the logic expression
Y = A+B (4.1)
As an illustration, if we have four logic variables and we want to know the logical output of (A +
B + C + D, then it would be the output of a four-input OR gate with A, B, C and D as its inputs.
A B Y
0 0 0
A
0 1 1
Y=A+B
B 1 0 1
1 1 1
A
B Y=A+B+C A B C Y
C 0 0 0 0
0 0 1 1
(a)
0 1 0 1
A 0 1 1 1
B 1 0 0 1
C Y=A+B+C+D
D 1 0 1 1
(b) 1 1 0 1
1 1 1 1
(c)
Figure 4.4 (a) Three-input OR gate, (b) four-input OR gate and (c) the truth table of a three-input OR gate.
Figures 4.4(a) and (b) show the circuit symbol of three-input and four-input OR gates. Figure 4.4(c)
shows the truth table of a three-input OR gate. Logic expressions explaining the functioning of three-
input and four-input OR gates are Y = A + B + C and Y = A + B + C + D.
Example 4.1
How would you hardware-implement a four-input OR gate using two-input OR gates only?
Solution
Figure 4.5(a) shows one possible arrangement of two-input OR gates that simulates a four-input OR
gate. A, B, C and D are logic inputs and Y 3 is the output. Figure 4.5(b) shows another possible
arrangement. In the case of Fig. 4.5(a), the output of OR gate 1 is Y 1 = (A + B. The second
A Y1
A 1
Y1 B
1
Y2
B 2 3 Y3
C 3 Y3 C Y2
D 2
D
(a) (b)
Example 4.2
Draw the output waveform for the OR gate and the given pulsed input waveforms of Fig. 4.6(a).
Solution
Figure 4.6(b) shows the output waveform. It can be drawn by following the truth table of the OR gate.
'1'
'0'
'1'
'0'
a b c d e f g h i j k
t (a)
'1'
'0'
a b c d e f g h i j k
(b)
A B Y
0 0 0
A 0 1 0
Y=A.B 1 0 0
B
1 1 1
(a)
(b)
Figure 4.7 Two-input AND gate.
A A B C D Y
B Y=A.B.C 0 0 0 0 0
C
0 0 0 1 0
(a) 0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
A
B Y=A.B.C.D 0 1 1 1 0
C 1 0 0 0 0
D 1 0 0 1 0
(b) 1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 1
(c)
Figure 4.8 (a) Three-input AND gate, (b) four-input AND gate and (c) the truth table of a four-input AND gate.
• for a two-input AND gate, Y = AB;
• for a three-input AND gate, Y = ABC;
• for a four-input AND gate, Y = ABCD.
If we interpret the basic definition of OR and AND gates for a negative logic system, we have an
interesting observation. We find that an OR gate in a positive logic system is an AND gate in a negative
logic system. Also, a positive AND is a negative OR.
Example 4.3
Show the logic arrangement for implementing a four-input AND gate using two-input AND gates only.
Solution
Figure 4.9 shows the hardware implementation of a four-input AND gate using two-input AND gates.
The output of AND gate 1 is Y 1 = AB The second AND gate produces an output Y 2 given by
Y 2 = Y 1C = ABC. Similarly, the output of AND gate 3 is Y = Y 2.D = ABCD and hence the
result.
Example 4.4
For the logic circuit arrangements of Figs 4.11(a) and (b), draw the output waveform.
Solution
In the case of the OR gate arrangement of Fig. 4.11(a), the output will be permanently in logic ‘1’
state as the two inputs can never be in logic ‘0’ state together owing to the presence of the inverter.
In the case of the AND gate arrangement of Fig. 4.11(b), the output will be permanently in logic ‘0’
state as the two inputs can never be in logic ‘1’ state together owing to the presence of the inverter.
A Y1
1 Y2
B 2
C 3 Y= A.B.C.D
D
Figure 4.9 Implementation of a four-input AND gate using two-input AND gates.
X Y=X
(a)
X Y
X 0 1
Y=X
1 0
(b)
Figure 4.10 (a) Circuit symbol of a NOT circuit and (b) the truth table of a NOT circuit.
(a)
(b)
Y = A ⊕ B = AB + AB (4.2)
A
Y =A + B
B
(a)
A B Y
0 0 0
0 1 1
1 0 1
1 1 0
(b)
A B C D Y
0 0 0 0 0
0 0 0 1 1
0 0 1 0 1
0 0 1 1 0
0 1 0 0 1
0 1 0 1 0
0 1 1 0 0
0 1 1 1 1
1 0 0 0 1
1 0 0 1 0
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
(c)
Figure 4.12 (a) Circuit symbol of a two-input EXCLUSIVE-OR gate, (b) the truth table of a two-input
EXCLUSIVE-OR gate and (c) the truth table of a four-input EXCLUSIVE-OR gate
Example 4.5
How do you implement three-input and four-input EX-OR logic functions with the help of two-input
EX-OR gates?
Solution
Figures 4.13(a) and (b) show the implementation of a three-input EX-OR logic function and a four-input
EX-OR logic function using two-input logic gates:
• For Fig. 4.13(a), the output Y 1 is given by A ⊕ B. The final output Y is given by Y = Y 1 ⊕ C =
A ⊕ B ⊕ C = A ⊕ B ⊕ C.
• Figure 4.13(b) can be explained on similar lines.
A
Y1
B Y
C
(a)
A
Y1
Y2
B
C Y
D
(b)
Figure 4.13 (a) Three-input EX-OR gate and (b) a four-input EX-OR gate.
Example 4.6
How can you implement a NOT circuit using a two-input EX-OR gate?
Solution
Refer to the truth table of a two-input EX-OR gate reproduced in Fig. 4.14(a). It is clear from the truth
table that, if one of the inputs of the gate is permanently tied to logic ‘1’ level, then the other input
and output perform the function of a NOT circuit. Figure 4.14(b) shows the implementation.
A B Y
0 0 0
0 1 1
1 0 1
1 1 0
(a)
'1'
Output
Input
(b)
Y = AB (4.3)
In general, the Boolean expression for a NAND gate with more than two inputs can be written as
Y = ABCD (4.4)
Y = A + B (4.5)
(a)
A
Y=A.B
B
(b)
A B Y
0 0 1
0 1 1
1 0 1
1 1 0
(c)
Figure 4.15 (a) Two-input NAND implementation using an AND gate and a NOT circuit, (b) the circuit symbol
of a two-input NAND gate and (c) the truth table of a two-input NAND gate.
A A
Y Y=A+B
B B
(a) (b)
A B Y
0 0 1
0 1 0
1 0 0
1 1 0
(c)
Figure 4.16 (a) Two-input NOR implementation using an OR gate and a NOT circuit, (b) the circuit symbol of
a two-input NOR gate and (c) the truth table of a two-input NOR gate.
In general, the Boolean expression for a NOR gate with more than two inputs can be written as
Y = A + B + C + D (4.6)
A
Y =A + B
B
(a)
A B Y
0 0 1
0 1 0
1 0 0
1 1 1
(b)
Figure 4.17 (a) Circuit symbol of a two-input EXCLUSIVE-NOR gate and (b) the truth table of a two-input
EXCLUSIVE-NOR gate.
The output of a two-input EX-NOR gate is a logic ‘1’ when the inputs are like and a logic ‘0’
when they are unlike. In general, the output of a multiple-input EX-NOR logic function is a logic
‘0’ when the number of 1s in the input sequence is odd and a logic ‘1’ when the number of 1s in the
input sequence is even including zero. That is, an all 0s input sequence also produces a logic ‘1’ at
the output.
'1' '0'
I/P