Chapter Five
Basic Gates and Boolean Logic
CSC-103 1
Outcome of this chapter
⚫ Knowledge about logic gates, their expression, input
and output.
⚫ Know how to draw circuits for Boolean expression.
⚫ Know how to express a circuit through Boolean
expression.
CSC-103 2
Boolean Algebra
❖ Boolean algebra is the mathematics of Boolean logic,
where statements are evaluated to be either true or
false.
❖ It is extremely important in computer sciences, such
as programming, database querying and computer
engineering, as electrical signals at the most basic
level are translated to and from binary (true/false,
1/0, on/off, closed/open, etc).
CSC-103 3
Logic Gate
⚫ A logic gate is an elementary building block of a digital
circuit.
⚫ A Logic Gate in an electronic sense makes a ‘logical’
decision based upon a set of rules, and if the
appropriate conditions are met then the gate is opened
and an output signal is produced.
⚫ Most logic gates have two inputs and one output.
⚫ At any given moment, every terminal is in one of the
two binary conditions low (0) or high (1), represented
by different voltage levels.
CSC-103 4
Truth Table
⚫ A truth table shows how a
Inputs Output
logic circuit's output responds
A
to various combinations of the B Q
inputs, using logic 1 for true 0
0
0
and logic 0 for false. 1
0 0
⚫ All permutations of the inputs 0
are listed on the left, and the 1 0
output of the circuit is listed 1
1
1
on the right.
⚫ The desired output can be
achieved by a combination of
logic gates.
CSC-103 5
Logic Gates
❖ Fundamental Logic Gates:
⚫ AND gate
⚫ OR gate
⚫ NOT gate
❖ Universal Logic Gates:
⚫ NAND gate
⚫ NOR gate
❖ Special Logic Gates:
⚫ XNOR gate
⚫ XOR gate
CSC-103 6
The AND gate
2 input AND gate: 3 input AND gate:
A A
Q Q
B
B
C
Symbol for a 2 input Symbol for a 3 input
AND gate AND gate
Inputs Output Inputs Output
C B A Q
B A Q 0 0 0 0
0 0 0 1 0
0 0 0 1 0 0
0 1 0 0 1 1 0
1 0 0 0
1 0 0 1 0 1 0
1 1 1 1 1 0 0
1 1 1 1
The truth table for the 2
The truth table for the 3
input AND gate
input AND gate
Q=A.B
Q=A.B.C
Boolean expression for a 2
Boolean expression for a 3
input AND gate
CSC-103
input AND gate 7
The OR gate
2 input OR gate: 3 input OR gate:
Symbol for a 2 input Symbol for a 3 input
OR gate OR gate
Inputs Output Inputs Output
C B A Q
B A Q 0 0 0 0
0 0 0 1 1
0 0 0 1 0 1
0 1 1 0 1 1 1
1 0 0 1
1 0 1 1 0 1 1
1 1 1 1 1 0 1
1 1 1 1
The truth table for the 2 The truth table for the 3
input OR gate input OR gate
Q=A+B Q=A+B+C
Boolean expression for a 2 Boolean expression for a 3
input OR gate input OR gate 8
CSC-103
The NOT gate
This is the simplest form of logic
Symbol for a NOT gate :
gate and has only 1 input and 1
output.
Truth Table for NOT gate
Input Output
A Q
0 1
1 0
The truth table for the 2
input OR gate
A = A’
Boolean expression for NOT
gate
CSC-103 9
The NAND gate
2 input NAND gate: 3 input NAND gate:
A A
Q B Q
B
C
Symbol for a 2 input Symbol for a 3 input
NAND gate NAND gate
Inputs Output Inputs Output
C B A Q
B A Q 0 0 0 1
0 0 0 1 1
0 1
0 1 0 1
0 1 1 0 1 1 1
1 0 0 1
1 0 1 1 0 1 1
1 1 0 1 1 0 1
1 1 1 0
The truth table for the 2 The truth table for the 3
input NAND gate input NAND gate
Q=A.B Q=A.B.C
Boolean expression for a 2 Boolean expression for a 3
input NAND gate input NAND gate 10
CSC-103
The NOR gate
2 input NOR gate: 3 input NOR gate:
A
Q A
B B Q
C
Symbol for a 2 input Symbol for a 3 input
NOR gate NOR gate
Inputs Output Inputs Output
C B A Q
B A Q 0 0 0 1
0 0 0 1 0
0 1
0 1 0 0
0 1 0 0 1 1 0
1 0 0 0
1 0 0 1 0 1 0
1 1 0 1 1 0 0
1 1 1 0
The truth table for the 2 The truth table for the 3
input NOR gate input NOR gate
Q=A+B Q=A+B+C
Boolean expression for a 2 Boolean expression for a 3
input NOR gate input NOR gate 11
CSC-103
The EXOR gate
2 input EXOR gate:
A
Q
B
Symbol for a 2 input
EXOR gate
Inputs Output
B A Q
0 0 0
0 1 1
1 0 1
1 1 0
The truth table for the 2 Boolean expression for a 2
input EXOR gate input EXOR gate
CSC-103 12
The XNOR gate
2 input XNOR gate:
A
Q
B
Symbol for a 2 input
XNOR gate
Inputs Output
B A Q
0 0 1
0 1 0
1 0 0
1 1 1
The truth table for the 2 Boolean expression for a 2
input XNOR gate input XNOR gate
CSC-103 13
Universal Logic Gates
⚫ NAND and NOR gates are referred to as universal gates as
the three basic gates can be constructed using either one of
the two.
⚫ This therefore implies that all logic circuits can be
constructed using either of the gates.
⚫ NAND and NOR gates are economical and easier to
implement.
CSC-103 14
Implementation of other gates using
Universal Logic Gates
Basic Gates Using NOR Gate Basic Gates Using NAND Gate
CSC-103 15
Exercise - 1.1
1. Look at the following logic symbols labeled A – G.
i. Which is the correct symbol for an AND gate. ……………
ii. Which is the correct symbol for a NOT gate. ……………
iii. Which is the correct symbol for a NOR gate. ……………
iv. Which is the correct symbol for an EXOR gate. ……………
v. Which is the correct symbol for a NAND gate. ……………
vi. Which is the correct symbol for an XNOR gate. ……………
vii. Which is the correct symbol for an OR gate. ……………
CSC-103 16
Exercise - 1.1 (Cont…)
2. Complete the following truth tables.
i. AND gate. ii. NOR gate. iii. XNOR gate.
Inputs Output Inputs Output Inputs Output
B A Q B A Q B A Q
0 0 0 0 0 0
0 1 0 1 0 1
1 0 1 0 1 0
1 1 1 1 1 1
iv. NAND gate. v. OR gate.
Inputs Output Inputs Output
B A Q B A Q
0 0 0 0
0 1 0 1
1 0 1 0
1 1 1 1
CSC-103 17
Exercise - 1.1 (Cont…)
3. The Boolean equations labeled 1 – 9, below are to be used to answer the
following questions.
1. 5. 9.
2. 6.
3. 7.
4. 8.
i. Which expression is correct for an AND gate.……………
ii. Which expression is correct for a NOT gate.……………
iii. Which expression is correct for a NOR gate.……………
iv. Which two expressions are correct for an EXOR gate.……… & ………
v. Which expression is correct for a NAND gate.……………
vi. Which two expressions are correct for an XNOR gate.……… & ………
vii. Which expression is correct for an OR gate.……………
CSC-103 18
Equation to Circuit
To convert a Boolean expression to a gate circuit, evaluate
the expression using standard order of operations:
1. To solve the equation start from the left to right
2. Parentheses
3. Inverse (Not Gate)
4. Multiplication (AND Gate)
5. Addition (OR Gate)
CSC-103 19
Circuit to Equation
To convert a gate circuit to a Boolean expression, label each
gate output with a Boolean sub-expression corresponding
to the gates' input signals, until a final expression is
reached at the last gate.
The Expression for above circuit is XʹY+XYʹ.
CSC-103 20
Class Practice
1. Draw the circuit diagram for the equation
i. AB + (AC)ʹ.
ii. (A+B) . (B+C)
iii. (A+B+C) . B . C
2. Write down the corresponding Boolean expression for
following circuit.
CSC-103 21
Exercise – 1.2
1. Draw the corresponding circuit and truth table for
following Boolean expression
XYZ(YZ’+ZY’)
2. Draw a logic circuit and truth table for (A + B)C.
3. Find the Boolean expression and truth table for
following circuit.
CSC-103 22
Thank You
CSC-103 23