Presentation is loading. Please wait.

Presentation is loading. Please wait.

Circuit Optimization Goal: To obtain the simplest implementation for a given function Optimization is a more formal approach to simplification that is.

Similar presentations


Presentation on theme: "Circuit Optimization Goal: To obtain the simplest implementation for a given function Optimization is a more formal approach to simplification that is."— Presentation transcript:

1

2 Circuit Optimization Goal: To obtain the simplest implementation for a given function Optimization is a more formal approach to simplification that is performed using a specific procedure or algorithm Optimization requires a cost criterion to measure the simplicity of a circuit Distinct cost criteria we will use: Literal cost (L) Gate input cost (G) Gate input cost including inverters (GN)

3 Literal Cost Literal – a variable or it complement
Literal cost – the number of literal appearances in a Boolean expression corresponding to the logic circuit diagram Example: Boolean expressions for F F = B D + A B C + A C D F = B D + A B C + A B D + A B C F = (A+B)(A+D)(B+C+D)(B+C+D) Which solution is best? L = 8 L = 11 2nd Literal Cost = 11 3rd Literal Cost = 10 The first solution is best L = 10 First solution is best

4 Gate Input Cost L = 8 G = L+3 = 11 GN = G+3 = 14
Gate Input Cost: Count of total number of inputs to the gates in the logic circuit implementation Two gate input costs are defined: G = Count of gate inputs without counting Inverters GN = Count of gate inputs + count of Inverters For SOP and POS equations, the gate input cost can be found from the Boolean expression by finding the sum of: All literal appearances Number of terms excluding single literal terms (added to G) Number of distinct complemented single literals (added to GN) Example: F = B D + A B C + A C D G = 15, GN = 18 (second value includes inverter inputs) G = 14, GN = 17 1st solution is best L = 8 G = L+3 = 11 GN = G+3 = 14

5 Cost Criteria (continued)
GN = G + 2 = 9 GN(gate input count with NOTs) adds the inverter inputs Example 1: F = A + B C + L = 5 L (literal count) counts the AND inputs and the single literal OR input. B C G = L + 2 = 7 G (gate input count) adds the remaining OR gate inputs A B C F

6 Cost Criteria (continued)
B C F Example 2: F = A B C + L = 6 G = 8 GN = 11 F = (A + )( + C)( + 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 first circuit! A B C C B A F A B C

7 Cost Criteria Summary Literal Count: Gate Input Cost (or Count):
Simple to evaluate by counting all literals However, does not represent circuit complexity accurately in all cases Gate Input Cost (or Count): Good measure of logic implementation Proportional to the number of transistors and wires used in the implementation Important when measuring cost of circuits with more than two levels

8 Boolean Function Optimization
Minimizing the gate input (or literal) cost of a Boolean equation reduces the circuit cost We choose gate input cost Boolean Algebra and graphical techniques are tools to minimize cost criteria values Some important questions: When do we stop trying to reduce the cost? Do we know when we have a minimum cost? Treat optimum or near-optimum cost functions for two-level (SOP and POS) circuits first Introduce a graphical technique using Karnaugh maps (K-maps for short)

9 Karnaugh Map (K-map) A K-map is a collection of squares
Each square represents a minterm The collection of squares is a graphical representation of a Boolean function Adjacent squares differ in the value of one variable Alternative algebraic expressions for the same function are derived by recognizing patterns of squares The K-map can be viewed as A reorganized version of the truth table

10 Some Uses of K-Maps Provide a means for:
Finding optimum or near optimum SOP and POS standard forms Two-level AND/OR and OR/AND circuits for functions with small numbers of variables Visualizing concepts related to manipulating Boolean expressions, and Demonstrating concepts used by computer-aided design programs to simplify large circuits

11 Two-Variable K-Map A 2-variable Karnaugh Map:
Minterm m0 and minterm m1 are “adjacent” they differ in the value of variable y Similarly, minterm m0 and minterm m2 are adjacent and differ in x Also, m1 and m3 differ in the x variable Finally, m2 and m3 differ in the y variable m3 = x y m2 = x y x = 1 m1 = x y m0 = x y x = 0 y = 1 y = 0 x y

12 K-Map and Truth Tables The K-Map is a different form of the truth table Truth Table Input Values (x,y) Function Value F(x,y) 0 0 1 0 1 1 0 1 1 K-Map 1 x = 1 x = 0 y = 1 y = 0 x y

13 K-Map Function Minimization
F(x,y) = m0 + m2 + m3 F = x y + x y + x y Two adjacent cells containing 1’s can be combined using the Minimization Theorem K-Map 1 x = 1 x = 0 y = 1 y = 0 x y m0 + m2 = x y + x y = (x + x) y = y m2 + m3 = x y + x y = x (y + y) = x Therefore, F can be simplified as F = x + y

14 Three Variable K-Map z y x x yz
Where each minterm corresponds to the product terms: Note that if the binary value for an index differs in one bit position, the minterms are adjacent on the K-Map yz=00 yz=01 yz=11 yz=10 x=0 m0 m1 m3 m2 x=1 m4 m5 m7 m6 x yz yz=00 yz=01 yz=11 yz=10 x=0 x=1 z y x

15 Alternative K-Map Labeling
K-Map largely involves: Entering values into the map, and Reading off product terms from the map Alternate labelings are useful: y y z z 1 2 4 3 5 6 7 x 00 01 11 10 y z x 1 2 4 3 5 6 7

16 Example Functions y x z y x z F(x, y, z) = ∑(2, 3, 4, 5)
By convention, we represent the minterms of F by a ‘1’ in the map and leave the entries that contain ‘0’ blank Example 1: Example 2: Learn the locations of the 8 indices based on the variable order shown y x 1 2 4 3 5 6 7 z F(x, y, z) = ∑(2, 3, 4, 5) G(x, y, z) = ∑(3, 4, 6, 7) x y 1 2 4 3 5 6 7 z

17 Combining Squares By combining squares, we reduce number of literals in a product term, thereby reducing the gate input cost On a 3-variable K-Map: One square represents a minterm with 3 variables Two adjacent squares represent a term with 2 variables Four adjacent squares represent a term with 1 variable Eight adjacent square is the function 1 (no variables)

18 Example: Combining Squares
y 1 2 4 3 5 6 7 z Example: Applying the Minimization Theorem 3 times: Thus the four terms that form a 2 × 2 square correspond to the term ‘y’. F = ∑(2, 3, 6, 7) y = z yz + x ) , ( F

19 Combining Four Squares
Example Shapes of 4-square Rectangles: x y y z 1 3 2 4 5 7 6 x z

20 Combining Two Squares y x z Example Shapes of 2-square Rectangles: x y
1 3 2 5 6 4 7 x z y z

21 Simplifying 3-Variable Functions
K-Maps can be used to simplify Boolean functions Example: find an optimum SOP equation for F(x, y, z) = ∑ (0, 1, 2, 4, 6, 7) y 1 3 2 5 6 4 7 x z x y z F = Z’ + X’ Y’ + X Y x y F = z + x y + x y

22 Four-Variable K-Map Y Y X W X W X Z Z Z yz wx 00 01 11 10 m0 = w x y z

23 4-Variable K-map Terms 4-variable K-maps can have rectangles corresponding to: Single square = 4-variable minterm 2 combined squares = 3-variable term 4 combined squares = 2-variable term 8 combined squares = 1 variable term 16 (all) combined squares = constant ‘1’

24 Combining Eight Squares
Examples of 8-square Rectangles: Y Z 8 9 10 11 12 13 14 15 1 3 2 5 6 4 7 W X W Z

25 Combining Four Squares
Examples of 4-square Rectangles: 8 9 10 11 12 13 14 15 1 3 2 5 6 4 7 X Y Z W X Z X Z W Y

26 Combining Two Squares Examples of 2-square Rectangles: 8 9 10 11 12 13
14 15 1 3 2 5 6 4 7 X Y Z W W X Z X Y Z W Y Z W X Z

27 Simplifying 4-Variable Functions
F(W, X, Y, Z) = ∑ (0, 2, 4, 5, 6, 7, 8, 12) Y Z W Z 8 9 10 11 12 13 14 15 1 3 2 5 6 4 7 X Y Z W 1 W X F = XZ + X'Z' F = W X + Y Z + W Z

28 Product-of-Sum (POS) Simplification
F (W, X, Y, Z) = ∑ (1, 2, 3, 9, 10, 11, 13, 14, 15) F = F (W, X, Y, Z) = ∑ (0, 4, 5, 6, 7, 8, 12) = F = Y Z + W X = (Y + Z) (W + X) W Z + W Y + X Z + X Y (G = 8+4 = 12) Y Z + W X (G = 4+2 = 6) 8 9 10 11 12 13 14 15 1 3 2 5 6 4 7 X Y Z W F 8 9 10 11 12 13 14 15 1 3 2 5 6 4 7 X Y Z W 1

29 Product-of-Sum Simplification
Step 1: Draw the K-map for F, replacing the 0’s of F with 1’s in F and vice versa Step 2: Obtain a minimal Sum-of-Product (SOP) expression for F Step 3: Use DeMorgan’s Theorem to obtain F = F The result is a minimal Product-of-Sum (POS) expression for F Step 4: Compare the cost of the minimal SOP and POS expressions to find which one is better

30 Five-Variable K-Maps For five variable problems, we use two adjacent 4-variable K-maps that can be visualized to be on top of each other Each square in the A=0 map is adjacent to the corresponding square in the A=1 map (e.g. m4 and m20) C D E B A = 0 1 3 2 4 5 7 6 12 13 15 14 8 9 11 10 C E B A = 1 D 16 17 19 18 20 21 23 22 28 29 31 30 24 25 27 26

31 Example of a Five-Variable K-map
F(A, B, C, D, E) = ∑(0, 1, 8, 9, 16, 17, 22, 23, 24, 25) F = C D + A B C D C D E B A = 0 1 3 2 4 5 7 6 12 13 15 14 8 9 11 10 A = 1 16 17 19 18 20 21 23 22 28 29 31 30 24 25 27 26 1

32 Don't Cares in K-Maps Sometimes a function table or K-map contains entries for which it is known: The input values for the minterm will never occur, or The output value for the minterm is not used In these cases, the output value need not be defined Instead, the output value is defined as a “don't care” By placing “don't cares” ( an “x” entry) in the function table or map, the cost of the logic circuit may be lowered. Example: A logic function having the binary codes for the BCD digits as its inputs. Only the codes for 0 through 9 are used. The six codes, 1010 through 1111 never occur, so the output values for these codes are “x = don’t cares.”

33 Example: BCD “5 or More” The map below gives a function F(w,x,y,z) which is defined as "5 or more" over BCD inputs. With the don't cares used for the 6 non-BCD combinations: If the don’t cares were treated as 0’s we get: F1 = w x z + w x y + w x y (G = 12) If the don’t cares were 1’s we get: F2 = w + x z + x y (G = 7 better) z w 1 3 2 4 5 7 6 12 13 15 14 8 9 11 10 X x y The selection of don’t cares depends on which combination gives the simplest expression

34 Product-of-Sums Example
Find the optimum POS expression for : F(A, B, C, D) = ∑ (3,9,11,12,13,14,15) + ∑d (1,4,6) Where ∑d indicates the don’t care minterms Solution: Find F = F = B D + A B Optimum POS expression: F = (B + D) (A + B) Gate input cost (G = 6) ∑ (0, 2, 5, 7, 8, 10) + ∑d (1,4,6) D A 1 3 2 4 5 7 6 12 13 15 14 8 9 11 10 X B C F F' = B' D' + A' B F = (B + D)(A + B')

35 Systematic Simplification
A Prime Implicant is a product term obtained by combining the maximum possible number of adjacent squares in the map into a rectangle, with the number of squares equal to a power of 2 A prime implicant is called an Essential Prime Implicant if it is the only prime implicant that covers one or more minterms Prime Implicants and Essential Prime Implicants can be determined by inspection of a K-Map A set of prime implicants covers all minterms if, for each minterm of the function, at least one prime implicant in the set of prime implicants includes the minterm

36 Example of Prime Implicants
Find ALL Prime Implicants CD C 1 B D A 1 B C D A D B D B C B Only 2 Essential Prime Implicants BD BD AD B A

37 Prime Implicant Practice
Find all prime implicants for F(A, B, C, D) = ∑ (0,2,3,8,9,10,11,12,13,14,15) B D 8 9 10 11 12 13 14 15 1 3 2 5 6 4 7 B C D A 3 prime implicants: A, B C, B D All 3 prime implicants are essential B C 1 Prime implicants are: A, B'C, and B'D' A

38 Optimization Algorithm
Find all prime implicants Include all essential prime implicants in the solution Select a minimum cost set of non-essential prime implicants to cover all minterms not yet covered Prime implicant selection rule: Minimize the overlap among prime implicants In particular, in the final solution, make sure that each prime implicant selected includes at least one minterm not included in any other prime implicant selected

39 Selection Rule Example
Simplify F(A, B, C, D) given on the K-map Selected Essential 1 B D A C 1 B D A C Minterms covered by essential prime implicants

40 Selection Rule Example with Don't Cares
Simplify F(A, B, C, D) given on the K-map. Selected Essential 1 x B D A C 1 x B D A C Minterms covered by essential prime implicants

41 Multiple-Level Optimization
Multiple-level circuits - circuits that are more than two levels (inverters are not counted) Multiple-level circuits can have reduced gate input cost compared to two-level (SOP and POS) circuits Multiple-level optimization is performed by applying transformations to circuits represented by equations while evaluating cost

42 Transformations Factoring: finding a factored form from SOP or POS expression Decomposition: expressing a function as a set of new functions Substitution of H into F: Expressing F as a function of H and some of its original variables Elimination: Inverse of substitution, called also flattening Extraction: decomposition applied to multiple functions simultaneously

43 Factoring Example Algebraic Factoring Factoring: Factoring again:
F = A C D + A B C + A B C + A C D (G = 16) Factoring: F = A (C D + B C) + A (B C + C D) (G = 16) Factoring again: F = A C (B + D) + A C (B + D) (G = 12) F = (A C + A C) (B + D) (G = 10) This factoring example has reduced G from 16 to 10 Resulting circuit has three levels plus input inverters

44 Decomposition Example
Given the following function: F = (A (B + C) + D) (B + C) (G = 10) Define 2 new functions X and Y as follows: X = (B + C) and Y = (A X + D) Then function F can be decomposed as follows: F = X Y, where X = (B + C) and Y = (A X + D) (G = 8)

45 Substitution Example Given the following function:
H = A(C + D)(E + F) + B C D E F (G = 14) Define X and Y as new functions : X = C D and Y = E + F The complement of X and Y are: X = (C + D) and Y = E F Substitute C D with X and (C + D) with X Substitute (E + F) with Y and E F with Y H = A X Y + B X Y where, X = C D and Y = E + F (G = 12)

46 Elimination Example Given a set of functions:
X = B+C, Y = A+B, and Z = A X + C Y (G = 10) Eliminate X and Y from Z: Z = A (B + C) + C (A + B) (G = 10) Flatten Z (Convert to SOP expression): Z = A B + A C + A C + B C (G = 12) Two-Level Optimization (using K-map): Z = A B + C (G = 4) This example shows that elimination begins with any set of functions. It can increase gate input cost (G) temporarily, but can result in a final solution with optimum cost (G)

47 Extraction Example Given the following two functions:
E = A B D + A B D H = B C D + B C D (G = 16) Find a common factor for E and H Define the common factor as a function: F = B D + B D Perform extraction by expressing E and H as a function of F: F = B D + B D, E = A F, H = C F (G = 10) Reduced cost because of the sharing of F

48 Terms of Use All (or portions) of this material © 2008 by Pearson Education, Inc. Permission is given to incorporate this material or adaptations thereof into classroom presentations and handouts to instructors in courses adopting the latest edition of Logic and Computer Design Fundamentals as the course textbook. These materials or adaptations thereof are not to be sold or otherwise offered for consideration. This Terms of Use slide or page is to be included within the original materials or any adaptations thereof.


Download ppt "Circuit Optimization Goal: To obtain the simplest implementation for a given function Optimization is a more formal approach to simplification that is."

Similar presentations


Ads by Google