Chapter 2A – Boolean Algebra

Report
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Reading Assignment: Chapter 2 in Logic and Computer Design
Fundamentals, 4th Edition by Mano
Chapter 2 - Boolean Algebra - comparison to regular algebra
Any algebra is built upon:
1) A set of elements
2) A set of operators
3) A set of postulates
Boolean Algebra is built upon:
1) A set of elements: {0, 1}
2) A set of operators: {+, • } – Define these in class
3) A set of postulates: the Huntington Postulates are the most common
1
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
2
Huntington Postulates – The following 6 postulates, along with the set of
elements and set of operators shown above, uniquely and completely define
Boolean algebra.
1) Closure for the operations {+, • } - Discuss
2) Two identity elements: - Illustrate by showing all possible values for x
A) 0: 0 + x = x + 0 = x
B) 1: 1 • x = x • 1 = x
3) Commutative Laws: - Illustrate by showing all possible values for x and y
A) x + y = y + x
B) xy = yx
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
4) Distributive Laws: - Prove by truth table
A) x • (y + z) = xy + xz
B) x + yz = (x + y) • (x + z)
3
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
4
5) Existence of a Complement: - Illustrate by considering all possible
values for x
x' = x = " the com plem ent of x" = " N O T x"
Define by the following truth table:
Related postulates:
A) x + x’ = 1
B) x • x’ = 0
x
x’
0
1
1
0
6) At least two non-equal elements: {0, 1} - Discuss
4
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
5
Common Theorems
Boolean algebra has already been completely defined. Additional theorems
are also often used, not because they are required, but because they are
useful. Some of the most common theorems are shown below. Note that
each theorem could be formally proven using the postulates.
1) Idempotency: (“same power”)
A) x + x = x – Illustrate by trying all possible values for x
B) x • x = x
Example: Show related examples using this theorem.
5
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
2) (no name) – Discuss
A) x + 1 = 1
B) x • 0 = 0
3) Involution: – Discuss and illustrate using NOT gates
x’’ = = x
4) Associative Laws: – Discuss and illustrate using logic gates
A) x + (y + z) = (x + y) + z
B) x(yz) = (xy)z
6
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
5) DeMorgan’s Theorems:
A) x  y = x  y
B) x  y = xy = x  y
7
Note: These theorems are not
obvious and can be tricky.
Hint: Apply to one operation at a
time (OR or AND).
Prove 5A by truth table
Example: Show related examples using DeMorgan’s theorem.
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
6) Absorption:
A) x + xy = x
B) x (x+y) = x
Example: Show related examples.
7) (no name)
A) x + x’y = x + y
B) x (x’ + y) = xy
Example: Show related examples.
8
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
8) Concensus:
A) xy + x’z + yz = xy + x’z
B) (x + y)(x’ + z)( y + z) = (x + y)(x’ + z)
Example: Show related examples.
9
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
10
Order of operations – The following precedence is used to evaluate logic
operations:
Operation
Precedence
.
Parentheses
Higher
Note that the same order of
NOT

operations is used in Excel,
AND

C++, and MATLAB
OR
Lower
Example: In which order are the operations performed for the following
function?
f = ab+cd
Note: spacing is often used to make it clearer: f = ab + cd
Example: Evaluate the following expression (show each step):
F = 10 + (1 1’1)’(1+0’) + (0+1’)10
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
11
Boolean Functions – Simplifying Boolean functions corresponds to
minimizing the amount of circuitry (logic gates) to be used.
Truth
table
Boolean
function
Minimize with
Boolean algebra
Implement with
logic circuits
Minimizing Boolean functions
No specific rules. In general we use Boolean algebra (postulates and
theorems) to reduce the number of terms, literals, logic gates, or integrated
circuits (Ics).
Literal – a primed (complemented) or unprimed variable. In counting
literals, we count all occurrences of each literal.
Example: How many literals are in the expression f = ab + a’c + bc’d ?
(Answer: 7)
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Examples – Minimize the following Boolean functions:
1) F = AB + A(B + C) + B(B + C)
2) F = AB’(C + BD) + A’B’
12
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
3) F(A,B,C,D) = A + A’BC + C’
4) F = [(x’y)’ + z’]’
13
Chapter 2A
5)
EGR 270 – Fundamentals of Computer Engineering
F1  AB (CD  E F)( AB  CD)
6) f(x,y,z) = x’y(z + y’x) + y’z
14
Chapter 2A
7)
EGR 270 – Fundamentals of Computer Engineering
f(a, b, c, d)  a  b  (a  b  c)  b  c  d  b  c  d  a  c
15
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Complement of a Function
A function F’ has the exact opposite truth table as function F.
Example:
A) Find F’ for the function below using DeMorgan’s theorem.
B) Find truth tables for F and for F’ for the function below. Are they
opposites?
F  x yz  x y
16
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
17
Canonical and Standard forms
Boolean functions are commonly expressed using the following forms:
• Canonical forms:
» Sum of minterms
» Product of maxterms
• Standard forms:
» Sum of products (SOP)
» Product of sums (POS)
Note: These 4 forms will be used regularly throughout the course.
• Many designs begin by expressing functions in Sum of minterms or Product
of maxterms forms.
• When we minimize expressions the result is typically minimal SOP or
minimal POS form.
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
18
Minterm – (also called a standard product) A minterm is a term containing all
n variables (complemented or uncomplemented) ANDed together.
Example: f(A,B) has 4 possible minterms. List them.
Each minterm represents one n-bit word where:
• Primed variable  0
• Unprimed variable  1
Minterm designation: for function f(x,y,z) the input combination 000
represents minterm x’y’z’ and is designated m0.
xyz = 000
x’y’z’
m0
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Example: Show all 8 possible minterms and the shorthand designations for
f(x, y, z).
x
y
z
0
0
0
0
0
1
0
1
0
0
1
1
1
1
0
0
1
1
0
1
0
1
1
1
Minterm
(algebraic form)
Minterm
(shorthand form)
19
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
20
Key Point: A Boolean function F may be represented by a sum (ORed
together) of its minterms. They represent the input combinations needed to
yield F = 1. So minterms represent the 1’s in the truth table for F.
F 
 (m interm s)
Example: Pick a truth table for some function f(x,y,z) and represent f as a sum
of minterms.
x
y
z
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
F
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Maxterm – (also called a standard sum) A maxterm is a term containing all n
variables (complemented or uncomplemented) ORed together.
Example: f(A,B) has 4 possible maxterms. List them.
Each maxterm represents one n-bit word where:
• Primed variable  1
• Unprimed variable  0
(note that this is opposite of the notation used for minterms)
Maxterm designation: for function f(x,y,z) the input combination 000
represents maxterm (x + y + z) and is designated M0.
xyz = 000
x+y+z
M0
21
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Example: Show all 8 possible maxterms and the shorthand designations for
f(x, y, z).
x
y
z
0
0
0
0
0
1
0
1
0
0
1
1
1
1
0
0
1
1
0
1
0
1
1
1
Maxterm
(algebraic form)
Maxterm
(shorthand form)
22
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Key Point: A Boolean function F may be represented by a product (ANDed
together) of its maxterms. They represent the input combinations needed to
yield F = 0. So maxterms represent the 0’s in the truth table for F.
F   (m ax term s)
Example: Pick a truth table for some function f(x,y,z) and represent f as a
product of maxterms.
x
y
z
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
F
23
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Relationship between minterms and maxterms
m
i
 M
i
M
i
 m
i
Example: Illustrate the relationships above with any minterm or maxterm.
24
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
25
Conversion between forms
Since minterms represent where F = 1 and maxterms represent where F = 0, all
terms are either minterms or maxterms. So if F is expressed as a sum of
minterms, then F is a product of the maxterms (the terms that were not
minterms). So it is simple to convert between forms.
Example: Convert to the other canonical form
1. F(A, B) = (0, 1)
2. F(x, y, z) = (0, 1)
3. F(x, y, z) = (4, 5, 6)
4. F(a, b, c, d, e) = (0-4, 8, 13-18)
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
26
Conversion to sum of minterms or product of maxterms forms from other
forms
Possible approaches include Boolean algebra and truth tables.
Examples: Represent each function below as a sum of minterms:
1. F(A, B) = A
2. F(x, y, z) = xy + z
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Examples: Represent each function below as a product of maxterms:
1. F(A, B) = A’B + AB’
2. F(x, y, z) = x’ + y’
27
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
28
Standard Forms
Canonical forms are not minimized and are not useful for many circuit
implementations.
Standard forms are more useful. Functions are typically minimized into one of
the two standard forms:
1. Sum of Products (SOP) : F = sum of ANDed terms (but not necessarily
minterms)
Product term (variables ANDed)
Example
: F(A, B, C, D)  A B  BC  A C D
Sum (Products ORed)
2. Product of Sums (POS) : F = product of ORed terms (but not necessarily
maxterms)
Sum term (variables ORed)
Example



: F(A, B, C, D)  A  B B  C A  D

Product (Sums ANDed)
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
29
Example: Determine the type of expression in each case below.
Function
F(A,B,C) = AB’ + A’BC’
F(A,B,C) = (A+B’+C’)(A’+B+C)
F(A,B,C) = A’B’C’ + ABC + A’BC
F(A,B,C) = (A’+B’+C’)(A+BC)
F(A,B,C) = B(A’+B)(A+B’+C)
F(A,B,C) = AB’ + A’(B+C)
Sum of Product of SOP POS None of
Minterms Maxterms
the forms
listed
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Example: Function F(A,B,C) has the following truth table.
Express F in each of the following forms:
1. Sum of minterms
2. Product of maxterms
3. Minimal SOP
4. Minimal POS
30
A
B
C
F
0
0
0
1
0
0
1
1
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
1
0
1
1
1
1
1
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
31
Standard Forms: 2-Level Implementations
Standard forms are referred to as “2-level implementations” because they can
be implemented with two levels gates (and thus only two gate delays). Note
that this does not include initial inverters.
Example: Implement a SOP expression using logic gates to illustrate that it is a
2-level implementation.
Example: Implement a POS expression using logic gates to illustrate that it is
a 2-level implementation.
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
32
Non-standard forms:
4 commonly used forms have been covered (sum of minterms, product of
maxterms, SOP, and POS). These forms will be used throughout the course.
There are, however, other non-standard forms.
Example: The following function is in non-standard form:
F = A(B + C(D+E(G+HJ)))
a) Draw the logic diagram. How many gate delays are there?
b) Expand F into minimal SOP form and draw the logic diagram. How many
gate delays are there?
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
33
Basic functions/gates and their truth tables:
We previously defined two functions with two or more inputs: AND, OR.
• How many possible 2-input logic functions could be defined (consider the
diagram shown below)? (Answer: 16)
• How many correspond to actual gates (commercially available)? (Answer: 6)
A
Inputs:
Logic Gate
F (Output)
B
6 commonly defined 2-input logic functions/gates:
1. AND
4. NOR
2. OR
5. XOR (Exclusive-OR)
3. NAND
6. XNOR (Exclusive-NOR or Equivalence)
The AND and OR gates have already been defined. The remaining 4 gates will
be discussed on the following slides.
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
NAND: Show logic symbol, truth table, and logic expressions:
NOR: Show logic symbol, truth table, and logic expressions:
34
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
35
XOR: Show logic symbol, truth table, and logic expressions:
AB
 (1, 2)  A B  A B
XNOR: Show logic symbol, truth table, and logic expressions:
ABABABA
B
 (0, 3)  A B  AB
Chapter 2A
EGR 270 – Fundamentals of Computer Engineering
Other Logic Symbols: (We won’t use these in this course.)
36

similar documents