Lecturer: Norah Alsufyan
Basics of Logic gates -
Part 1
1
Chapter Outline
• Brief of Digital circuits
• The Meaning of Logic Gates
• How Logic Gates Are Relevant to Computers
• Representation of Gates
1.Logic diagrams
2.Truth tables
3.Boolean expressions
2
Chapter Outline
• Types of Gates
– Three Basic Gate Functions
1. NOT
2. AND
3. OR
– Additional Gate Functions
1. NAND
2. NOR
3. XOR
4. XNOR
• Gates with More Inputs
• Formula to Determine the numbers of possible inputs
• Universal Gates
1. NAND
2. NOR
3
• Conclusion
BRIEF OF DIGITAL CIRCUITS
4
5
Digital circuits
• Digital circuits requires only two voltage
level 0v and 5v.
– Zero volts (0v) represent logic “0”
– Five volts (5v) represent logic “1”
ON (1): connected to power.
OFF (0): not connected to power
6
THE MEANING OF LOGIC GATES
7
The Meaning of Logic Gates
• A gate is a device that performs a basic
operation on electrical signals.
• Gates are combined into circuits to perform
more complicated tasks.
• Logic gates are the circuits that are designed
to performed these basic logic functions.
• Actually the term logic is applied to digital
circuits used to implement logic functions.
8
The Meaning of Logic Gates
In other words, logic gates are the circuits that
take one or more inputs signals and send out a
single output signal.
9
The Meaning of Logic Gates
• In this logic gate, there are only two state which
are one is ON State(1) and another is OFF
State(0).
• ON State can be say High input and High output
and OFF State can be say Low input and Low
output.
• ON State means current is passing through the
logic circuit and OFF State means current is not
passing through the logic circuit.
10
The Meaning of Logic Gates
• Several kinds of digital logic circuits are the
basic elements that form the building blocks for
such complex digital system as the computer.
• The lines connected to each symbols are the
inputs and outputs.
• The inputs are on the left of each symbol and
the output is on the right.
• To conclude , A circuit that performs a specific
logic operation (AND, OR, Not, NOR,NAND,
XOR,NXOR) is called a logic gate. 11
HOW LOGIC GATES ARE
RELEVANT TO COMPUTERS
12
Why are these logic gates relevant to computers and
computers technology ?
• Because all computers are ultimately made
out of logic gates.
• Hundreds of millions of various logic gates ,
when working together which makes
computers function as they do.
13
REPRESENTATION OF GATES
1. Logic diagrams
2. Truth tables
3. Boolean expressions
14
Representation of Gates
• There are three different, but equally
powerful, notational methods
for describing the behavior of gates
and circuits
– Logic diagrams
– Truth tables
– Boolean expressions
15
1- Logic diagram
• Logic diagram: a graphical representation
of a circuit
– Each type of gate is represented by a specific
graphical symbol
16
2- Truth table
• Truth table: defines the function of a gate
by listing all possible input combinations
that the gate could encounter, and the
corresponding output
17
3- Boolean algebra
• Boolean algebra: expressions in this
algebraic notation are an elegant and
powerful way to demonstrate the activity of
electrical circuits
AND is denoted by a dot (.)
OR is denoted by a plus (+).
NOT is denoted by a single quote mark (')
after the variable or an overbar ( ¯ ).
XOR is denoted by
18
Note
The statement:
1 + 1 = 2 (read “one plus one equals two”) is
not the same as 1 + 1 = 1 (read “1 or 1
equals 1”).
1.1 = 1 ( read 1 AND 1 equals 1 )
19
ACTIVITY #1 - GROUP WORK
20
TYPES OF GATES
21
Types of Gates
• Let’s examine the processing of the following
seven types of gates
– NOT
– AND Three Basic Gate Functions
– OR
– XOR
– NAND
Additional Gate Functions
– NOR
– XNOR
22
Types of Gates
Three Basic Gate Functions
Using these three gates we can design any
logic circuit.
Additional Gate Functions
We will define four additional gates which aid
circuit design.
23
THREE BASIC GATE FUNCTIONS
1. NOT
2. AND
3. OR
24
NOT Gate Representation
• A NOT gate accepts one input value
and produces one output value
Figure 4.1 Various representations of a NOT gate
To illustrate how it works visually .. Check this link: https://logic.ly/lessons/
25
What NOT Gate Means
• By definition, if the input value for a NOT
gate is 0, the output value is 1, and if the
input value is 1, the output is 0
• A NOT gate is sometimes referred to as
an inverter because it inverts the input
value
26
Example of NOT Gate
e.g. I turn on the heating if it is NOT hot
if A = hot and Y = Heating on then:
YA
where the bar represents logical NOT.
27
Practical Application of “Not”
Logic Gate
28
AND Gate Representation
• An AND gate accepts two input signals
• If the two input values for an AND gate are
both 1, the output is 1; otherwise, the output
is 0
Figure 4.2 Various representations of an AND gate
To illustrate how it works visually .. Check this link: https://logic.ly/lessons/29
Example of AND gate
e.g. I get up early if I have lectures AND it is a weekday
he said if A = lecture B = weekday and Y = get up early
then he said you can write:
Y A B
where the dot represents logical AND.
Thus ,
If 1 represents TRUE and 0 represents FALSE
then the function can be defined in a truth table.
Logic Gates 30
How AND Gate Work
31
Practical Application of “AND”
Logic Gate
32
OR Gate Representation
• If the two input values are both 0, the
output value is 0; otherwise, the output is 1
Figure 4.3 Various representations of a OR gate
To illustrate how it works visually .. Check this link: https://logic.ly/lessons/33
How OR Gate Work
34
Example of OR Gate
e.g. I turn on my headlights if it is dark OR it is raining
if A = dark B = raining and Y = headlights on then:
Y A B
where the + sign represents logical OR.
35
Practical Application of “OR”
Logic Gate
36
ACTIVITY #2 - GROUP WORK
37
LAB # 1 - GROUP WORK
38
ADDITIONAL GATES FUNCTIONS
1. XOR
2. NAND
3. NOR
4. XNOR 39
What XOR Gate Means
• XOR, or exclusive OR, gate
– An XOR gate produces 0 if its two inputs are
the same, and a 1 otherwise
– Note the difference between the XOR gate
and the OR gate; they differ only in one
input situation
When both input signals are 1, the OR gate
produces a 1 and the XOR produces a 0
40
XOR Gate Representation
Figure 4.4 Various representations of an XOR gate
To illustrate how it works visually .. Check this link: https://logic.ly/lessons/41
NAND and NOR Gates
• The NAND and NOR gates are essentially the
opposite of the AND and OR gates, respectively
Figure 4.5 Various representations
of a NAND gate
Figure 4.6 Various representations
of a NOR gate
To illustrate how it works visually .. Check this link: https://logic.ly/lessons/42
How NAND Gate Work
43
How NOR Gate Work
44
XNOR
The XNOR gate is essentially the opposite of the XOR.
To illustrate how it works visually .. Check this link: https://logic.ly/lessons/45
GATES WITH MORE INPUTS
46
Gates with More Inputs
• Gates can be designed to accept three or more
input values
• A three-input AND gate, for example, produces
an output of 1 only if all input values are 1
Figure 4.7 Various representations of a three-input AND gate
To illustrate how it works visually .. Check this link: https://logic.ly/demo/47
How NAND Gate Work With
Two Input
48
ACTIVITY #3 - GROUP WORK
49
LAB # 3 - GROUP WORK
50
Explain Why there are different in the
numbers of truth table rows =)
• The truth table of NOT have two rows
(0,1)
• The truth table of AND , OR , NOR, XOR,
XNOR with two input have four rows
(00,10,01,11)
• The truth table of AND , OR , NOR, XOR,
XNOR with three input have eight rows
(000,001,010,011,100,101,110,111)
51
Formula to Determine the
numbers of possible inputs
• To determine the total number of possible
combination of binary inputs to a gate is
determined by the following formula: N=2n
Where N is the number of possible input
combinations and n is the number of input
variables.
• Example,
Two inputs variables; N=22 = 4 Combinations.
Three inputs variables; N=23 = 8 Combinations.
Four inputs variables; N=24 = 16 Combinations.
UNIVERSAL GATES
1- NAND
2- NOR
53
What Universal Gates Means
• 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.
• The notes show this process for NAND only but
it can be shown for NOR also.
54
NOT Using NANDs Only
• The Truth Table is for a NAND gate
A B Y • If we tie the inputs of a NAND together
0 0 1 then we limit the possible input
0 1 1 combinations to two, 1 1 and 0 0.
1 0 1 • These are shown on the table now if
1 1 0 the input is 0 the output is 1 and vice
versa
a NOT gate
A
Y
55
AND Using NANDs Only
• As a NAND is simply an AND followed by a NOT
gate (inverter) we can simply use a NAND
followed by NOT.
A
Note – more than one NAND gate to
produce the desired AND gate.
Logic Gates 56
OR Using NANDs Only – Step 1
A B A B
0 0 0
0 1 1
1 0 1
1 1 1
This is our desired OR gate
57
OR Using NANDs Only – Step 2
A B A B A B
0 0 0 1 1
0 1 1 1 0
1 0 1 0 1
1 1 1 0 0
If we now add NOT A and NOT B into our table
58
OR Using NANDs Only – Step 3
A B A B A B A B
0 0 0 1 1 1
0 1 1 1 0 0
1 0 1 0 1 0
1 1 1 0 0 0
If these are now ANDed together
59
OR Using NANDs Only – Step 4
A B A B A B A B A B
0 0 0 1 1 1 0
0 1 1 1 0 0 1
1 0 1 0 1 0 1
1 1 1 0 0 0 1
Finally if we invert our result we see that the
3rd and 7th column are identical. This means that
if we invert the inputs then NAND then we will
end up with the OR function. 60
OR Using NANDs– in Logic
Diagram Representation
Y
B
Prove that in your notebook =)
Logic Gates 61
Basic Gate Using NANDs
62
Basic Gate Using Nors
63
Note
• Conversions from AND, OR, NOT to NAND only
rarely produce a less complex circuit but
normally the complexity is similar.
• The advantage lies in the fact that NAND chips
are readily available and are inexpensive due to
the number sold and that any gates left over can
be used in other circuits as all circuits use the
same gate types.
64
ACTIVITY #4 - GROUP WORK
65
Conclusion
• Logic Gate is an electronic circuit which
receive one or more than one input and deliver
single output.
• There are seven logic gates. NOT , OR , AND
are the basic logic gates. NOR , NAND, XOR ,
NXOR are the additional logic gates.
• A NOT gate inverts its single input value.
• An AND gate produces 1 if both input values
are 1.
• An OR gate produces 1 if one or the other or
both input values are 1. 66
Conclusion
• An XOR gate produces 1 if one or the other
(but not both) input values are 1.
• A NAND gate produces the opposite results
of an AND gate.
• A NOR gate produces the opposite results of
an OR gate.
• A XNOR gate produces the opposite results
of an XOR gate.
• NAND and NOR gates are referred to as
universal gates as the three basic gates can
be constructed using either one of the two. 67
Conclusion
68
Conclusion
69