0% found this document useful (0 votes)
97 views61 pages

Logic Gates and Boolean Algebra

Digital circuits are built from logic gates. Boolean algebra describes and simplifies digital circuits. Logic gates implement basic logic functions using inputs and outputs. Common logic gates are AND, OR, and NOT. Truth tables define the output of logic functions for all possible input combinations. Boolean theorems can simplify logic expressions and circuit designs.

Uploaded by

hussain khozema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views61 pages

Logic Gates and Boolean Algebra

Digital circuits are built from logic gates. Boolean algebra describes and simplifies digital circuits. Logic gates implement basic logic functions using inputs and outputs. Common logic gates are AND, OR, and NOT. Truth tables define the output of logic functions for all possible input combinations. Boolean theorems can simplify logic expressions and circuit designs.

Uploaded by

hussain khozema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

3.

Logic Gates and Boolean Algebra


Digital circuits can be found in smart
phones, computers, washing machines,
cars, etc.

Logic gates are the basic building blocks of


digital circuits.

Boolean algebra is used to describe, design


and simplify digital circuits.

3-1
Boolean Constants – only 2 values
 TRUE, FALSE

 Logic HIGH, Logic LOW

 HI, LO

 1, 0

Boolean (logic) variables can only assume


one of the two values

3-2
Common Logic-level
voltage ranges
TTL CMOS (74AC)
5.0V 5.0V
Logic 1 Logic 1
3.5V

2.0V
Indeterminate
Indeterminate
Indeterminate
Indeterminate
1.5V
0.8V
Logic 0
Logic 0
0V 0V

3-3
A typical logic circuit

 1 or more logic inputs


 1 or more logic outputs
 Outputs are related to inputs by logic
functions
Smaller logic
inputs: circuit blocks

output:
X
Y Logic circuit F
Z

3-4
Truth table
 Logic function can be fully described by a
Truth Table.
 The Truth table
• shows how a logic circuit’s output
responds to various combinations of
logic inputs
• has 2N number of input combinations for
N inputs
• lists all possible input combinations in
the binary counting sequence

3-5
A typical N-input truth table

Input 1 Input 2 … Input Input N Output


N-1
0 0 … 0 0 1
0 0 … 0 1 0
0 . … 1 0 0
0 . … 1 1 .
2N
. . … . . .
rows
. . … . . .
1 . … 0 0 .
1 . … 0 1 .
1 1 … 1 0 .
1 1 … 1 1 .

3-6
3 Basic Logic Operations

 Logical addition - OR
 Logical multiplication - AND
 Logical complement or inversion - NOT

In digital circuits, these are realised by


electronic devices called logic gates.

3-7
Logical OR Operation
A
X
B Logic
symbol
 Logical OR operation
 X = A + B Logic
 X = A OR B
expression

 2-input OR gate: X=A+B

3-8
Truth table for a 2-input OR gate
(X = A+B)

Inputs Output
A B X
0 0 0
0 1 1
1 0 1
1 1 1

X=1 if at least one input is = 1

3-9
A
B X
C

3-input OR gate:
X=A+B+C

OR operation result will be 1 if at least one


input is 1

3-10
Truth Table for a 3-input OR gate
(X = A+B+C)

Inputs Output
A B C X
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1

3-11
Logical AND operation
Logical AND operation
• X=A•B
• X = A AND B A
X
• X = AB
B
2-input AND gate:
• X = AB A
B X
3-input AND gate: C
• X = ABC

AND operation result will be 1 only if all


inputs are 1 3-12
Truth table for 2-input AND gate
(X = AB)

Inputs Output
A B X
0 0 0
0 1 0
1 0 0
1 1 1

Output X=1 only if all inputs are 1

3-13
The Truth Table for a 3-input AND gate
(X = ABC)
Inputs Output
A B C X
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1

3-14
Logical NOT operation
 NOT gate only has 1 input and it is
commonly known as an inverter

 the output is the complement/inverse of the


input

 X=A A X

 X = A’ we will use this notation

3-15
Logical NOT operation
 Its truth table is very simple

input output
A X = A’
0 1
1 0

3-16
Buffer
 Its truth table is also very simple
 No change in logic

input output
A X A X=A
0 0
1 1

3-17
 Example: Sketch the logic waveform of X

A
B X=A’+B

3-18
 Timing diagram with more realistic
appearance, showing propagation delays,
rise time and fall time

Fig. 3.17 (taken from Wakerly)


3-19
Boolean Algebra

 Helps to analyse logic circuits.


 Express operations mathematically.
 Similar to normal algebra but much
simpler.
 It does not have fraction or negative
number.

3-20
Order of Precedence in
Boolean Algebra:

 Complement over a single variable


(inversion)

 Expression within parentheses

 AND Examples:
1. Y = A + B C’

 OR 2. Y = (A + B) C’
3. Y = A + (B C)’
3-21
Describing logic circuits algebraically
 AND, OR and NOT operations
• are basic building blocks of digital system

• can completely describe any logic circuit

 Example: express output X in terms of


inputs A, B and C

A
B X
C

3-22
Evaluating logic circuit outputs
From a Boolean expression, the logic level of
an output can be determined for any values of
the circuit inputs.
If inputs A,B,C,D = 0,1,1,0
X=?
Example
If inputs A,B,C,D = 1,1,1,1
X = A’(B+C)(A+D)’ X=?

If inputs A,B,C,D = 0,0,0,0


X=?

3-23
Determining Instantaneous Output
Level from a Logic Circuit Diagram

A
B X

C
D

e.g. if A=1, B=1, C=0, D=0, then X=?

3-24
Implementing Circuits from Boolean
expressions

Example Y = AC + BC’ + A’BC

3-25
Boolean Theorems

 Many of the theorems are similar to those


in normal algebra.
 The theorems can be used to simplify logic
expressions and therefore can help to
simplify logic circuits.
 Simpler circuits cost less to build and are
less prone to failure.

3-26
Boolean Theorems
Axioms:
X = 0 if X ≠ 1

X = 1 if X ≠ 0

0·0=0 1+1=1

1·1=1 0+0=0

0·1=1·0=0 1+0=0+1=1
3-27
Single variable theorems:
X•0=0 X+1=1

X•1=X X+0=X

X•X=X X+X=X

X • X’ = 0 X + X’ = 1

(X’)’ = X

Duality: any theorem or identity in switching


algebra remains true if 0 and 1 are swapped and
· and + are swapped throughout
3-28
Single variable theorems:

Fig. 3-25 (Tocci, 10th ed. Pg. 77)


3-29
Multivariable theorems:
 Commutative laws:
A+B=B+A
A•B=B•A
 Associative laws:
A + (B + C) = (A + B ) + C = A + B + C
A(BC) = (AB)C = ABC

 Distributive laws:
A(B + C) = AB + AC
(A + B)(C + D) = AC + BC + AD + BD
3-30
Absorption laws

A + AB = A A + A’B = A + B
proof: proof:
A + AB = A(1 + B) A + A’B = A + AB + A’B
=A•1=A = A + (A + A’)B
= A + (1) B
=A+B

A technique commonly
used in algebraic
simplification
3-31
Absorption laws (Venn diagrams)

A + AB = A A + A’B = A + B

A’B
B

A A

3-32
Consensus

AB + A’C + BC = AB + A’C

proof:
BC = ABC + A’BC
Thus AB + A’C + BC = AB + A’C + ABC + A’BC
= AB + ABC + A’C + A’BC
= AB (1+C) + A’C(1+B)
= AB + A’C

3-33
DeMorgan’s Theorems
 (A + B)’ = A’ • B’
proof:
A B (A+B)’ A’ • B’
0 0 1 1
0 1 0 0
1 0 0 0
1 1 0 0

3-34
DeMorgan’s Theorems
 (AB)’ = A’ + B’
proof:
A B (AB)’ A’ + B’
0 0 1 1
0 1 1 1
1 0 1 1
1 1 0 0

3-35
DeMorgan’s Theorems
generalise to many variables

(A+B+C+D+…)’ = A’ • B’ • C’ • D’ • …

(ABCD…)’ = A’+B’+C’+D’+ …

• Add or remove inverter to each variable


• Interchange AND with OR

3-36
Example
Simplify [A (B + C’)’ D]’

3-37
NOR gate & NAND gate
 Combines basic operations of OR & AND
with NOT

A
 NOR: X = (A+B)’ X
B

A
 NAND: X = (AB)’ X
B

3-38
Truth table for 2-input NOR gate
X = A NOR B

Inputs Output
A B X
0 0 1
0 1 0
1 0 0
1 1 0

Output X=1 only when all inputs are 0

3-39
Truth table for 2-input NAND gate
X = A NAND B

Inputs Output
A B X
0 0 1
0 1 1
1 0 1
1 1 0

Output X=0 only when all inputs are 1

3-40
Truth table for 3-input NOR gate
X = (A+B+C)’

Inputs Output
A B C X
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 0
3-41
Truth table for 3-input NAND gate
X = (ABC)’

Inputs Output
A B C X
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
3-42
Summary
 OR: output is 1 when any of the inputs is 1

 AND: output is 1 when all the inputs are 1

 NOT: output is 0 when input is 1 and vice versa

 NOR: output is 0 when any of the inputs is 1

 NAND: output is 0 when all the inputs are 1

3-43
Universality of NAND gates and NOR gates

 NAND gates can be used to form AND gate,


OR gate and NOT gate

 Therefore, NAND gates can be used to


implement any Boolean function

 Similarly for NOR gates

 Equivalence can be proved by DeMorgan’s


theorems

3-44
Fig. 3-29 Basic gates from NAND
(Tocci, 10th ed. Pg. 84)

3-45
Fig. 3-30 Basic gates from NOR
(Tocci, 10th ed. Pg. 84)

3-46
Alternate Logic gate representations
 The alternate symbol is obtained from the standard
symbol by applying DeMorgan’s theorems
• adding bubbles to each input and output of
the standard symbol
• removing bubble from the output of the
standard symbol
• change the operation symbol from AND to OR
and vice versa
• NOT symbol shape is not changed

Notice that there is no bubble at the inputs of the


standard symbols (Fig. 3-33, left).
3-47
Fig. 3-33 (Tocci, 10th ed. Pg. 87)
3-48
Examples

3-49
Fig. 3-46
3-50
Fig. 3-47
3-51
Fig. 3-48
3-52
Fig. 3-49
Exclusive-OR gate

Ex-OR (XOR)
A
X = AB’ + A’B X
X=A⊕B B

A
A B X X
=1
0 0 0 B
0 1 1 IEEE
1 0 1 symbol
Different
1 1 0
from OR
3-53
Exclusive-NOR gate

Ex-NOR (XNOR)
A
X
X = AB + A’B’
B
X = (A ⊕ B)’

A B X A
=1 X
0 0 1 B
0 1 0
IEEE
1 0 0 symbol
1 1 1

3-54
Application of XOR

 Bit-wise comparator
 output is 1 if the two multi-bit inputs are

different

3-55
XOR with multiple inputs

 Essentially an odd-function generator


 Output is 1 if there is an odd number of 1’s
among all the inputs
 E.g. for 3-input XOR, the output is 1 if
there are 1 or 3 bits of 1 among the inputs

 A ⊕ B ⊕ C = (A ⊕ B) ⊕ C
 = A ⊕ (B ⊕ C)

3-56
Logic devices
 Different ways to create a physically
functioning logic circuit
 Examples: use standard logic integrated
circuits (ICs), application-specific ICs
(ASICs), programmable logic devices
 Small-scale integrated logic devices: AND,
OR, NOT, NAND, NOR, XOR, XNOR
 We will use some of these in lab
experiment 1

3-57
Pin numbers
Plastic or ceramic
protective casing

Top view

Metal
pins

Figure 4.29: (Tocci 10th Ed) Dual-in-line Package

3-58
Common IC packaging

Source: Tocci, 10th ed., pg. 496


3-59
Logic circuit connections
 Implement Y = AB’

7404 7408
Hex-NOT Quad-AND

3-60
Circuit connection diagram

3-61

You might also like