Copyright © Curt Hill Minimization Arbitrary Truth Table to Minimal Function
Copyright © 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
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
Copyright © 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
Copyright © 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
Copyright © 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
Copyright © Curt Hill Example p q T T T T F F F F T T T F p q p q p q (p q) ( p q) ( p q)
Copyright © 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
Copyright © 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
Copyright © 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
Copyright © 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
Copyright © 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
Copyright © 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
Copyright © Curt Hill Example p q pq p’q pq’ The trues are {1,2,3}
Copyright © 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
Copyright © 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
Copyright © 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
Copyright © 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)
Copyright © 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
Copyright © Curt Hill First Example p q (p’+q) or p q
Copyright © Curt Hill Second Example p q p q or (p’+q’) p q or (p+q) ( p q) (p q) or (p’+q’) (p+q)
Copyright © 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
Copyright © 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
Copyright © 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:
Copyright © Curt Hill Example: {0,1,3,5,7} xyzf 0001X’Y’Z’ 0011X’Y’Z X’YZ XY’Z XYZ
Copyright © 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
Copyright © 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
Copyright © Curt Hill Example: {0,1,3,5,7} xyzf 0001X’Y’Z’ 0011X’Y’Z X’YZ XY’Z XYZ
Copyright © Curt Hill Example as Karnaugh Map X YZ = 0Z =
Copyright © 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
Copyright © 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
Copyright © 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
Copyright © 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
Copyright © Curt Hill Truth Table: {2,6,8,9,12,13} wxyz wxyz
Copyright © Curt Hill Disjunctive normal form wxyz wxyz w’x’yz’+ w’xyz’+ wx’y’z’+ wx’y’z+ wxy’z’+ wxy’z
Copyright © Curt Hill Karnaugh Map {2,6,8,9,12,13} W X /Y Z
Copyright © Curt Hill Adjacents W X /Y Z
Copyright © Curt Hill Elimination W X /Y Z w’yz’ + wy’
Copyright © Curt Hill Example 2: Truth table contains: {1,4,6,9,12,14} This should reduce to two terms
Copyright © Curt Hill Truth Table: {1,4,6,9,12,14} wxyz wxyz
Copyright © Curt Hill Disjunctive normal form w’x’y’z+ w’xy’z’+w’xyz’+ wx’y’z+ wxy’z’+ wxyz’ wxyz wxyz
Copyright © Curt Hill Karnaugh Map {1,4,6,9,12,14} W X /Y Z
Copyright © Curt Hill Adjacents {1,4,6,9,12,14} W X /Y Z
Copyright © Curt Hill Elimination {1,4,6,9,12,14} W X /Y Z xz’ + x’y’z
Copyright © 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
Copyright © Curt Hill Truth Table:{0,4,5,7,8,9,13,15} wxyz wxyz
Copyright © Curt Hill Disjunctive Normal Form wxyz wxyz w’x’y’z’ + w’xy’z’ + w’xy’z + w’xyz + wx’y’z’ + wxyz’ + wxy’z + wxyz
Copyright © Curt Hill Map {0,4,5,7,8,9,13,15} W X /Y Z
Copyright © Curt Hill Adjacents (1) W X /Y Z x’y’z’ + w’xy’ + wy’z + xz
Copyright © Curt Hill Adjacents (2) W X /Y Z w’y’z’ + wx’y’ + xz
Copyright © 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
Copyright © 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
Copyright © 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
Copyright © Curt Hill Five Variable Map WX/YZ WX/YZ V = 0 V = 1 x’y’z’ + v’xz + vw’yz’ + wx’y’z
Copyright © 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