This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Boolean algebra Yesterday we talked about how analog voltages can represent the logical
values true and false.
— We introduced the basic Boolean operations AND, OR and NOT, which
can be implemented in hardware with primitive logic gates.
— It follows that any Boolean expression, composed of basic operations,
can be computed with a circuit of primitive gates.
Today we’ll present the axioms of Boolean algebra, and discuss how they
help us simplify functions and circuits. June 17, 2003 ©20002003 Howard Huang 1 Operations and gates review
Operation: AND (product)
of two inputs OR (sum) of
two inputs Expression: xy or x•y x+y x’ or x Truth table: NOT (complement)
of one input x y xy x y x+y x x’ 0
0
1
1 0
1
0
1 0
0
0
1 0
0
1
1 0
1
0
1 0
1
1
1 0
1 1
0 Logic gate
symbol: June 17, 2003 Boolean algebra 2 Expressions and circuits
We can build a circuit for any Boolean expression by connecting primitive
logic gates in the correct order.
Yesterday we showed the example circuit below, which accepts inputs x,
y and z, and produces the output (x + y’)z + x’. June 17, 2003 Boolean algebra 3 Simplifying circuits
The big circuit on the last page is actually equivalent to this simpler one. Simpler hardware is almost always better.
— In many cases, simpler circuits are faster.
— Less hardware means lower costs.
— A smaller circuit also consumes less power.
So how were we able to simplify this particular circuit? Smaller is better.
June 17, 2003 Boolean algebra 4 The definition of a Boolean algebra
The secret is Boolean algebra, which lets us simplify Boolean functions
just as regular algebra allows us to manipulate arithmetic functions.
A Boolean algebra requires:
— A set of values with at least two elements, denoted 0 and 1
— Two binary (twoargument) operations + and •
— A unary (oneargument) operation ’
These values and operations must satisfy the axioms shown below.
x+0=x
x+1=1
x+x=x
x + x’ = 1
(x’)’ = x
x+y=y+x
x + (y + z) = (x + y) + z
x(y + z) = xy + xz
(x + y)’ = x’y’
June 17, 2003 x
x
x
x •1=x
•0=0
•x=x
• x’ = 0 xy = yx
Commutative
x(yz) = (xy)z
Associative
x + yz = (x + y)(x + z) Distributive
(xy)’ = x’ + y’
DeMorgan’s Law
Boolean algebra 5 Satisfying the axioms
Fortunately, the AND, OR and NOT operations that we defined do satisfy
all of the axioms.
x y xy x y x+y x x’ 0
0
1
1 0
1
0
1 0
0
0
1 0
0
1
1 0
1
0
1 0
1
1
1 0
1 1
0 For example, we can show that the axiom x + x’ = 1 always holds.
— There are only two possible values for x, 0 or 1.
— The complement of these values is 1 and 0, by our definition of NOT.
— According to our definition of OR, 0 + 1 = 1, and 1 + 0 = 1.
x x + x’ 0
1
June 17, 2003 x’
1
0 1
1 Boolean algebra 6 Similarities with regular algebra
The axioms in blue look just like regular algebraic rules—this is one of the
reasons we overload the + and • symbols for Boolean operations.
The associative laws show that there is no ambiguity in an expression like
xyz or x + y + z, so we can use multiinput primitive gates as well as our
original twoinput gates. x+0=x
x+1=1
x+x=x
x + x’ = 1
(x’)’ = x
x+y=y+x
x + (y + z) = (x + y) + z
x(y + z) = xy + xz
(x + y)’ = x’y’
June 17, 2003 x
x
x
x •1=x
•0=0
•x=x
• x’ = 0 xy = yx
Commutative
x(yz) = (xy)z
Associative
x + yz = (x + y)(x + z) Distributive
(xy)’ = x’ + y’
DeMorgan’s Law
Boolean algebra 7 The complement operation
The magenta axioms deal with the complement operator.
The first three make sense if you think about some English examples.
— “It is snowing or it is not snowing” is always true (x + x’ = 1)
— “It is snowing and it is not snowing” can never be true (x • x’ = 0)
— “I am not not handsome” means “I am handsome” ((x’)’ = x) x+0=x
x+1=1
x+x=x
x + x’ = 1
(x’)’ = x
x+y=y+x
x + (y + z) = (x + y) + z
x(y + z) = xy + xz
(x + y)’ = x’y’
June 17, 2003 x
x
x
x •1=x
•0=0
•x=x
• x’ = 0 xy = yx
Commutative
x(yz) = (xy)z
Associative
x + yz = (x + y)(x + z) Distributive
(xy)’ = x’ + y’
DeMorgan’s Law
Boolean algebra 8 DeMorgan’s Laws
DeMorgan’s Laws explain how to complement arbitrary expressions.
(x + y)’ = x’y’ (xy)’ = x’ + y’ Here are some examples in English.
— “I’m not richorfamous” means that I’m not rich and I’m not famous.
— “I am not oldandbald” means “I am not old or I am not bald.” But I
could be (1) young and bald, (2) young and hairy, or (3) old and hairy. Who’s
DeMorgan? June 17, 2003 Boolean algebra 9 Other differences from regular algebra
Finally, the red axioms are completely different from regular algebra.
The first three make sense logically.
— “Anything or true” always holds, even if “anything” is false (x + 1 = 1)
— “I am handsome or I am handsome” is redundant (x + x = x)
— “I am handsome and I am handsome” is also redundant (x • x = x)
The last one, x + yz = (x + y)(x + z), is the least intuitive, but you can
prove it using truth tables or the other axioms.
x+0=x
x+1=1
x+x=x
x + x’ = 1
(x’)’ = x
x+y=y+x
x + (y + z) = (x + y) + z
x(y + z) = xy + xz
(x + y)’ = x’y’
June 17, 2003 x
x
x
x •1=x
•0=0
•x=x
• x’ = 0 xy = yx
Commutative
x(yz) = (xy)z
Associative
x + yz = (x + y)(x + z) Distributive
(xy)’ = x’ + y’
DeMorgan’s Law
Boolean algebra 10 Simplifications
Now we can use these axioms to simplify expressions and circuits.
x’y’ + xyz + x’y =
=
=
=
=
=
= x’y’ + x’y + xyz
x’(y’ + y) + xyz
(x’ • 1) + xyz
x’ + xyz
(x’ + x)(x’ + yz)
1 • (x’ + yz)
x’ + yz x+0=x
x+1=1
x+x=x
x + x’ = 1
(x’)’ = x
x+y=y+x
x + (y + z) = (x + y) + z
x(y + z) = xy + xz
(x + y)’ = x’y’
June 17, 2003 x
x
x
x [ Commutative ]
[ Distributive ]
[ y’ + y = 1 ]
[ x’ • 1 = x’ ]
[ Distributive! ]
[ x’ + x = 1 ] •1=x
•0=0
•x=x
• x’ = 0 xy = yx
Commutative
x(yz) = (xy)z
Associative
x + yz = (x + y)(x + z) Distributive
(xy)’ = x’ + y’
DeMorgan’s Law
Boolean algebra 11 Simpler expressions yield simpler hardware
Here are circuits corresponding to the original and simplified expressions. June 17, 2003 Boolean algebra 12 Proofs with truth tables
We also can prove that two expressions are equivalent by showing that
they always produce the same results for the same inputs.
x y 0
0
1
1 0
1
0
1 x + y (x + y)’
0
1
1
1 1
0
0
0 x y x’ y’ x’y’ 0
0
1
1 0
1
0
1 1
1
0
0 1
0
1
0 1
0
0
0 Here are truth tables proving one of DeMorgan’s Laws, (x + y)’ = x’y’.
— The leftmost columns in each table show all the possible inputs.
— The columns on the right are the outputs.
— Additional columns can aid in showing intermediate results.
Both of the output columns are the same, so we know that (x + y)’ and
x’y’ must be equivalent. June 17, 2003 Boolean algebra 13 Duality
There’s a reason why the table of axioms has two columns. The laws on
the left and right are duals of each other.
— The AND and OR operators are exchanged.
— The constant values 0 and 1 are also exchanged.
The dual of any equation is always true. If E and F are two equivalent
expressions, the dual of E will also be equivalent to the dual of F. x+0=x
x+1=1
x+x=x
x + x’ = 1
(x’)’ = x
x+y=y+x
x + (y + z) = (x + y) + z
x(y + z) = xy + xz
(x + y)’ = x’y’
June 17, 2003 x
x
x
x •1=x
•0=0
•x=x
• x’ = 0 xy = yx
Commutative
x(yz) = (xy)z
Associative
x + yz = (x + y)(x + z) Distributive
(xy)’ = x’ + y’
DeMorgan’s Law
Boolean algebra 14 Some more laws
Some other useful equations are shown below.
— They can all be proven from the axioms we already showed.
— Notice that each law also has a dual.
Feel free to use these in homeworks and exams.
x + xy = x
xy + xy’ = x
x + x’y = x + y
xy + x’z + yz = xy + x’z June 17, 2003 x(x + y) = x
(x + y)(x + y’) = x
x(x’ + y) = xy
(x + y)(x’ + z)(y + z) = (x + y)(x’ + z) Boolean algebra 15 Why is it called Boolean algebra?
It was invented by George Boole way back in the 1850s!
Obviously, that was before they had digital cameras. It wasn’t until about 1937 that Claude Shannon got the idea
to apply Boolean algebra to circuit design.
This, as well as several other things, made Shannon so richandfamous that he retired when he was just 50. June 17, 2003 Boolean algebra 16 Complementing a truth table
The complement of a function should output 0 when the original function
outputs 1, and vice versa.
In a truth table, we can just exchange 0 and 1 in the output column.
— On the left is a truth table for f(x,y,z) = (x + y’)z + x’.
— On the right is the table for the complement of f, denoted f’(x,y,z).
x z f(x,y,z) x y z f’(x,y,z) 0
0
0
0 0
0
1
1 0
1
0
1 1
1
1
1 0
0
0
0 0
0
1
1 0
1
0
1 0
0
0
0 1
1
1
1 June 17, 2003 y 0
0
1
1 0
1
0
1 0
1
0
1 1
1
1
1 0
0
1
1 0
1
0
1 1
0
1
0 Boolean algebra 17 Complementing an expression
To complement an expression, you can use DeMorgan’s Laws to keep
“pushing” the NOT operator inwards, all the way to the literals.
f(x,y,z) = (x + y’)z + x’
f’(x,y,z) = ((x + y’)z + x’)’
= ((x + y’)z)’ • (x’)’
= ((x + y’)’ + z’) • x
= (x’y + z’) • x [ complementing both sides ]
[ because (x + y)’ = x’y’ ]
[ (xy)’ = x’ + y’, and (x’)’ = x ]
[ (x + y)’ = x’y’ again ] Another clever method of complementing an expression is to take the
dual of the expression, and then complement each literal.
— The dual of (x + y’)z + x’ is (xy’ + z) • x’.
— Complementing each literal yields (x’y + z’) • x.
— So f’(x,y,z) = (x’y + z’) • x. June 17, 2003 Boolean algebra 18 Sum of products expressions
There are many equivalent ways to write a function, but some forms turn
out to be more useful than others.
A sum of products or SOP expression consists of:
— One or more terms summed (OR’ed) together.
— Each of those terms is a product of literals.
f(x, y, z) = y’ + x’yz’ + xz
Sum of products expressions can be implemented with twolevel circuits. Levels:
June 17, 2003 0 1 Boolean algebra 2
19 Minterms
A minterm is a special product of literals, in which each input variable
appears exactly once.
A function with n input variables has 2n possible minterms.
For instance, a threevariable function f(x,y,z) has 8 possible minterms:
x’y’z’
x y’z’ x’y’z
x y’z x’y z’
x y z’ x’y z
xyz Each minterm is true for exactly one combination of inputs.
Minterm
x’y’z’
x’y’z
x’y z’
x’y z
x y’z’
x y’z
x y z’
xyz
June 17, 2003 True when Shorthand
xyz = 000
m0
xyz = 001
m1
xyz = 010
m2
xyz = 011
m3
xyz = 100
m4
xyz = 101
m5
xyz = 110
m6
m7
xyz = 111
Boolean algebra Hey! This
looks like a
truth table! 20 Sum of minterms expressions
A sum of minterms is a special kind of sum of products.
Every function can be written as a unique sum of minterms expression.
A truth table for a function can be rewritten as a sum of minterms just by
finding the table rows where the function output is 1.
x y z 0
0
0
0 0
0
1
1 0
1
0
1 0
0
0
1 1
1
1
0 1
1
1
1 0
0
1
1 0
1
0
1 0
1
1
1 1
0
0
0 June 17, 2003 C(x,y,z) C’(x,y,z) C = x’yz + xy’z + xyz’ + xyz
= m3 + m5 + m6 + m7
= Σm(3,5,6,7)
C’ = x’y’z’ + x’y’z + x’yz’ + xy’z’
= m0 + m1 + m2 + m4
= Σm(0,1,2,4)
C’ contains all the minterms not in C,
and vice versa. Boolean algebra 21 Product of sums expressions
As you might expect, we can work with the duals of these ideas too.
A product of sums or POS consists of:
— One or more terms multiplied (AND’ed) together.
— Each of those terms is a sum of literals.
g(x, y, z) = y’(x’ + y + z’)(x + z)
Products of sums can also be implemented with twolevel circuits. Levels:
June 17, 2003 0 1 Boolean algebra 2
22 Maxterms
A maxterm is a sum of literals where each input variable appears once.
A function with n input variables has 2n possible maxterms.
For instance, a function with three variables x, y and z has 8 possible
maxterms:
x+y+z
x’+ y + z x + y + z’
x’+ y + z’ x + y’+ z
x’+ y+ z x + y’+ z’
x’+ y’+ z’ Each maxterm is false for exactly one combination of inputs.
Maxterm
x+y+z
x + y + z’
x + y’+ z
x + y’+ z’
x’+ y + z
x’+ y + z’
x’+ y’+ z
x’+ y’+ z’
June 17, 2003 False when Shorthand
xyz = 000
M0
xyz = 001
M1
xyz = 010
M2
xyz = 011
M3
xyz = 100
M4
xyz = 101
M5
xyz = 110
M6
M7
xyz = 111
Boolean algebra 23 Product of maxterms expressions
Every function can also be written as a unique product of maxterms.
A truth table for a function can be rewritten as a product of maxterms
just by finding the table rows where the function output is 0.
x y z 0
0
0
0 0
0
1
1 0
1
0
1 0
0
0
1 1
1
1
0 1
1
1
1 0
0
1
1 0
1
0
1 0
1
1
1 1
0
0
0 June 17, 2003 C(x,y,z) C’(x,y,z) C = (x + y + z)(x + y + z’)
(x + y’ + z)(x’ + y + z)
= M0 M1 M2 M4
= ∏M(0,1,2,4)
C’ = (x + y’ + z’)(x’ + y + z’)
(x’ + y’ + z)(x’ + y’ + z’)
= M3 M5 M6 M7
= ∏M(3,5,6,7)
C’ contains all the maxterms not in
C, and vice versa. Boolean algebra 24 Minterms and maxterms, oh my!
Now we’ve seen two different ways to write the function C, as a sum of
minterms Σm(3,5,6,7) and as a product of maxterms ΠM(0,1,2,4).
Notice the product term includes maxterm numbers whose corresponding
minterms do not appear in the sum expression.
x z C(x,y,z) 0
0
0
0 0
0
1
1 0
1
0
1 0
0
0
1 1
1
1
1 June 17, 2003 y 0
0
1
1 0
1
0
1 0
1
1
1 C = x’yz + xy’z + xyz’ + xyz
= m3 + m5 + m6 + m7
= Σm(3,5,6,7)
C = (x + y + z)(x + y + z’)
(x + y’ + z)(x’ + y + z)
= M0 M1 M2 M4
= ∏ M(0,1,2,4) Boolean algebra 25 The relationship revealed
Every minterm mi is the complement of its corresponding maxterm Mi.
Minterm
(m0) x’y’z’
(m1) x’y’z
(m2) x’y z’
(m3) x’y z
(m4) x y’z’
(m5) x y’z
(m6) x y z’
(m7) x y z True when
xyz = 000
xyz = 001
xyz = 010
xyz = 011
xyz = 100
xyz = 101
xyz = 110
xyz = 111 Maxterm
(M0) x + y + z
(M1) x + y + z’
(M2) x + y’+ z
(M3) x + y’+ z’
(M4) x’+ y + z
(M5) x’+ y + z’
(M6) x’+ y’+ z
(M7) x’+ y’+ z’ False when
xyz = 000
xyz = 001
xyz = 010
xyz = 011
xyz = 100
xyz = 101
xyz = 110
xyz = 111 For example, m4’ = M4 because (xy’z’)’ = x’ + y + z. June 17, 2003 Boolean algebra 26 Converting between standard forms
We can convert sums of minterms to products of maxterms algebraically.
C = Σm(3,5,6,7) C’ = Σm(0,1,2,4)
= m0 + m1 + m2 + m4 [ C’ contains the minterms not in C ] (C’)’ = (m0 + m1 + m2 + m4)’ [ complementing both sides ]
C
= m0’ m1’ m2’ m4’
[ DeMorgan’s law ]
= M0 M 1 M 2 M 4
[ from the previous page ]
= ∏M(0,1,2,4)
The easy way is to replace minterms with maxterms, using the maxterm
numbers that do not appear in the sum of minterms.
C = Σm(3,5,6,7)
= ∏ M(0,1,2,4) June 17, 2003 Boolean algebra 27 Summary
We saw two ways to prove the equivalence of expressions.
— Truth tables show that all possible inputs yield the same outputs.
— Boolean algebra is especially useful for simplifying expressions, and
therefore circuits as well.
Expressions can be written in many ways, so standard representations
like sums of products and sums of minterms are often useful. We will
sometimes see products of sums and products of maxterms too.
Tomorrow we’ll introduce a more “graphical” simplification technique.
Then we can start to build and analyze larger, more realistic circuits! June 17, 2003 Boolean algebra 28 ...
View
Full
Document
 Fall '09
 howardhuang

Click to edit the document details