Computer Organization I Lecture 8: Boolean Algebra and Circuit Optimization
Overview The simplification from SOM to SOP and their circuit implementation Basics of Logic Circuit Optimization: Cost Criteria Boolean Function Optimization (1) Algebraic Manipulation (2) Karnaugh map
Objectives Understand how to compare implementation cost of two circuits according to cost criteria To know how to use algebraic manipulation to simplify the logic function To understand the basic concepts of Karnaugh map
A Simplification Example from SOM to SOP A Simplification Example: F (A,B,C) = Ʃm (1,4,5,6,7) Writing the minterm expression: F = A B C + A B C + A B C + ABC + ABC Simplifying: F = A + B C Simplified F contains 3 literals compared to 15 in minterm F
AND/OR Two-level Diagram of SOM and SOP The two implementations for F are shown below it is quite apparent which is simpler! F in SOM include 15 literals and 6 logic gates; while F in SOP include 3 literals and 2 logic gates A B C A B C A B C A B C A B C F A B C We assume the input variables are directly available in their complemented and uncomplemented forms F
Some Conclusions on SOM/SOP and SOM/POM So far we have known: Standard Forms (Sum-of-minterms, Product-of-Maxterms), or alternative standard form (SOP, POS) differ in complexity Boolean algebra can be used to manipulate equations into simpler forms. Simpler equations lead to simpler two-level implementations Questions left to us: Is there only one minimum cost circuit? apply the cost criteria to compare complexity of circuits How can we attain a simplest expression? apply Boolean algebraic manipulations or graphical technique (i.e. Karnaugh maps, K-maps) to simply (or optimize) expression
Cost Criteria of Logic Circuit Implementation Literal Cost (L) Gate Input Cost (G) Gate Input Cost with NOTs (GN)
Cost Criteria of Logic Circuit Implementation - Literal Cost Literal a variable or its complement Literal cost the number of literal appearances in a Boolean expression corresponding to the logic circuit diagram Examples: F = BD + AB C + ACD L = 8 F = BD + ABC + ABD + ABC L = 11 F = (A + B)(A + D)(B + C + D)(B + C + D) L = 10 Which solution is best?
Cost Criteria of Logic Circuit Implementation - Gate Input Cost Gate Input Costs - the number of inputs to the gates in the implementation corresponding exactly to the given equation or equations. It can be found from the equation(s) by finding the sum of: all literal appearances the number of terms excluding single literal terms, and optionally, the number of distinct complemented single literals Gate input cost denoted by G if inverters not counted or GN if inverters counted. Example: F = BD + ABC + ACD G = 11, GN = 14 F = BD + ABC + ABD + ABC G =?, GN =? F = (A + B)(A + D)(B + C + D)(B + C + D) G =?, GN =?
Cost Criteria of Logic Circuit Implementation - An Example Example 1: F = A + B C + B C GN = G + 2 = 9 L = 5 G = L + 2 = 7 B C A F L (literal count) counts the AND inputs and the single literal OR input. G (gate input count) adds the remaining OR gate inputs GN(gate input count with NOTs) adds the inverter inputs Chapter 2 -Part 2 10
Cost Criteria of Logic Circuit Implementation - Another Example Example 2: F = A B C + A B C L = 6 G = 8 GN = 11 F = (A + C)(B + C)(A + B) L = 6 G = 9 GN = 12 Same function and same literal cost But first circuit has better gate input count and better gate input count with NOTs Select it! A B C A B C F F
Boolean Function Optimization - What means an optimal function An optimal function can minimize the gate input (or literal) cost of a (a set of) Boolean equation(s) and thus reducing circuit cost. An optimal function has a minimum gate input cost is reasonable since it measures directly number of transistors and wires used in implementing a circuit. The simplest expression is not necessarily unique, sometimes 2 or more expressions satisfy cost criterion applied, in this case either solution is satisfactory from the cost standpoint
Boolean Function Optimization - Approach 1: Algebraic Manipulation Four common rules are frequently applied for simplifying logic functions (1) complement rule: A + A = 1 e.g. A (BC + BC) + ABC + ABC = A (2) absorption rule: A + AB = A e.g. AB + ABC (D + E) = AB (3) a common rule: A + AB = A + B e.g. AB + AC + BC = AB + C (4) an expansion rule: A 1 = A and A + A = 1 e.g. AB + ABC + BC = AB + AC
Why use K-map? Boolean Function Optimization - Approach 2: Karnaugh Maps (K-map) The algebraic manipulation depends on your familiarity with all the laws, rules of Boolean algebra, the K-map, however, Provides a systematic means for: Finding optimum or near optimum SOP and POS forms, and two-level AND/OR and OR/AND circuit implementations for functions with small numbers of variables (usually number of variables no more than 4) Visualizing concepts related to manipulating Boolean expressions, and Demonstrating concepts used by computer-aided design programs to simplify large circuits
Boolean Function Optimization - Approach 2: Karnaugh Maps (K-map) What is K-map? K-map is an array of squares, in which Each square represents a minterm; number of squares equal to number of minterms; given Num. of Variables n, total num. of squares is 2 n The array of squares is a graphical representation of a Boolean function and can be considered as an reorganization of truth table y x 0 1 0 1 m 0 m 1 m 2 m 3 y z x 0 1 00 01 11 10 m 0 m 3 m 2 m 4 m 1 m 5 m 7 m 6
Boolean Function Optimization - Approach 2: Karnaugh Maps (K-map) Main Feature of K-map? In K-map, each square is physically adjacent to the squares that are immediately next to it on any of its four side Any two squares are physically adjacent means they are logically adjacent (i.e. the two squares differ in one or only one literal which appears uncomplemented in one and complemented in the other) Logically, squares in the top row are adjacent to the corresponding row in the bottom, similarly for squares in the outer left and outer right y z y x 0 1 0 1 m 0 m 1 m 2 m 3 x 0 1 00 01 11 10 m 0 m 3 m 2 m 4 m 1 m 5 m 7 m 6
Karnaugh Maps (K-map) - An Example: Two Variable K-map A 2-variable Karnaugh Map: Note that minterm m 0 and minterm m 1 are adjacent and differ in the value of the variable y x y Similarly, minterm m 0 and x y minterm m 2 differ in the x variable. Also, m 1 and m 3 differ in the x variable as well. Finally, m 2 and m 3 differ in the value of the variable y y = 0 y = 1 x = 0 m 0 = m 1 = x y x = 1 m 2 = m 3 = x y
Summary Simplification from SOM to SOP Cost Criteria for Comparing Complexity of Circuit Implementation Basics of K-map, including why use K-map, what is K- map and its adjacent attribute.
Thank you Q & A