You are on page 1of 43

Chapter Three

Digital Logic Gates

1
Chapter Outline
 Introduction
 Boolean Algebra
 Basic and Derived Logic Gates
 The Inverter
 The AND Gate
The first three are basic logic gates
 The OR Gate and the rest are derived from them
 The NAND Gate
 The NOR Gate
 The Exclusive-OR and Exclusive-NOR Gates

2
2
Introduction
 Digital (logic) circuit operates in the binary mode

 This characteristic of logic circuit allows us to use


Boolean algebra as a tool for the analysis and
design of digital systems

 Logic gates are the most fundamental circuits

 The interconnection of gates to perform a variety of


logical operations is called logic design
3
Boolean Algebra
 Because only two values are possible, Boolean
algebra is relatively easy to work with as
compared with ordinary algebra.

 In Boolean algebra there are no decimals,


fractions, negative numbers, square root,
logarithms, imaginary number, and so on.

 In Boolean algebra there are only three basic


operation; OR, AND and NOT.
 These basic operations are called logic
operations
4
1.The Inverter
 Performs inversion or complementation
– Changes a logic level to the opposite
– 0(LOW)  1(HIGH) ; 1  0;

 Symbols used:
1

(a) Distinctive shape symbols (b) Rectangular outline symbols


with negation indicators with polarity indicators
5
 Inverter operation:
HIGH (1) HIGH (1)
LOW (0) LOW (0)
t1 t2 t1 t2
Input Output
Pulse Pulse

 Logic expression for an Inverter:


A X
0 1
A X=A
1 0

X is the complement of A
A X is the inverse of A
X is NOT A
"A bar"
"not A"
6
Discrete NOT Gate
+5 V

R
A Y
0 1
Y
1 0

A
T Truth Table

Transistor as Inverter
7
2. The AND Gate
 Performs ‘logical multiplication’
– If all of the input are HIGH, then the output is HIGH.
– If any of the input are LOW, then the output is LOW.

 Symbols used:
&
A A
X X
B B

(a) Distinctive shape (b) Rectangular outline with


the AND (&) qualifying symbol

8
AND gate operation:

LOW (0)
LOW (0) A
LOW (0) X=A B
B
HIGH (1) AND
LOW (0)
LOW (0)
A
B X=A B C
LOW (0) C
LOW (0)
HIGH (1)
A
HIGH (1) B
C X = ABCD
HIGH (1)
HIGH (1) D

99
A INPUTS OUTPUT
X=A B
A B X
B or
AND 0 0 0
X = AB
0 1 0
1 0 0
1 1 1

1 0 1 1 0

1 1 1 0 0

1 0 1 0 0

t1 t2 t3 t4 t5
10
Logic expressions for AND gate:
 AND gate performs Boolean multiplication

 Boolean multiplication follows the same basic


rule as binary multiplication:

0.0=0
0.1=0
1.0=0
1.1=1
11
11
Discrete AND Gate
+5 V +5 V

A B X
0 0 0

A Y
A T1 Y
0 1 0
1 0 0
B B T2 T3
1 1 1
Two-input
diode AND Gate Two-input Truth Table
Transistor AND gate 12
3. The OR Gate
 Performs ‘logical addition’
– If any of the input are HIGH, then the output is HIGH.
– If all of the input are LOW, then the output is LOW

 Symbols used:

1
A A
X X
B B

(a) Distinctive shape (b) Rectangular outline with


the OR ( 1) qualifying symbol

13
The OR gate operation:

LOW (0) A
LOW (0) X=A+B
LOW (0)
B

HIGH (1)
HIGH (1) A
LOW (0) B X=A+B+C
C
LOW (0)
HIGH (1)
HIGH (1) A
B X=A+B+C+D
C
HIGH (1) D
HIGH (1)
HIGH (1)
14
14
INPUTS OUTPUT
A
X=A+B A B X
B
0 0 0
0 1 1
1 0 1
1 1 1

1 0 0 1 0

1 1 1 0 0

1 1 1 1 0

t1 t2 t3 t4 t5

15
Logic expressions for OR gate:
 OR gate performs Boolean addition
 Boolean addition follows the basic rules as
follows:
0+0=0
0+1=1
1+0=1
1+1=1

16
16
Discrete OR Gate
D1
+5 V
A Y
A B Y
B 0 0 0
D2
R 0 1 1
Y

1 0 1
Two-input R
A T1 T2 T3 1 1 1
diode OR Gate
B
Truth Table

Two-input
17
Transistor OR gate
4. The NAND Gate
 NAND  NOT-AND combines the AND gate
and an inverter
 Used as a universal gate
– Combinations of NAND gates can be used to perform AND, OR
and inverter operations
– If all or any of the input are LOW, then the output is HIGH.
– If all of the input are HIGH, then the output is LOW
 Symbol used: &
A
X
B
A A (b) Rectangular outline: 2 input
X X NAND gate with polarity indicator
B B

(a) Distinctive shape: 2 input NAND


gate and its NOT/AND equivalent

18
The NAND gate operation:

A
X
LOW (0)
B
HIGH (1)
LOW (0)

HIGH (1)

LOW (0)
HIGH (1) A
LOW (0)
B X
HIGH (1)
HIGH (1)
C
HIGH (1)
LOW (0)
HIGH (1)

19
19
INPUTS OUTPUT
A
X = AB A B X
B
0 0 1
0 1 1
1 0 1
1 1 0

1 0 0 1 0

1 1 1 0 0

0 1 1 1 1

t1 t2 t3 t4 t5

20
Logic expressions for NAND gate:
 Boolean expression for NAND is a combination
of AND and Inverter Boolean expressions.

INPUTS OUTPUT
A B AB AB = X
0 0 0 0.0 = 0 = 1
0 1 0 0.1 = 0 = 1
1 0 0 1.0 = 0 = 1
1 1 1 1.1 = 1 = 0

21
Universality of NAND Gates

A Y = A.A = A
 INVERTER


A AB
Y = AB
B

AND

A
A


Y=A B

B
B OR
22
Discrete NAND Gate
+5 V
A B Y
0 0 1
R

0 1 1
A Y
1 0 1
1 1 0
B T

Truth Table

Discrete two-input NAND gate


23
5. The NOR Gate
 NOR  NOT-OR combines the OR
gate and an inverter
 Used as a universal gate
– Combinations of NOR gates can be used to perform
AND, OR and inverter operations
– If all or any of the input are HIGH, then the output is
LOW.
– If all of the input are LOW, then the output is HIGH
 Symbol used:
A A 1
X A
X X
B B B

(a) Distinctive shape: 2 input NOR (b) Rectangular outline with


gate and its NOT/OR equivalent the OR ( 1) qualifying symbol
24
The NOR gate operation:
LOW (0)
HIGH (1)
LOW (0)
A
X
HIGH (1) B
LOW (0)
LOW (0)
A
LOW (0) B X
LOW (0) C
HIGH (1)

HIGH (1)
LOW (0)
HIGH (1)
25
25
INPUTS OUTPUT
A
X=A+B A B X
B
0 0 1
0 1 0
1 0 0
1 1 0

1 0 0 1 0

1 0 1 0 0

0 1 0 0 1

t1 t2 t3 t4 t5
26
Logic expressions for NOR gate:
 Boolean expression for NOR is a combination of
OR and Inverter Boolean expressions.

INPUTS OUTPUT
A B A+B A+B=X
0 0 0 0+0 = 0 = 1
0 1 1 0+1 = 1 = 0
1 0 1 1+0 = 1 = 0
1 1 1 1+1 = 1 = 0

27
Universality of NOR Gates
 Similarly, it can be shown that NOR gates can be
arranged to implement any of the Boolean operations.
See fig. below
A Y = A+A= A
 INVERTER


A AB
Y = A+B
B

OR

A
A


Y = A+B

B 28
B AND
Discrete NOR Gate
+5 V

A B Y
Y
0 0 1
A T1 T2 0 1 0
B
1 0 0
1 1 0

Discrete two-input NOR gate Truth Table


29
6. The Exclusive-OR gate

• Combines basic logic circuits of AND, OR and


Inverter. Has only 2 inputs
• Used as a universal gate
– Can be connected to form an adder that allows a computer to
do perform addition, subtraction, multiplication and division in
ALU (Arithmetic and Logic Unit).
– If both of the input are at the same logic level, then the output is
LOW.
– If both of the input are at opposite logic levels, then the output is
HIGH
• Symbol used: A
X A
=1
X
B B

(a) Distinctive shape (b) Rectangular outline


30
The XOR gate operation:
LOW (0)
LOW (0)
LOW (0)

HIGH (1) A
HIGH (1) X
LOW (0) B

LOW (0)
HIGH (1)
HIGH (1)

HIGH (1)
LOW (0)
HIGH (1)
31
31
INPUTS OUTPUT
A
X = AB + BA A B X
B
=A B 0 0 0
0 1 1
1 0 1
1 1 0

1 0 0 1 0

1 0 1 0 0

0 0 1 1 0

t1 t2 t3 t4 t5

32
7. The Exclusive-NOR gate
• Has only 2 inputs, but output of XNOR is
the opposite of XOR
– If both of the input are at the same logic level, then
the output is HIGH.
– If both of the input are at opposite logic levels, then
the output is LOW.
• Symbol used:
A =1
A
X X
B B

(a) Distinctive shape (b) Rectangular outline

33
The XNOR gate operation:
LOW (0)
LOW (1)
LOW (0)

HIGH (1) A
HIGH (0) X
LOW (0) B

LOW (0)
HIGH (0)
HIGH (1)

HIGH (1)
LOW (1)
HIGH (1)
34
34
INPUTS OUTPUT
A
X=A B A B X
B
0 0 1
0 1 0
1 0 0
1 1 1

1 0 0 1 0

1 0 1 0 0

1 1 0 0 1

t1 t2 t3 t4 t5
35
XOR vs XNOR

1 0 0 1 0

1 0 1 0 0

0 0 1 1 0

XOR

1 1 0 0 1

XNOR
t1 t2 t3 t4 t5
36
36
Describing Logic Circuits Algebraically
 Any logic circuit, no matter how
complex, may be completely A.B Y=A.B+C
described using the Boolean A

operations previously defined, B

because the OR gate, AND gate, C


and NOT circuit are the basic  (a) Logic circuit which does
building blocks of digital not require parenthesis
systems.
A+B Y=(A+B).C
A
 In Figure (a), the circuit has three B
inputs, A, B, and C and a single C
output, Y.  (b) Logic circuit requires
parenthesis
 Utilizing the Boolean expression
for each gate, we can easily
determine the expression for the
output. 37
Boolean Algebra order of Computation
 Occasionally, there may be confusion as which
operation to be performed first. The expression
Y=AB+C can be interpreted in two different ways:
 A. B is ORed with C
 A is ANDed with the term B+C

 To avoid this confusion, it will be understood that if


an expression contains both AND and OR operations
the AND operations are performed first, unless there
are parentheses in the expression, in which case the
operation inside the parentheses is to be performed
first.
38
Evaluating Logic–circuit Outputs
A
 Once the Boolean expression A
B 1
ABC

Y  ABC A  D 
for a circuit output has been C
2
A  D AD
obtained, the output logic level
can be determined for any set of D

input levels
 For example: suppose that we
want to know the logic level of
the output Y for the circuit in 
Y  ABC A  D 
the figure for the case where = 0.1.1.( 0 + 1)
A=0, B=1, C=1, and D=1. = 1.1.1.(1)
 As in ordinary algebra, the =0

value of Y can be found by


‘plugging’ the values of the
variables into the expression
39
General Rules

The following rules must always be followed when


evaluated a Boolean expression
1. First ,perform all inversions of single terms; that is
0 = 1 or 1 = 0

2. Then perform all operations within parentheses.


3. Perform an AND operation before an OR operation
unless parentheses indicate otherwise
4. If an expression has a bar over it, perform the
operations of the expression first and then invert the
result.
40
Determining output level from a Diagram
 The output logic level for given input levels can also be
determined directly from the circuit diagram without
using the Boolean expression.

 Technicians often use this technique during the


troubleshooting
1
A=0
1
B=1 1
C=1
2 Y=0

0
1 0
D=1 1

41
Quiz 1

1. Draw the circuit diagram for the following


Boolean expressions.
AC  AB  Y
2. For the above Boolean expression
construct a truth table for all possible
combinations.

42
THE END!

43

You might also like