Professional Documents
Culture Documents
Syllabus Content:
1. Security aspects:
use logic gates to create electronic circuits
understand and define the functions of NOT, AND, OR, NAND, NOR and XOR (EOR) gates,
including the binary output produced from all the possible binary inputs (all gates, except
the NOT gate, will have 2 inputs only)
draw truth tables and recognize a logic gate from its truth table
recognize and use the following standard symbols used to represent logic gates:
produce a logic circuit to solve a given problem or to implement a given written logic
statement
Page #56
3 Logic gates and logic circuits
Introduction:
The functions and roles of logic gates, logic circuits and truth tables will be considered.
A number of possible applications of logic circuits will also be considered in this chapter.
Logic gates take binary inputs (0s or 1s only) and produce a binary output (0s or 1s only).
Electronic circuits in computers, many new memories and controlling devices are made
up of thousands of logic gates.
Logic circuit:
Truth table:
The checking of the output from a logic gate or logic circuit is done using a truth table.
57
Inputs of logic gates/logic circuits:
Naming of inputs/output:
Starting inputs are usually named/called letters “A”, “B” or “C” (though other alphabets
are used too).
The output is usually named/called the letter “X”.
A single input:
Input
A
0
1
Two inputs:
Input
A B
0 0
0 1
1 0
1 1
58
Three inputs:
Input
A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
59
Labeling of diagrams of logic gates/circuits:
Output
Input 1
A X
Input 1
Output
A
X
B
Input 2
60
Consider the following statement:
X = 1 if (A is 1 AND B is NOT 1)
61
Logic gates:
1) NOT gate:
i) Symbol:
ii) Representation:
iii) Description:
Input Output
A X
0 1
1 0
62
2) AND gate:
i) Symbol:
ii) Representation:
iii) Description:
Inputs Output
A B X
0 0 0
0 1 0
1 0 0
1 1 1
63
3) NAND gate (NOT AND):
i) Symbol:
ii) Representation:
iii) Description:
Inputs Output
A B X
0 0 1
0 1 1
1 0 1
1 1 0
64
4) OR gate:
i) Symbol:
ii) Representation:
Logic notation: X = A OR B
Boolean algebra: X = a + b
iii) Description:
Inputs Output
A B X
0 0 0
0 1 1
1 0 1
1 1 1
65
5) NOR gate (NOT OR):
i) Symbol:
ii) Representation:
iii) Description:
Inputs Output
A B X
0 0 1
0 1 0
1 0 0
1 1 0
66
6) XOR gate:
i) Symbol:
ii) Representation:
iii) Description:
Inputs Output
A B X
0 0 0
0 1 1
1 0 1
1 1 0
67
A number of different types of examples have been discussed on the following
pages to clear your concepts about:
1. drawing a logic circuit from a given simple logic statement along with its truth table.
2. drawing a logic circuit from a given complex/difficult logic statement along with its truth
table.
3. drawing a logic circuit from a given table about data of inputs, binary values and conditions
along with its truth table.
4. how to deduce either a logic statement or Boolean algebra notation from a given logic
circuit.
5. drawing NOT, AND, OR, NOR and XOR logic gates using NAND gates only and checking
the output through truth table.
6. drawing any logic circuit using NAND gates only and checking the output through truth
table.
7. simplifying a logic circuit and checking the output through truth table.
68
Example 1
X = 1 if (A = 1 AND B = 1) OR (B = NOT 1 AND C = 1)
1 2 33
1 2
(A = 1 AND B = 1) OR (B = NOT 1 AND C = 1)
1 2
2
B
X X
3
3
2
3
C
If you have to draw a truth table only then label all the logic gates with either
alphabets or numbers (as done above) otherwise if the logic circuit is to be only drawn,
then do not number them at all.
69
44 Applying AND operation 55 Applying OR operation on values of 1
on values of 2 and C to and 3 to get values of logic gate X:
get values of logic gate 3:
When you work the values out and write them together, the truth table will look
something like the following:
Values of primary
inputs
Values of the
output
Values of logic
gates in circuits
70
Example 2
Logic gate to be
used at the end for
*This logic circuit is then
output X + joining
joined with*
22 logic circuit part (1)
(A = 1 AND C = 1) NOR B = 1 and part (2)
A = 1 AND C = 1
2
2 A
Instructions:
1. Then, draw logic gate as
written in 3rd bracket.
B
2. After that, join that logic
gate with the gate (A = 1 AND C = 1) NOR B = 1)
stated in 4th bracket
along with stated input.
C
71
33
Instructions:
1. Join the logic circuit 1 with logic circuit 2 using the logic gate stated between the
brackets.
11
A 1
2 4 3
3
B
X X
3 5
C
2
2
If you have to draw a truth table only then label all the logic gates with either alphabets
or numbers (as done above) otherwise if the logic circuit is to be only drawn, then do not
number them at all.
33 Applying OR operation on
22 Applying NOT operation on values of logic gate 1 and
1 Truth table for three
1 values of A to get values of B to get values of logic
primary inputs: logic gate 1: gate 2:
72
4 5 6
1Applying AND operation 5 Applying NOR operation on 6 Applying NOR operation on
on values of A and C to values of logic gate 2 and C values of logic gate 3 and B
4
get values of logic gate 3: to get values of logic gate 4: to get values of logic gate 5:
77
Applying NAND When you work the values out and write them together, the
operation on values of truth table will look something like the following:
logic gates 4 and 5 to
get values of logic
gate X:
73
Example 3
A factory that manufactures cleaning products has a system that monitors conditions
throughout the manufacturing process.
(a) The system will sound an alarm (X) when certain conditions are detected.
The alarm (X) will sound (=1) when:
or
Draw a logic circuit to represent the alarm system in the factory. Each logic gate must
have a maximum of two inputs.
T X
[4]
74
Understanding the question:
The alarm X will only activate/sound when the conditions given will be satisfied. For the output X
to be ON and working, it is very important that the binary value of inputs written alongside
conditions must be 1 meaning ON.
However, if you look at the table of ‘inputs, values and conditions’ you will realize that for every
single input one condition produces binary value “1” and the other produces binary value “0”
The inputs with those conditions that have binary value “1” will be used as they are by simply
tracing lines from the input to the logic gate. However for inputs with conditions having binary
value “0”, a NOT gate will be compulsorily drawn and attached to that input to ensure it
complements/swaps the value and hence it becomes “1” instead of “0”.
The word used for joining the first statement and the second statement of the condition is actually
the logic gate that will be used for joining these two inputs.
i ii iii
11 The pressure >= 80% AND the temperature >= 35 C°
2
OR
i ii iii
3
The temperature < 35 C° AND the pH > 7
2 OR gate will be used to join together the logic circuit (1) and (3) and it will be the
output X.
75
Writing a logic statement:
11 22 33
(P = 1 AND T = NOT 1) OR (T = 1 AND A = 1)
Logic gate to be NOT gate to be Logic gate to be used at the Logic gate to be
used for joining P used for input T end for output X + joining logic used for joining T
and NOT T inputs circuit part (1) and part (2) and A inputs
1
1
Remember the order T
of arrangement of
P
inputs:
1. A (at top) 3
3
2. T (in middle) A
3. P (at bottom)
T
76
If you have to draw a truth table only then
label all the logic gates with either
alphabets or numbers (as done on right
side) otherwise if the logic circuit is to be
only drawn, then do not number them at
all.
(b) Complete the truth table for the given logic problem.
[4]
22 3
Applying NOT operation on 3 Applying AND operation
1 on values of A and T to
1 Truth table for three values of T to get values of
primary inputs: logic gate 1: get values of logic gate 2:
77
4
4 55
Applying AND operation on Applying OR operation on values of
values of logic gate 1 and P to logic gates 2 and 3 to get values of
get values of logic gate 3: logic gate X:
1 2 3
78
How to deduce either a logic statement or Boolean algebra notation from a
given logic circuit:
Since the logic circuits given have 3 inputs only, we will divide the circuit into three portions. Let’s
consider the 3 inputs as A, B and C (going from top to bottom) and the output as X.
We will keenly look at the logic circuit and observe all the logic gates firstly.
The portion 1 will focus on the initial logic gate formed by joining the first input A (topmost) with
either the second B or third C inputs.
The portion 2 will be the logic circuit/logic gates left behind after the identification of portion 1.
The portion 3 will only cover the output logic gate X as it joins the circuits of portion 1 and portion 2.
Then we will simply write down a logic statement or Boolean algebra notation of the logic gates
included in the logic circuit from portion 1. We will bracket this piece of writing.
Then we will write down logic statement or Boolean algebra notation of the logic gates included in
the logic circuit from portion 1. We will bracket this piece of writing.
In the end, we will first write bracket from portion 1, then write the name of output logic gate
included in portion 3, and after that, simply writing the bracket from portion 2.
Q1. Write a logic statement which corresponds to the following logic circuit:
[3]
79
It is the first logic gate formed by It is the output logic gate X as
joining input A (topmost) with the it joins the circuits of portion 1
second input B. Hence it will be and portion 2. Hence it will be
classified as portion 1. classified as portion 3.
1
1
3
3
2
2
1
• Two inputs A and B are used.
• They are joined together by an OR gate.
2
• NOT gate is used with input C to complement its values.
• Then the NOT gate and input B are used.
• They are joined together by an OR gate.
80
Now we have two different statements that can be put into two different brackets like this:
3
The name of output logic gate that is, in this case, ‘AND’ will be placed between both
the brackets (therefore joining them)
Boolean algebra: (A + B) . (B + C)
X = 1 if (A is 1 OR B is 1) AND (B is 1 OR C is NOT 1) // OR //
X = 1 if (A = 1 OR B = 1) AND (B = 1 OR C = NOT 1)
X = (A OR B) AND (B OR NOT C)
These type of questions (asking for logic statement from a given logic circuit) are usually
asked for 3 marks only. The division of marks is following:
st
• 1 mark for the 1 bracket
nd
• 1 mark for the 2 bracket
• 1 mark for writing the name of gate used for joining them between both the brackets
Example:
• (A OR B) (1)
• AND (1)
• (B OR NOT C) (1)
81
Q2. Write a logic statement which corresponds to the following logic circuit:
1
1
33
2
2
1
• Two inputs A and B are used.
• They are joined together by an AND gate.
2
• NOT gate is used with input B to complement its values.
• Then the NOT gate and input C are used.
• They are joined together by an OR gate.
82
Now we have two different statements that can be put into two different brackets like this:
Boolean algebra: (A . B) (C + B)
3
The name of output logic gate that is, in this case, ‘AND’ will be placed between both
Boolean algebra: (A . B) . (C + B)
83
Q3. Write a logic statement to match the given logic circuit.
1
1
3
3
22
1
• Two inputs A and C are used.
• They are joined together by XOR gate.
2
• NOT gate is used with input C to complement its values.
• Then the NOT gate and input B are used.
• They are joined together by a NAND gate.
Hence the logical statement for this portion becomes: B NAND NOT C
84
Now we have two different statements that can be put into two different brackets like this:
3
The name of output logic gate that is, in this case, ‘OR’ will be placed between both the
brackets (therefore joining them)
85
There are two possible ways to review logic circuit design:
1. One method is to use logic ‘building blocks’ (NAND gates only). It is possible to build up
any logic gate, and therefore any logic circuit, by simply linking together a number of
NAND gates only.
2. Second method involves simplifying the logic circuit as far as possible. It can be done by
making truth table of the circuit and different logic gates/circuits. The output from the truth
table can be compared with an output from a single logic gate or another circuit with lower
production cost. If both outputs match, then that single logic gate or the other circuit can
be used to replace the whole circuit hence simplifying and saving cost. This can also
improve reliability and make it easier to trace faults if they occur.
These methods allow electronics companies to save the cost of components, make
production/manufacturing easy and save time.
Following NAND logic circuits can be drawn and used to replace the mentioned logic gates. This is
proven by truth tables of both the original logic gate and the circuit made up of NAND gates only.
1) NOT gate:
A2
X X
86
2) AND gate:
Circuit diagram:
Truth tables
87
3) OR gate:
Circuit diagram:
A2
1 This circuit diagram
made up of NAND
gate only can be
B2
X X used instead of OR
gate as both
produce the same
B 2 output.
Truth tables
88
4) NOR gate:
Circuit diagram:
A2
1
3 X X
B2
B 2
Truth tables
89
5) XOR gate:
Circuit diagram: This circuit diagram made up of NAND gate only can be
used instead of XOR gate as both produce the same output.
A
2
1 X X
1b
B 3
Truth tables
90
Q1. Show how the following logic circuit could be built using NAND gates only.
Also complete truth tables for both logic circuits to show that they produce identical outputs.
A
B
1
X X
C 2
Explanation:
A OR gate which
B 1 can be replaced
using two NAND
X X gates in a circuit
like this:
C 2
91
Drawing of the logic circuit:
A
1 2
B
4
replacement of AND gate
X X
C
3 5 replacement of OR gate
Truth tables
92
Q2. Show by drawing a truth table which single logic gate has the same function as the
following logic circuit made up of NAND gates only.
A
1
3 X X
B
2
Truth tables
Hence a single OR gate has the same function as the logic circuit made up of NAND gates
only as they both produce the same output.
93
Q3. Re-draw the following logic circuit using NAND gates only.
94
2) Simplifying the logic circuit:
A logic circuit can be replaced with another low cost circuit or a single logic gate if the outputs
match. Logic circuits can be simplified and components/logic gates can be reduced with the help
of simply making truth tables and comparing outputs.
Q1. Show by drawing a truth table which single logic gate has the same function as the logic
circuit drawn below:
2
1 X
Truth tables
Hence a single NOR gate has the same function as the logic circuit drawn above as they
both produce the same output.
95
May/June 2020 (12) Questions:
Q1.
96
Answer:
97