Chapter 2 Logic Gates2
Chapter 2 Logic Gates2
Logic Gates
08 Hours
18 Marks
Figure 2.1 shows a sample 2–input logic system and table 2.2 shows a
sample truth table for a 2–input logic system.
A Logic
System Y
B
1-1
2.1.1 Basic Gates
Logic gate is the most basic building block of any digital system (even for
computers). Each basic logic gate is a piece of hardware or an electronic circuit
that can be used to implement some basic logic expression. For implementing
various laws of Boolean algebra, basic gates can be used. Basic gates perform
basic logical operations on the logical inputs.
There are three basic logic gates, namely the OR gate, the AND gate and
the NOT gate.
2.1.1.1 OR gate
The OR gate performs logical OR operation on two or more inputs
(generally referred as logic variables). The OR gate has two or more inputs and
a single output. Output of an OR gate is LOW if all the inputs are LOW. In all
other cases, output of OR gate is HIGH.
The OR operation on two independent logical variables A and B can be
represented by following logic expression (sometimes also called logical
equation).
𝑌 =𝐴+𝐵
It is read as Y is equal to A OR B. The logic expression shown above is
logic expression for 2–input OR gate. Logical symbol for 2 – input OR gate is
shown in figure 2.2.
A
Y=A+B
B
A
B Y=A+B+C
C
1-3
A
Y=A.B
B
The logic expression or logical equation for 3 – input AND gate is shown
below.
𝑌 = 𝐴. 𝐵. 𝐶
Logical symbol for 3 – input AND gate is shown in figure 2.7.
A
B Y=A.B.C
C
X 𝑌 = 𝑋̅
1-5
Figure 2.9: IC pin configuration of 7404
A
Y
B
A
̅̅̅̅̅
𝑌 = 𝐴. 𝐵
B
1-6
Truth table for 2 – input NAND gate is shown in table 2.7. It can be
obtained by negating the output of AND gate.
Table 2.7: Truth table for 2 – input NAND gate
i/p o/p
A B Y
0 0 1
0 1 1
1 0 1
1 1 0
The TTL IC used for 2 – input NAND gate is 7400. It is a quad 2 – input
NAND gate. i.e. There are four 2 – input NAND gates in the IC. Pin
configuration of IC 7400 is shown in figure 2.12.
A
B 𝑌 = ̅̅̅̅̅̅̅̅̅̅̅
(𝐴. 𝐵. 𝐶)
C
1-7
Truth table for 3 – input NAND gate is shown in table 2.8. The TTL IC
used for 3 – input NAND gate is 7410. It is a triple 3 – input NAND gate. i.e.
There are three 3 – input NAND gates in the IC.
A
Y
B
A
𝑌 = ̅̅̅̅̅̅̅̅
𝐴+𝐵
B
The TTL IC used for 2 – input NOR gate is 7402. It is a quad 2 – input NOR
gate. i.e. There are four 2 – input NOR gates in the IC. Pin configuration for IC
7402 is shown in figure 2.16.
1-8
Figure 2.16: IC pin configuration for 7402
The logic expression or logical equation for 3 – input NOR gate is shown
below.
𝑌 = ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
(𝐴 + 𝐵 + 𝐶)
Logical symbol for 3 – input NOR gate is shown in figure 2.17.
A
B 𝑌 = ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
(𝐴 + 𝐵 + 𝐶)
C
A
𝑌 =𝐴⊕𝐵
B
A
𝑌 =𝐴⊕𝐵
B
A 𝑌 = 𝐴̅
1-11
A 𝑌 = 𝐴̅
A
𝑌 = 𝐴. 𝐵
B
𝑌 = 𝐴. 𝐵
𝑌 =𝐴+𝐵
1-12
A
𝑌 =𝐴+𝐵
B
𝑌 = ̅̅̅̅̅̅̅̅̅̅
(𝐴 + 𝐵)
𝑌 = ̅̅̅̅̅̅̅̅
(𝐴. 𝐵)
Example 1: Construct a logic circuit using NAND gates only for following
expression
𝑋 = 𝐴. (𝐵 + 𝐶)
1-13
A
𝑋 = 𝐴. (𝐵 + 𝐶)
Example 2: Construct a logic circuit using NOR gates only for following
expression
𝑋 = 𝐴. (𝐵 + 𝐶)
𝑋 = 𝐴. (𝐵 + 𝐶)
Questions:
1. Draw symbol, logical equation and truth table of 3 i/p AND gate and 3
i/p OR gate. [4M]
2. Draw pin configuration of TTL ICs used for AND gate and NAND gate.
[4M]
1-14
3. Draw logical symbol, truth table and logical expression of EX-OR gate.
[2M]
4. Draw symbol and truth table for EX-NOR gate. [2M]
5. Draw logical symbol, truth table and logical expression for NAND and
NOR gate. [4M]
6. Draw logical symbol, expression, truth table and IC pin configuration for 2
input NOR gate. [4M]
7. Draw the pin configuration with the internal schematic of IC 7400. [2M]
8. Draw symbol, logical equation, truth table and TTL IC used for 2 i/p EX-
OR and NOR gate. [4M]
9. Draw logic symbol and truth table of NOR gate. [2M]
10. Draw AND gate using NAND gates only and NOR gates only. [2M]
11. Implement AND, OR, NOT and NOR gate using NAND gates only. [4M]
12. Draw logical symbol, truth table and logical expression of NAND gate and
AND gate. [4M]
13. What is universal gate? Construct a logic circuit using NAND gates only
for following expression. [4M]
𝑋 = 𝐴 ∙ (𝐵 + 𝐶)
14. What are universal gates? Draw logical circuits of basic gates using
universal gates. [4M]
15. Define universal gate and design basic gates using NAND as universal
gate. [4M]
16. What is universal gate? Construct any two basic gates using NOR gate.
[4M]
17. Implement OR and AND gates by using NAND gates only. [4M]
Boolean algebra is mathematics of logic. It is one of the most basic tool for
simplifying Boolean laws. Logic variables are denoted by capital letters (e.g. A,
B, C, …). If value of 𝐴 = 0, then 𝐴̅ = 1 and if value of 𝐴 = 1, then 𝐴̅ = 0. Two
Boolean expressions are said to be equal if and only if the truth tables of them
are identical.
1-15
(𝐴. 𝐵). 𝐶 = 𝐴. (𝐵. 𝐶)
Duality property states that all Boolean expressions remain valid when
following steps are performed.
Step 1: Interchange OR operator (+) and AND operator (.)
Step 2: Replace all 1’s by 0’s and all 0’s by 1’s.
e.g. As 𝐴 + 0 = 𝐴, its dual is 𝐴. 1 = 𝐴
As (𝐴 + 𝐵̅ ). 𝐵 = 𝐴. 𝐵, its dual is 𝐴. 𝐵̅ + 𝐵 = 𝐴 + 𝐵
̅̅̅̅̅̅̅̅̅̅̅
As 𝐴. 𝐵 … 𝑁 = 𝐴̅ + 𝐵̅ + ⋯ + 𝑁 ̅, its dual is 𝐴̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
+ 𝐵 + ⋯ + 𝑁 = 𝐴̅. 𝐵̅ … 𝑁
̅
2.2.1 Proofs of Boolean laws
Any Boolean law or theorem or expression can be proved in two ways
- Using truth table
- Matching L.H.S. with R.H.S. by simplification
Example 1:
Prove that 𝐴. (𝐵 + 𝐶) = 𝐴. 𝐵 + 𝐴. 𝐶
Proof:
1 2 3 4 5 6 7 8
A B C (B+C) A.(B+C) A.B A.C A.B+A.C
0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
1-16
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1
Example 2:
Prove that 𝐴 + 𝐵. 𝐶 = (𝐴 + 𝐵). (𝐴 + 𝐶)
Proof:
1 2 3 4 5 6 7 8
A B C B.C A+B.C A+B A+C (A+B).(A+C)
0 0 0 0 0 0 0 0
0 0 1 0 0 0 1 0
0 1 0 0 0 1 0 0
0 1 1 1 1 1 1 1
1 0 0 0 1 1 1 1
1 0 1 0 1 1 1 1
1 1 0 0 1 1 1 1
1 1 1 1 1 1 1 1
Example 3:
Prove De-Morgan’s first theorem.
De-Morgan’s first theorem states that complement of product of
variables is equal to the sum of complements of the variables.
i.e. ̅̅̅̅̅̅̅̅̅̅̅
𝐴. 𝐵 … 𝑁 = 𝐴̅ + 𝐵̅ + ⋯ + 𝑁
̅
Proof:
Let’s try to prove the De-Morgan’s first theorem for three variables
as,
̅̅̅̅̅̅̅̅
𝐴. 𝐵. 𝐶 = 𝐴̅ + 𝐵̅ + 𝐶̅
1 2 3 4 5 6 7 8 9
𝐴 𝐵 𝐶 𝐴. 𝐵. 𝐶 ̅̅̅̅̅̅̅̅
𝐴. 𝐵. 𝐶 𝐴̅ 𝐵̅ 𝐶̅ 𝐴 + 𝐵̅ + 𝐶̅
̅
0 0 0 0 1 1 1 1 1
0 0 1 0 1 1 1 0 1
0 1 0 0 1 1 0 1 1
0 1 1 0 1 1 0 0 1
1 0 0 0 1 0 1 1 1
1 0 1 0 1 0 1 0 1
1 1 0 0 1 0 0 1 1
1-17
1 1 1 1 0 0 0 0 0
Example 1:
Prove that
𝑌̅𝑍̅ + 𝑊
̅ 𝑋̅𝑍̅ + 𝑊
̅ 𝑋𝑌 ̅𝑍 + 𝑊𝑌𝑍̅ = 𝑍̅
Proof:
By using law
L.H.S. = 𝑍̅ . (𝑌̅ + 𝑊
̅ 𝑋̅ + 𝑊̅ 𝑋𝑌 + 𝑊𝑌)
= 𝑍̅ . (𝑌̅ + 𝑊𝑌 + 𝑊 ̅ 𝑋̅ + 𝑊𝑌
̅̅̅̅̅ 𝑋)
= 𝑍. ((𝑌 + 𝑊𝑌) + ( 𝑊 𝑋 + ̅̅̅̅̅
̅ ̅ ̅ ̅ 𝑊𝑌𝑋))
= 𝑍̅ . ((𝑊 + 𝑌̅) + 𝑊̅ . (𝑋̅ + 𝑋𝑌)) 𝐴. 𝐵̅ + 𝐵 = 𝐴 + 𝐵
∴ 𝑊. 𝑌 + 𝑌̅ = 𝑊 + 𝑌̅
= 𝑍̅. ((𝑊 + 𝑌̅) + 𝑊
̅ . (𝑋̅ + 𝑌)) 𝐴. 𝐵̅ + 𝐵 = 𝐴 + 𝐵
∴ 𝑋. 𝑌 + 𝑋̅ = 𝑌 + 𝑋̅
= 𝑍̅. (𝑊 + 𝑌̅ + 𝑊 ̅ . 𝑋̅ + 𝑊
̅ . 𝑌)
= 𝑍̅. (𝑊 + 𝑊̅ . 𝑌 + 𝑌̅ + 𝑊 ̅ . 𝑋̅) By rearranging terms using
commutative law
= 𝑍̅. (𝑊 + 𝑌 + 𝑌̅ + 𝑊
̅ . 𝑋̅) 𝐴. 𝐵̅ + 𝐵 = 𝐴 + 𝐵
̅.𝑌 + 𝑊 = 𝑌 + 𝑊
∴𝑊
= 𝑍̅. (𝑊 + (𝑌 + 𝑌̅) + 𝑊 ̅ . 𝑋̅)
= 𝑍̅. (𝑊 + 1 + 𝑊 ̅ . 𝑋̅) 𝐴 + 𝐴̅ = 1
∴ 𝑌 + 𝑌̅ = 1
= 𝑍̅. (1 + 𝑊 + 𝑊 ̅ . 𝑋̅)
= 𝑍̅. (1) 1+𝐴=1
∴ 1+𝑊+𝑊 ̅ . 𝑋̅ = 1
= 𝑍̅ 𝐴. 1 = 𝐴
∴ 𝑍̅. 1 = 𝑍̅
= R.H.S. Hence proved
Questions:
1. State De-Morgan’s theorem. [2M]
2. State and prove De Morgan’s theorem. [4M]
3. State commutative law. [2M]
4. List different Boolean laws. Also write duality theorem. [4M]
5. State associative law and distributive law of Boolean algebra. [4M]
6. State any four Boolean laws. [2M]
7. State duality theorem and prove it. [4M]
Example 1:
Simplify 𝑌 = ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
̅̅̅̅
𝐴𝐵 + 𝐴̅ + 𝐴𝐵
By using law
Y = ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
̅̅̅̅
𝐴𝐵 + 𝐴̅ + 𝐴𝐵
= ̿̿̿̿
𝐴𝐵 . 𝐴̿. ̅̅̅̅
𝐴𝐵 By applying De-Morgan’s law
= 𝐴. 𝐵. 𝐴. ̅̅̅̅
𝐴𝐵 𝐴̿ = 𝐴
∴ ̿̿̿̿
𝐴𝐵 = 𝐴𝐵
̅̅̅̅
= 𝐴. 𝐴. 𝐵. 𝐴𝐵
̅̅̅̅
= 𝐴. 𝐵. 𝐴𝐵 𝐴. 𝐴 = 𝐴
= 𝐴. 𝐵. (𝐴̅ + 𝐵̅ ) By applying De-Morgan’s law
= 𝐴. 𝐵. 𝐴̅ + 𝐴. 𝐵. 𝐵̅
= 𝐴. 𝐴̅. 𝐵 + 𝐴. 𝐵. 𝐵̅
= 0. 𝐵 + 𝐴. 0 As, 𝐴. 𝐴̅ = 0
= 0+0 As, 𝐴. 0 = 0
=0 As, 0 + 0 = 0
Therefore, 𝑌 = 0
Example 2:
̅ + 𝐴𝐵)(𝐴 + 𝐵̅)(𝐴̅𝐵)
Simplify 𝑌 = (𝐴 + 𝐵
By using law
Y ̅ + 𝐴𝐵)(𝐴 + 𝐵
= (𝐴 + 𝐵 ̅ 𝐵)
̅ )(𝐴
= (𝐴 + 𝐴𝐵 + 𝐵̅ )(𝐴 + 𝐵̅ )(𝐴̅𝐵)
= (𝐴 + 𝐴 + 𝐵̅ )(𝐴 + 𝐵̅ )(𝐴̅𝐵 ) 𝐴. 𝐵̅ + 𝐵 = 𝐴 + 𝐵
∴ 𝐴. 𝐵 + 𝐵̅ = 𝐴 + 𝐵̅
= (𝐴 + 𝐵̅ )(𝐴 + 𝐵̅ )(𝐴̅𝐵 ) 𝐴+𝐴=𝐴
= (𝐴 + 𝐵̅ )(𝐴̅𝐵 ) 𝐴+𝐴=𝐴
∴ (𝐴 + 𝐵 (𝐴 + 𝐵̅ ) = (𝐴 + 𝐵̅ )
̅ ).
1-19
= 𝐴𝐴̅𝐵 + 𝐵̅ 𝐴̅𝐵 By distributive law
= 0. 𝐵 + 𝐵̅ 𝐴̅𝐵 𝐴. 𝐴̅ = 0
= 0. 𝐵 + 0. 𝐴̅ 𝐵. 𝐵̅ = 0
= 0+0 0. 𝐴 = 0
=0
Therefore, 𝑌 = 0
Example 3:
̅ )(𝐴̅ + 𝐵)
Simplify 𝑌 = (𝐴 + 𝐵)(𝐴 + 𝐵
By using law
̅̅̅ ̅̅̅
Y = (𝐴 + 𝐵) (𝐴 + 𝐵) (𝐴 + 𝐵)
Therefore, 𝑌 = 𝐴. 𝐵
Example 1:
Draw logical circuit for following Boolean expression using basic gates
𝑌 = 𝐴̅𝐵 + 𝐵𝐶
1-20
𝐴 𝐴̅ 𝐵 𝐶
𝑌 = 𝐴̅𝐵 + 𝐵𝐶
Example 2:
Simplify following expression and draw logic gate diagram.
̅̅̅̅ + ̅̅̅̅̅̅̅̅
𝑌 = (𝐴𝐵 𝐴 + 𝐵 )𝐴. 𝐵̅
By using law
Y ̅̅̅̅ + ̅̅̅̅̅̅̅̅
= (𝐴𝐵 𝐴 + 𝐵 )𝐴. 𝐵̅
= (𝐴̅ + 𝐵̅ + 𝐴̅. 𝐵̅ )𝐴. 𝐵̅ By using De-Morgan’s theorem
= (𝐴̅ + 𝐵̅ (1 + 𝐴̅))𝐴. 𝐵̅ By taking common
= (𝐴̅ + 𝐵̅ . 1)𝐴. 𝐵̅ 1+𝐴=1
= (𝐴̅ + 𝐵̅ )𝐴. 𝐵̅ 𝐴. 1 = 𝐴
= 𝐴̅. 𝐴. 𝐵̅ + 𝐵̅ . 𝐴. 𝐵̅ By using distributive law
= 0. 𝐵̅ + 𝐵̅ . 𝐴 𝐴. 𝐴̅ = 0 and 𝐴. 𝐴 = 𝐴
= 0 + 𝐴. 𝐵̅ 0. 𝐴 = 0
= 𝐴. 𝐵̅ 0+𝐴 = 𝐴
Therefore, 𝑌 = 𝐴. 𝐵̅
𝐵 𝐵̅ 𝐴
𝑌 = 𝐴. 𝐵̅
Questions:
1. Prove that 𝑌̅𝑍̅ + 𝑊̅ 𝑋̅𝑍̅ + 𝑊̅ 𝑋𝑌 ̅𝑍 + 𝑊𝑌𝑍̅ = 𝑍̅ [4M]
2. Prove [4M]
a. 𝐴 + 𝐴̅𝐵 + 𝐴𝐵̅ = 𝐴 + 𝐵
b. 𝐴𝐵 + 𝐴̅𝐵 + 𝐴̅𝐵̅ = 𝐴̅ + 𝐵
3. Reduce the following expression and implement using logic gates. [4M]
𝑌 = 𝐴𝐵 + 𝐴𝐵𝐶 + 𝐴𝐵(𝐸 + 𝐹)
4. Simplify the following Boolean expressions using Boolean laws. [4M]
a. 𝑌 = 𝐴(𝐴̅ + 𝐶)(𝐴̅𝐵 + 𝐶̅ )
b. 𝑌 = 𝐵𝐶̅ 𝐷̅ + 𝐴̅𝐵𝐷 + 𝐴𝐵𝐷 + 𝐵𝐶𝐷 ̅ + 𝐵̅ 𝐶𝐷 + 𝐴̅𝐵̅ 𝐶̅ 𝐷 + 𝐴𝐵̅ 𝐶̅ 𝐷
5. Simplify following expression and draw logic gate diagram. [4M]
̅̅̅̅ + 𝐴
𝑌 = (𝐴𝐵 ̅̅̅̅̅̅̅̅
+ 𝐵 )𝐴. 𝐵̅
1-21
6. Simplify following Boolean expressions. [4M]
a. 𝑌 = 𝐴𝐵 + 𝐴𝐵𝐶 + 𝐴̅𝐵 + 𝐴𝐵 ̅̅̅̅𝐶
̅ ̅
b. 𝑌 = (𝐴 + 𝐵)(𝐴 + 𝐵 )(𝐴 + 𝐵)
7. Draw logical circuit for following Boolean expressions using basic gates.
[4M]
a. 𝑌 = 𝐴̅𝐵 + 𝐵𝐶
b. 𝑌 = (𝐴 ̅̅̅̅̅̅̅̅
+ 𝐵)
8. Simplify the following expressions. [4M]
a. 𝑌 = ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
̅̅̅̅ + 𝐴̅ + 𝐴𝐵
𝐴𝐵
b. 𝑌 = (𝐴 + 𝐵̅ + 𝐴𝐵)(𝐴 + 𝐵̅ )(𝐴̅𝐵)
1-22