copyright © 2007-2013 curt hill minimization arbitrary truth table to minimal function

55
Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Upload: lilian-elliott

Post on 18-Jan-2018

219 views

Category:

Documents


0 download

DESCRIPTION

Copyright © Curt Hill Adequacy Example The whole notion of adequacy was worked out by logicians in the early part of the century In the latter part of the century some computer companies stocked only NAND gates –Because with this one gate made any logic function possible –Even a computer, which is a very complicated function Some did use NORs instead

TRANSCRIPT

Page 1: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Minimization

Arbitrary Truth Table to Minimal Function

Page 2: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Introduction• In the last half of the twentieth

century logic had a new use:– Construction of digital computers

• Engineers become involved where only mathematicians had been before

• Every form of mathematics is useful in practical matters– The use has not always been discovered– Logic is discovered for computing

Page 3: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Adequacy Example• The whole notion of adequacy was

worked out by logicians in the early part of the century

• In the latter part of the century some computer companies stocked only NAND gates– Because with this one gate made any

logic function possible– Even a computer, which is a very

complicated function• Some did use NORs instead

Page 4: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Approach• This is an engineering sort of

approach• The object is that we have a series

of Boolean variables that we wish to manipulate in some way

• Usually we want to find the minimal gate sequence that we can use to implement

Page 5: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Goal• Three steps

– We start with an arbitrary truth table– Next we generate the function for it– Finally we minimize that function

• The first step is done based on the logic function we need– Such as an adder

• Recall the second step

Page 6: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Function Generation• Take any truth table with N

variables• Consider the result column• For each column with a true

– Combine all the variables with conjunctions

– Those that are true remain unchanged– Those that are false are negated

• Each column that is false is ignored• Combine all of these expressions

with disjunctions

Page 7: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Example

p q

T

T

T

T

F

F

F

F

T

TT

F

p q

p q

p q

(p q) ( p q) ( p q)

Page 8: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

The Problem• We have a simple operator and we

produced a very large expression• Thus

p q May be replaced by:(p q) ( p q) ( p q)

• This is no bargain• Thus we need to minimize this for

economic reasons

Page 9: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Minimization• If each And/Or/Not may be

implemented by a single gate• We want to minimize the number

of gates we need to implement the function

• Here we are not proving that one is equivalent to another

• Instead we are finding the minimized equivalent

Page 10: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Notation• In theorems we have used a notation

that involves special symbols for And Or etc

• The engineers cannot leave well enough alone

• They typically use yet another new notation

• Mathematicians do their work on paper or blackboard

• Engineers need something both precise and easy to reproduce

Page 11: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

New Notation• And is represented as a multiply

– Like multiplication symbol omitted• Or as an add• Negation is usually a bar over the

top or an accent that follows • Zeros represent falses, ones trues• So the expression (p q) (s r)

becomes• pq’ + sr or

pǭ + sr

Page 12: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Precedence is different as well

• In the axiomatic approach Conjunction and Disjunction have the same precedence – So we always parenthesize them

when they are together• Here And has higher precedence

than Or– Just as multiply has higher

precedence than addition

Page 13: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Numbering• Since binary is a perfectly fine

number system we can also represent rows by their binary numeric value

• Thus row x = 1, y = 0, z = 1 is 5– 101 in binary is 5

• Because of this engineers are more likely to have the first row as all falses, which becomes 0

Page 14: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Example

p q

1

1

1

1

0

0

0

0

1

11

0

pq

p’q

pq’

The trues are {1,2,3}

Page 15: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Normal Forms• A normal form is a standard way to

write an expression or equation– You may recall slope intercept form of

the linear equation or standard form for a polynomial

• Two common ones in this context are:

• Disjunctive Normal Form• Conjunctive Normal Form

Page 16: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Disjunctive normal form• A form that we may use in

minimization• Each expression is a series of

terms connected by disjunctions • Each term is a product of

conjunctions• No parentheses are needed• Also known as sum of products

because the AND corresponds to multiply and OR to addition

Page 17: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Example• This is the form we get from the

process described earlier• In old notation:

(p q) ( p q) ( p q)• In new notation:

pq + p’q + pq’• This is Disjunctive normal form

Page 18: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Conjunctive normal form• Each term is a series of

disjunctions• These are parenthesized and result

uses conjunctions to connect• This is also known as product of

sums form• For example:

(p+q)(q+r’)(p’+q’+r’)which is same as (p q) (q r) ( p q r)

Page 19: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Another process• There is also a way to get

conjunctive normal form out of an arbitrary truth table

• Here you find each false in result column

• Compose a sum of each false in the operand columns

• Use conjunction to connect all of these sums

Page 20: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

First Example

p q

1

1

1

1

0

0

0

0

1

1

1

0 (p’+q) or p q

Page 21: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Second Example

p q

0

0

0

0

1

1

1

1

1

0

1

0

p q or (p’+q’)

p q or (p+q)

( p q) (p q) or (p’+q’) (p+q)

Page 22: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Minimization• Once we have an expression we

then want to minimize• One of the tools to solve this kind

of problem is a Karnaugh map• A Karnaugh map is a modified

truth table that makes simplification easier

• Once in the Karnaugh map, adjacent rectangular areas are subject to minimization

Page 23: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

What it does• The point of a Karnaugh map is to

make obvious two expressions that have the form:– xyz or xy’z

• These two terms are the same except for the negation of y

• We can rearrange that to xz(y + y’)• With the law of excluded middle and

true as the unit of conjunction we get• xz

Page 24: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Truth Tables• Truth tables only show this when it

is the rightmost variable that changes

• Other variables tend not to be near the corresponding expression that is similar except for a single negated variable

• Consider the following:

Page 25: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Example: {0,1,3,5,7}x y z f0 0 0 1 X’Y’Z’0 0 1 1 X’Y’Z0 1 0 00 1 1 1 X’YZ1 0 0 01 0 1 1 XY’Z1 1 0 01 1 1 1 XYZ

Page 26: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Discussion• It is easy to see x’y’z and x’y’z’

may be minimized• What is not so easy is that xyz and

x’yz may be minimized– They are not close to one another

• A Karnaugh map makes this easier by forcing adjacent squares to only have one difference

Page 27: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Karnaugh maps• Arrange the values in a rectangle

of 8 slots for three variables and a square of 16 slots for four

• The numbering of the rows and columns is peculiar

• Not numbered sequentially• Numbered so that only one bit

changes at a time

Page 28: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Example: {0,1,3,5,7}x y z f0 0 0 1 X’Y’Z’0 0 1 1 X’Y’Z0 1 0 00 1 1 1 X’YZ1 0 0 01 0 1 1 XY’Z1 1 0 01 1 1 1 XYZ

Page 29: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Example as Karnaugh MapX Y Z = 0 Z = 1

0 1 1

1 1 1

1 0 1

0 0 1 1

Page 30: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Discussion• Notice the odd numbering of the rows

– Change only one position at a time• Any numbering will work as long as

only one bit changes at a time– Thus adjacent cells have all but one bit

the same• A Karnaugh map wraps left to right

and top to bottom• A group of three is two different

minimizations with a leftover

Page 31: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Process• Create the numbered rectangle• Mark only the true squares with

ones• Wherever there are adjacent slots

of ones that means that you have something like pqr or pqr’ which means the r can be eliminated from the expression

Page 32: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

The minimization• Look for rectangles where a side is

a power of two• It does not matter if the rectangles

overlap, because of idempotency– Often you get one minimization or the

other

Page 33: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Example• Truth Table contains

{2,6,8,9,12,13}• Draw the truth table• Calculate the disjunctive normal

form• Now draw the Karnaugh Map• Circle the adjacent items• Eliminate those variables that can

be eliminated to combine expressions

Page 34: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Truth Table: {2,6,8,9,12,13}

w x y z0 0 0 00 0 0 10 0 1 0 10 0 1 10 1 0 00 1 0 10 1 1 0 10 1 1 1

w x y z1 0 0 0 11 0 0 1 11 0 1 01 0 1 11 1 0 0 11 1 0 1 11 1 1 01 1 1 1

Page 35: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Disjunctive normal formw x y z0 0 0 00 0 0 10 0 1 0 10 0 1 10 1 0 00 1 0 10 1 1 0 10 1 1 1

w x y z1 0 0 0 11 0 0 1 11 0 1 01 0 1 11 1 0 0 11 1 0 1 11 1 1 01 1 1 1

w’x’yz’+ w’xyz’+ wx’y’z’+ wx’y’z+ wxy’z’+ wxy’z

Page 36: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Karnaugh Map {2,6,8,9,12,13}

W X /Y Z

0 0

1 0

1 1

0 1

0 0

1

0 1

1

1 1 1 1

1 0 1 1

Page 37: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

AdjacentsW X /Y

Z 0

0 1

0 1

1 0

10

01

0 1

1

1 1 1 1

1 0 1 1

Page 38: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

EliminationW X /Y

Z 0

0 1

0 1

1 0

10

01

0 1

1

1 1 1 1

1 0 1 1

w’yz’ + wy’

Page 39: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Example 2:• Truth table contains:

{1,4,6,9,12,14}• This should reduce to two terms

Page 40: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Truth Table: {1,4,6,9,12,14}

w x y z0 0 0 00 0 0 1 10 0 1 00 0 1 10 1 0 0 10 1 0 10 1 1 0 10 1 1 1

w x y z1 0 0 01 0 0 1 11 0 1 01 0 1 11 1 0 0 11 1 0 11 1 1 0 11 1 1 1

Page 41: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Disjunctive normal form

w’x’y’z+ w’xy’z’+w’xyz’+ wx’y’z+ wxy’z’+ wxyz’

w x y z0 0 0 00 0 0 1 10 0 1 00 0 1 10 1 0 0 10 1 0 10 1 1 0 10 1 1 1

w x y z1 0 0 01 0 0 1 11 0 1 01 0 1 11 1 0 0 11 1 0 11 1 1 0 11 1 1 1

Page 42: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Karnaugh Map {1,4,6,9,12,14}

W X /Y Z

0 0

1 0

1 1

0 1

0 0

1

0 1

1 1

1 1 1 1

1 0 1

Page 43: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Adjacents {1,4,6,9,12,14}W X /Y

Z 0

0 1

0 1

1 0

10

01

0 1

1 1

1 1 1 1

1 0 1

Page 44: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Elimination {1,4,6,9,12,14}

W X /Y Z

0 0

1 0

1 1

0 1

0 0

1

0 1

1 1

1 1 1 11 0 1

xz’ + x’y’z

Page 45: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

One More Example• Consider the truth table with the

following values {0,4,5,7,8,9,13,15}

• There are at least two different coverings for this

Page 46: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Truth Table:{0,4,5,7,8,9,13,15}

w x y z0 0 0 0 10 0 0 10 0 1 00 0 1 10 1 0 0 10 1 0 1 10 1 1 00 1 1 1 1

w x y z1 0 0 0 11 0 0 1 11 0 1 01 0 1 11 1 0 01 1 0 1 11 1 1 01 1 1 1 1

Page 47: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Disjunctive Normal Formw x y z0 0 0 0 10 0 0 10 0 1 00 0 1 10 1 0 0 10 1 0 1 10 1 1 00 1 1 1 1

w x y z1 0 0 0 11 0 0 1 11 0 1 01 0 1 11 1 0 01 1 0 1 11 1 1 01 1 1 1 1

w’x’y’z’ + w’xy’z’ + w’xy’z + w’xyz + wx’y’z’ + wxyz’ + wxy’z + wxyz

Page 48: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Map {0,4,5,7,8,9,13,15}W X /Y

Z 0

0 1

0 1

1 0

10

01

0 1

1 1 1

1 1 1 1

1 0 1 1

Page 49: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Adjacents (1)W X /Y

Z 0

0 1

0 1

1 0

10

01

0 1

1 1 1

1 1 1 11 0 1 1

x’y’z’ + w’xy’ + wy’z + xz

Page 50: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Adjacents (2)W X /Y

Z 0

0 1

0 1

1 0

10

01

0 1

1 1 1

1 1 1 11 0 1 1

w’y’z’ + wx’y’ + xz

Page 51: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Notes• There are two separate ways to

cover this– x’y’z’ + w’xy’ + wy’z + xz– w’y’z’ + wx’y’ + xz

• The second is the unique minimum

Page 52: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Larger maps• Karnaugh maps are fairly easy with

fewer than five variables since they are either squares or rectangles

• It gets complicated when five or more variables are used

• These need to be more than two dimensional

• Five is a three dimensional rectanguloid

• The dimensions are 4, 4, 2

Page 53: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Continued• Usually written as two adjacent

squares• Identical values in the two squares

are now adjacent and minimizable• Six is a cube with dimensions 4, 4,

4• Usually written with four squares

of 4 by 4• Adjacent values are those that are

the same up and down and right and left

Page 54: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Five Variable MapWX/YZ 0 0

1 0 1 1 0 1

0 0 1

0 1 1 1

1 1 1 11

0 1 1

WX/YZ 0 0

1 0 1 1 0 1

0 0 1 1

0 1 1

1 1

1 0 1 1

V = 0 V = 1

x’y’z’ + v’xz + vw’yz’ + wx’y’z

Page 55: Copyright © 2007-2013 Curt Hill Minimization Arbitrary Truth Table to Minimal Function

Copyright © 2007-2013 Curt Hill

Computer• You can see why computer

minimization is helpful at this and higher levels

• There are numerous computer programs that allow you to do this– An applet is on the web site

• However do not use them for the exercise