karnaugh maps - s3.amazonaws.com · cs031 lecture 3 (b) 10 minimization the basic strategy 1. draw...
TRANSCRIPT
Lecture 3 (b) 4CS031
Abstraction Hierarchy
Programming Language
Assembly Language
Machine Language
Sequential Circuit
Combinational Circuit
Binary Value
Voltage
Programming Language
Assembly Language
Machine Language
Sequential Circuit
Combinational Circuit
Binary Value
Voltage
Lecture 3 (b) 5CS031
Minimizing BooleanFunctions
The problem• Given a truth table, find a small circuit
to compute it• The problem is very hard in general
(no really efficient algorithm exists)Possible solutions
• Put the function as a sum of productsand build the corresponding circuit
• Put the function as product of sumsand build the corresponding circuit
Limitation• The size of the circuit may be far from
the minimal sizeKarnaugh Maps
• A manual and heuristic method tominimize the size of the circuit
Lecture 3 (b) 6CS031
Karnaugh Map
Another Presentation of a Truth Table
The Karnaugh map looks like this
Lecture 3 (b) 8CS031
Karnaugh Maps
Property• Adjacent entries differ by at most one
variable
• The whole table is wrapping up onitself. The end of a row is adjacent tothe beginning of the row and so on.
Lecture 3 (b) 10CS031
Minimization
The basic strategy1. Draw the Karnaugh map2. Fill it with the truth table3. Cover all the 1s with boxes of size 1, 2, 4, 8,
16. ... (an entry can be covered by severalboxes if needed)
4. Generate a product for each box; eachelement of the product corresponds to avariable which stays constant over the box. Itis the variable if the variable stays at 1 andthe negation of the variable otherwise.
5. The result is the sum of all these products
The main goal• As few boxes as possible• The biggest possible boxes
Lecture 3 (b) 11CS031
A simplification
Another Presentation of a Truth Table
The Karnaugh map looks like this
What is the boolean function?
Lecture 3 (b) 12CS031
A simplification
Another Presentation of a Truth Table
The Karnaugh map looks like this
What is the boolean function?f(a,b)=a’
Lecture 3 (b) 14CS031
Another Simplification Problem
Sum of Products gives us:f(x,y,z) = x’yz + xy’z’ + xyz’ + xyz
Karnaugh map:
Lecture 3 (b) 15CS031
Another Simplification Problem
Sum of Products gives us:f(x,y,z) = x’yz + xy’z’ + xyz’ + xyz
Karnaugh map:
f(x,y,z) = yz + xz’
Lecture 3 (b) 17CS031
Don’t CaresSometimes, it doesn’t matter exactlywhich output is generated in a certainsituation.A don’t care value is represented by ax and we can choose any value thatis convenient to us.
What do we choose?By setting the left and right x’s to 1 wecan make a 2x2 square, reducing thefunction to: f(x,y,z)=z’
Lecture 3 (b) 18CS031
Don’t CaresSometimes, it doesn’t matter exactlywhich output is generated in a certainsituation.A don’t care value is represented by ax and we can choose any value thatis convenient to us.
What do we choose?By setting the left and right x’s to 1 wecan make a 2x2 square, reducing thefunction to: f(x,y,z)=z’
1
1
Lecture 3 (b) 19CS031
We Still Don’t Care!
What if the x’s were 0’s?
f(w,x,y,z)=(w’x’y) + (w’xz) + (xyz)
Lecture 3 (b) 20CS031
We Still Don’t Care!
What if the x’s were 0’s?f(w,x,y,z)=(w’x’y) + (w’xz) + (xyz)
What if they’re don’t cares?
Lecture 3 (b) 21CS031
We Still Don’t Care!
What if the x’s were 0’s?f(w,x,y,z)=(w’x’y) + (w’xz) + (xyz)
What if they’re don’t cares?f(w,x,y,z)=(x’y) + (xz)
How many operations do we save?Including negations, 11-4=7