Docsity

Boolean Algebra and Circuit Design: Sum of Minterms and Karnaugh Maps, Study notes of Computer Architecture and Organization

Partial preview of the text

Download Boolean Algebra and Circuit Design: Sum of Minterms and Karnaugh Maps and more Study notes Computer Architecture and Organization in PDF only on Docsity!

CS231 Boolean Algebra

Circuit analysis summary

•^ After finding the circuit inputs and outputs, you can come up witheither an expression or a truth table to describe what the circuit does.•^ You can easily convert between expressions and truth tables.

Find the circuit’sinputs and outputs Find a Booleanexpressionfor the circuit

Find a truth tablefor the circuit

CS231 Boolean Algebra

Boolean operations summary

•^ We can interpret high or low voltage as representing true or false.•^ A variable whose value can be either 1 or 0 is called a Boolean variable.•^ AND, OR, and NOT are the basic Boolean operations.•^ We can express Boolean functions with either an expression or a truthtable.•^ Every Boolean expression can be converted to a circuit.•^ Next time, we’ll look at how Boolean algebra can help simplifyexpressions, which in turn will lead to simpler circuits.

CS231 Boolean Algebra

Formal definition of Boolean algebra

•^ A Boolean algebra requires–^ A set of elements

B , which needs

at least two elements (0 and 1)

–^ Two binary (two-argument) operations OR and AND–^ A unary (one-argument) operation NOT–^ The axioms below must always be true (textbook, p. 33)•^ The magenta axioms deal with the complement operation•^ Blue axioms (especially 15) are different from regular algebra1.^ x + 0 = x

2.^ x^ •^ 1 = x 3.^ x + 1 = 1^ 4.^ x^ •^ 0 = 0 5.^ x + x = x^ 6.^ x^ •^ x = x 7.^ x + x’ = 1^ 8.^ x^ •^ x’ = 0 9.^ (x’)’ = x10.^ x + y = y + x 11.^ xy = yx^

Commutative

12.^ x + (y + z) = (x + y) + z 13.^ x(yz) = (xy)z

Associative

14.^ x(y + z) = xy + xz 15.^ x + yz = (x + y)(x + z)

Distributive

16.^ (x + y)’ = x’y’

(xy)’ = x’ + y’^

DeMorgan’s

CS231 Boolean Algebra

Comments on the axioms

•^ The associative laws show that there is no ambiguity about a term suchas x + y + z or xyz, so we can introduce multiple-input primitive gates:•^ The left and right columns of axioms are duals–^ exchange all ANDs with ORs, and 0s with 1s•^ The dual of

any equation is always true 1. x + 0 = x^

2.^ x^ •^ 1 = x 3.^ x + 1 = 1^ 4.^ x^ •^ 0 = 0 5.^ x + x = x^ -^ 6. x x = x 7.^ x + x’ = 1^ 8.^ x^ •^ x’ = 0 9.^ (x’)’ = x10.^ x + y = y + x 11.^ xy = yx^

Commutative

12.^ x + (y + z) = (x + y) + z 13.^ x(yz) = (xy)z

Associative

14.^ x(y + z) = xy + xz 15.^ x + yz = (x + y)(x + z)

Distributive

16.^ (x + y)’ = x’y’

(xy)’ = x’ + y’^

DeMorgan’s

CS231 Boolean Algebra

Proving the rest of the axioms

•^ We can make up truth tables to prove (both parts of) DeMorgan’s law•^ For (x + y)’ = x’y’, we can make truth tables for (x + y)’ and for x’y’x •^ In each table, the columns on the left (x and y) are the inputs. Thecolumns on the right are outputs.•^ In this case, we only care about the columns in blue. The other“outputs” are just to help us find the blue columns.•^ Since both of the columns in blue are the same, this shows that (x + y)’and x’y’ are equivalent

y^ x + y^

(x + y)’^

x^ y^ x’^ y’

x’y’

0 0 0

CS231 Boolean Algebra

Simplification with axioms

•^ We can now start doing some simplificationsx’y’ + xyz + x’y

= x’(y’ + y) + xyz

[ Distributive; x’y’ + x’y = x’(y’ + y) ] = x’•1 + xyz^

[ Axiom 7; y’ + y = 1 ] = x’ + xyz^

[ Axiom 2; x’

  • 1 = x’ ] = (x’ + x)(x’ + yz)

[ Distributive ] = 1^ •^ (x’ + yz)

[ Axiom 7; x’ + x = 1 ] = x’ + yz^

[ Axiom 2 ]

1.^ x + 0 = x^ 2.^ x^ •^ 1 = x 3.^ x + 1 = 1^ 4.^ x^ •^ 0 = 0 5.^ x + x = x^ -^ 6. x x = x 7.^ x + x’ = 1^ 8.^ x^ •^ x’ = 0 9.^ (x’)’ = x10.^ x + y = y + x 11.^ xy = yx^

Commutative

12.^ x + (y + z) = (x + y) + z 13.^ x(yz) = (xy)z

Associative

14.^ x(y + z) = xy + xz 15.^ x + yz = (x + y)(x + z)

Distributive

16.^ (x + y)’ = x’y’

(xy)’ = x’ + y’^

DeMorgan’s

CS231 Boolean Algebra

Some more laws

•^ Here are some more useful laws (p. 37). Notice the duals again!1.^ x + xy = x •^ We can prove these laws by either–^ Making truth tables:–^ Using the axioms:

4.^ x(x + y) = x 2.^ xy + xy’ = x

(x + y)(x + y’) = x

3.^ x + x’y = x + y

6.^

x(x’ + y) = xy xy + x’z + yz = xy + x’z

(x + y)(x’ + z)(y + z) = (x + y)(x’ + z)x^ y^ x’^ x’y^ x + x’y

x^ y^

x + y 0 0

x + x’y = (x + x’)(x + y)

[ Distributive ] = 1^ •^ (x + y)^

[ x + x’ = 1 ] = x + y^

[ Axiom 2 ]

CS231 Boolean Algebra

The complement of a function

•^ The complement of a function always outputs 0 where the originalfunction outputted 1, and 1 where the original produced 0.•^ In a truth table, we can just exchange 0s and 1s in the output column(s)f(x,y,z) = x(y’z’ + yz)x^

y^ z^ f(x,y,z) 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 0

x^ y^ z^ f’(x,y,z) 0 0 0

CS231 Boolean Algebra

Standard forms of expressions

•^ We can write expressions in many ways, but some ways are more usefulthan others•^ A sum of products (SOP) expression contains:–^ Only OR (sum) operations at the “outermost” level–^ Each term that is summed must be a product of literals•^ The advantage is that any sum of products expression can beimplemented using a two-level circuit–^ literals and their complements at the “0th” level–^ AND gates at the first level–^ a single OR gate at the second level•^ This diagram uses some shorthands…–^ NOT gates are implicit–^ literals are reused–^ this is

f(x,y,z) = y’ + x’yz’ + xz not^ okay in LogicWorks!

CS231 Boolean Algebra

Minterms

•^ A minterm is a special product of literals, in which each input variableappears exactly once.•^ A function with n variables has 2

n^ minterms (since each variable can

appear complemented or not)• A three-variable function, such as f(x,y,z), has 2

3 = 8 minterms:

x’y’z’ • Each minterm is true for exactly one combination of inputs:

x’y’z^ x’yz’^ x’yz xy’z’^ xy’z

xyz’^

xyz Minterm^ Is true when…

Shorthand x’y’z’^ x=0, y=0, z=

m^0 x’y’z^ x=0, y=0, z=

m^1 x’yz’^ x=0, y=1, z=

m^2 x’yz^ x=0, y=1, z=

m^3 xy’z’^ x=1, y=0, z=

m^4 xy’z^ x=1, y=0, z=

m^5 xyz’^ x=1, y=1, z=

m^6 xyz^ x=1, y=1, z=

m^7

CS231 Boolean Algebra

The dual idea: products of sums

•^ Just to keep you on your toes...•^ A product of sums (POS) expression contains:–^ Only AND (product) operations at the “outermost” level–^ Each term must be a sum of literals•^ Product of sums expressions can be implemented with two-level circuits–^ literals and their complements at the “0th” level–OR gates

at the first level– a singleAND gate^ at the second level

f(x,y,z) = y’ (x’ + y + z’) (x + z)• Compare this with sums of products

CS231 Boolean Algebra

Maxterms

•^ A maxterm is a

sum^ of literals, in which each input variable appears

exactly once.• A function with n variables has 2

n^ maxterms

•^ The maxterms for a three-variable function f(x,y,z):•^ Each maxterm is

x’ + y’ + z’^ x’ + y’ + zfalse^ for exactly one combination of inputs:

x’ + y + z’

x’+ y + z x + y’ + z’^

x + y’ + z^

x + y + z’^

x + y + z

Maxterm^

Isfalse^ when…

Shorthand x + y + z^

x=0, y=0, z=

M^0

x + y + z’^

x=0, y=0, z=

M^1

x + y’ + z^

x=0, y=1, z=

M^2

x + y’ + z’^

x=0, y=1, z=

M^3

x’ + y + z^

x=1, y=0, z=

M^4

x’ + y + z’^

x=1, y=0, z=

M^5

x’ + y’ + z^

x=1, y=1, z=

M^6

x’ + y’ + z’^

x=1, y=1, z=^

M^7

CS231 Boolean Algebra

Minterms and maxterms are related

•^ Any minterm m

is thecomplementi

of the corresponding maxterm M

i

•^ For example, m

’ = Mbecause (xy’z’)’ = x’ + y + z 44

Maxterm^ Shorthandx + y + z^

M^0

x + y + z’^

M^1

x + y’ + z^

M^2

x + y’ + z’^

M^3

x’ + y + z^

M^4

x’ + y + z’^

M^5

x’ + y’ + z^

M^6

x’ + y’ + z’^

M^7

Minterm^ Shorthandx’y’z’^

m^0 x’y’z m^1 x’yz’ m^2 x’yz m^3 xy’z’ m^4 xy’z m^5 xyz’ m^6 xyz m^7

CS231 Boolean Algebra

Converting between standard forms

•^ We can convert a sum of minterms to a product of maxtermsFrom before •^ In general, just replace the minterms with maxterms, using maxtermnumbers that don’t appear in the sum of minterms:•^ The same thing works for converting from a product of maxterms to asum of minterms

f^ =^ Σm(0,1,2,3,6) and^

f’^ =^ Σm(4,5,7)= m+ m^4

  • m^5 complementing

(f’)’ = (m^4

  • m+ m)’^5 so^

f^ = m’ m’ m^45

’^ [ DeMorgan’s law ]^7 = M MM[ By the previous page ] (^4 5 7) = $M(4,5,7) f =^ Σm(0,1,2,3,6)=^ $M(4,5,7)