Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 4: Logic Optimization Chapter 4.

Similar presentations


Presentation on theme: "CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 4: Logic Optimization Chapter 4."— Presentation transcript:

1 CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 4: Logic Optimization Chapter 4

2 Motivation Algebraic manipulation is not systematic. This chapter presents methods that can be automated in CAD tools. Although tools used for logic optimization, designers must understand the process.

3 Figure 4.1 The function f =  m(0, 2, 4, 5, 6)

4 x 2 (a) Truth table(b) Karnaugh map 0 1 01 m 0 m 2 m 3 m 1 x 1 x 2 00 01 10 11 m 0 m 1 m 3 m 2 x 1 Figure 4.2 Location of two-variable minterms

5 Figure 2.15 A function to be synthesized

6 Figure 4.4 Location of three-variable minterms x 1 x 2 x 3 00011110 0 1 (b) Karnaugh map x 2 x 3 00 01 10 11 m 0 m 1 m 3 m 2 0 0 0 0 00 01 10 11 1 1 1 1 m 4 m 5 m 7 m 6 x 1 (a) Truth table m 0 m 1 m 3 m 2 m 6 m 7 m 4 m 5

7

8

9 Figure 4.6 A four-variable Karnaugh map x 1 x 2 x 3 x 4 00011110 00 01 11 10 x 2 x 4 x 1 x 3 m 0 m 1 m 5 m 4 m 12 m 13 m 8 m 9 m 3 m 2 m 6 m 7 m 15 m 14 m 11 m 10

10 x 1 x 2 x 3 x 4 0 00011110 000 0011 1001 1001 00 01 11 10

11 x 1 x 2 x 3 x 4 0 00011110 000 0011 1111 1111 00 01 11 10

12 x 1 x 2 x 3 x 4 1 00011110 001 0000 1110 1101 00 01 11 10

13 x 1 x 2 x 3 x 4 1 00011110 110 1110 0011 0011 00 01 11 10

14 Figure 4.8 A five-variable Karnaugh map x 1 x 2 x 3 x 4 00011110 1 11 11 11 00 01 11 10 x 5 1= x 1 x 2 x 3 x 4 00011110 11 11 11 00 01 11 10 x 5 0=

15 Terminology A variable either uncomplemented our complemented is called a literal. A product term that indicates when a function is equal to 1 is called an implicant. An implicant that cannot have any literal deleted and still be a valid implicant is called a prime implicant.

16 Figure 4.9 Three-variable function f =  m(0, 1, 2, 3, 7) x 1 x 2 x 3 11 11 00 10 00011110 0 1

17 Terminology (cont) A collection of implicants that accounts for all input combinations in which a function evaluates to 1 is called a cover. An essential prime implicant includes a minterm covered by no other prime. Cost is number of gates plus number of gate inputs. Assume primary inputs available in both true and complemented form.

18 Minimization Procedure Generate all prime implicants. Find all essential prime implicants. If essential primes do not form a cover, then select minimal set of non-essential primes.

19 Figure 4.10 Four-variable function f =  m(2, 3, 5, 6, 7, 10, 11, 13, 14) x 1 x 2 x 3 x 4 00011110 11 11 11 00 01 11 1011 1

20 Figure 4.11 The function f =  m(0, 4, 8, 10, 11, 12, 13, 15) x 1 x 2 x 3 x 4 00011110 1 1 1 1 100 01 11 10 1 1 1

21 Figure 4.12 The function f =  m(0, 2, 4, 5, 10, 11, 13, 15) x 1 x 2 x 3 x 4 00011110 1 1 1 1 1 1 00 01 11 101 1.

22 Minimization of POS Forms Find a cover of the 0’s and form maxterms. x 1 x 2 x 3 1 00011110 0 1 100 1110

23 Figure 4.14 POS minimization of f =  M(0, 1, 4, 8, 9, 12, 15) x 1 x 2 x 3 x 4 0 00011110 000 0110 1101 1111 00 01 11 10

24 Incompletely Specified Functions Often certain input conditions cannot occur. Impossible inputs are called don’t cares. A function with don’t cares is called an incompletely specified function. Don’t cares can be used to improve the quality of the logic designed.

25 Figure 4.15 Two implementations of f =  m(2, 4, 5, 6, 10) + D(12, 13, 14, 15) x 1 x 2 x 3 x 4 0 00011110 1d0 01d0 00d0 11d1 00 01 11 10

26 Figure 4.15 Two implementations of f =  m(2, 4, 5, 6, 10) + D(12, 13, 14, 15) x 1 x 2 x 3 x 4 0 00011110 1d0 01d0 00d0 11d1 00 01 11 10

27 Multiple-Output Circuits Necessary to implement multiple functions. Circuits can be combined to obtain lower cost solution by sharing some gates.

28 Figure 4.16 An example of multiple-output synthesis x 1 x 2 x 3 x 4 00011110 11 11 11 11 00 01 11 10 (a) Function 1 f 1 x 1 x 2 x 3 x 4 00011110 11 11 111 11 00 01 11 10 (b) Functionf 2

29 f 1 f 2 x 2 x 3 x 4 x 1 x 3 x 1 x 3 x 2 x 3 x 4 (c) Combined circuit forf 1 f 2 and

30 Figure 4.17 An example of multiple-output synthesis x 1 x 2 x 3 x 4 00011110 1 11 1 00 01 11 10 (a) Optimal realization of(b) Optimal realization of 1 f 3 f 4 1 1 x 1 x 2 x 3 x 4 00011110 11 1 1 00 01 11 10 1 11

31 (c) Optimal realization of f 3 x 1 x 2 x 3 x 4 00011110 1 11 1 00 01 11 10 11 1 x 1 x 2 x 3 x 4 00011110 11 1 1 00 01 11 10 1 11 andtogetherf 4

32 Figure 4.17 An example of multiple-output synthesis f 3 f 4 x 1 x 4 x 3 x 4 x 1 x 1 x 2 x 2 x 4 x 4 (d) Combined circuit for f 3 f 4 and x 2

33 x 1 x 2 x 3 x 4 00011110 00 01 11 10 (a) Function 0 f 1 x 1 x 2 x 3 x 4 00011110 00 01 11 10 (b) Functionf 2 0 0 00 00 0 0 0 0 0 00

34 x 1 x 2 x 3 x 4 00011110 00 01 11 10 (a) Optimal realization of(b) Optimal realization of f 3 f 4 x 1 x 2 x 3 x 4 00011110 00 01 11 10 000 0 0 00000000 0 0 000

35 Figure 4.18 DeMorgan’s theorem in terms of logic gates x 1 x 2 x 1 x 2 x 1 x 2 x 1 x 2 x 1 x 2 x 1 x 2 x 1 x 2 x 1 x 2 += (a) x 1 x 2 + x 1 x 2 = (b)

36 Figure 4.19 Using NAND gates to implement a sum-of-products x 1 x 2 x 3 x 4 x 5 x 1 x 2 x 3 x 4 x 5 x 1 x 2 x 3 x 4 x 5

37 Figure 4.20 Using NOR gates to implement a product-of-sums x 1 x 2 x 3 x 4 x 5 x 1 x 2 x 3 x 4 x 5 x 1 x 2 x 3 x 4 x 5

38 Multilevel Synthesis SOP or POS circuits have 2-levels of gates. Only efficient for functions with few inputs. Many inputs can lead to fan-in problems. Multilevel circuits can also be more area efficient.

39 Figure 4.21 Implementation in a CPLD

40 Figure 4.22 Implementation in an FPGA

41 Figure 4.23 Using 4-input AND gates to realize a 7-input product term 7 inputs

42 Figure 4.24 A factored circuit x 6 x 4 x 1 x 5 x 2 x 3 x 2 x 3 x 5

43 Example 4.5

44 Figure 4.25 A multilevel circuit x 1 x 2 x 3 x 4 f 1 f 2

45 Impact on Wiring Complexity Space on chip is used by gates and wires. Wires can be a significant portion. Each literal corresponds to a wire. Factoring reduces literal count, so it can also reduce wiring complexity.

46 Functional Decomposition Multilevel circuits often require less area. Complexity is reduced by decomposing 2-level function into subcircuits. Subcircuit implements function that may be used in multiple places.

47 Example 4.6

48 Figure 4.26 A multilevel circuit x 1 x 2 x 3 x 4 f g

49 Figure 4.27 The structure of a decomposition 1 x 2 x 3 x 4 f g h x x 1 x 2 x 3 x 4 f g

50 x 1 x 2 x 3 x 4 00011110 00 01 11 10 x 1 x 2 x 3 x 4 00011110 11 11 1 1 1 00 01 11 10 1 x 5 0=x 5 1= f 1111 1111

51 Figure 4.28 An example of decomposition x 1 x 2 x 5 x 4 f x 3 g k

52 Figure 4.29 a Implementation of XOR x 2 x 1 x 1 x 2  x 2 x 1 x 1 x 2  (a) Sum-of-products implementation (b) NAND gate implementation

53 Example 4.8

54 x 2 x 1 g x 1 x 2  (c) Optimal NAND gate implementation Figure 4.29 b Implementation of XOR f = x 1  x 2 = x 1 x 2 + x 1 x 2 = x 1 (x 1 + x 2 ) + x 2 (x 1 + x 2 )

55 Practical Issues Functional decomposition can be used to implement general logic functions in circuits with built-in constraints. Enormous numbers of possible subfunctions leads to necessity for heuristic algorithms.

56 Figure 4.30 Conversion to a NAND-gate circuit x 2 x 1 x 3 x 4 x 5 x 6 x 7 x 2 x 1 x 3 x 4 x 5 x 6 x 7 f f (a) Circuit with AND and OR gates (b) Inversions needed to convert to NANDs

57 Figure 4.30 Conversion to a NAND-gate circuit x 2 x 1 x 3 x 4 x 5 x 6 x 7 f (b) Inversions needed to convert to NANDs x 2 x 1 x 3 x 4 x 5 x 6 x 7 f

58 Figure 4.31 Conversion to a NOR-gate circuit x 2 x 1 x 3 x 4 x 5 x 6 x 7 f (a) Circuit with AND and OR gates x 2 x 1 x 3 x 4 x 5 x 6 x 7 f (a) Inversions needed to convert to NORs

59 Figure 4.31 Conversion to a NOR-gate circuit x 2 x 1 x 3 x 4 x 5 x 6 x 7 f x 2 x 1 x 3 x 4 x 5 x 6 x 7 f

60 Figure 4.32 Circuit example for analysis

61 x 1 x 2 x 5 x 4 f x 3 P 1 P 4 P 5 P 6 P 8 P 2 P 3 P 9 P 10 P 7 Figure 4.33 Circuit example for analysis

62 x 1 x 2 x 4 f x 5 (c) Circuit with AND and OR gates x 3 Figure 4.34 Circuit example for analysis x 1 x 2 x 3 x 4 x 5 f P 1 P 2 P 3 (a) NAND-gate circuit x 1 x 2 x 3 x 4 x 5 f (b) Moving bubbles to convert to ANDs and ORs

63 Figure 4.35 Circuit example for analysis

64 CAD Tools espresso – finds exact and heuristic solutions to the 2-level synthesis problem. sis – performs multilevel logic synthesis. Numerous commercial CAD packages are available from Cadence, Mentor, Synopsys, and others.

65 Figure 4.46 A complete CAD system Design conception Design correct? Chip configuration Timing simulation No Yes Design entry, initial synthesis, and functional simulation (see section 2.8) Physical design Logic synthesis/optimization

66 Figure 4.42 VHDL code for the function f =  m(1, 4, 5, 6)

67 Figure 4.43 Logic synthesis options in MAX+PLUS II

68 Physical Design Physical design determines how logic is to be implemented in the target technology. –Placement determines where in target device a logic function is realized. –Routing determines how devices are to be interconnected using wires.

69 Figure 4.44 Results of physical design

70 Timing Simulation Functional simulation does not consider signal propagation delays. After physical design, more accurate timing information is available. Timing simulation can be used to check if a design meets performance requirements.

71 Figure 4.45 Timing simulation results (a) Timing in an FPGA (b) Timing in a CPLD

72 Figure 4.46 A complete CAD system Design conception Design correct? Chip configuration Timing simulation No Yes Design entry, initial synthesis, and functional simulation (see section 2.8) Physical design Logic synthesis/optimization

73 STD_LOGIC type Defined in ieee.std_logic_1164 package. Enumerated type with 9 values. ‘1’ – strong one‘0’ – strong zero ‘X’ – strong unknown‘Z’ – high impedence ‘H’ – weak one‘L’ – weak zero ‘W’ – weak unknown‘U’ – uninitialized ‘-’ – don’t care We will almost always use STD_LOGIC.

74 Figure 4.47 VHDL code using STD_LOGIC

75 Figure 4.48 VHDL code for the function f =  m(0, 2, 4, 5, 6)

76 Figure 4.49 Implementation of the VHDL code for the function f =  m(0, 2, 4, 5, 6) DQ PAL-like block (from interconnection wires) x 1 x 2 x 3 unused 0 0 1

77 DQ PAL-like block (from interconnection wires) x 1 x 2 x 3 unused 0 1 Figure 4.50 Implementation using XOR synthesis (f = x 3  x 1 x 2 x 3 )

78 Figure 4.51 VHDL code for f =  m(0, 2, 4, 5, 6) implemented in a LUT

79 Figure 4.52 The VHDL code for f =  m(2, 3, 9, 10, 11, 13)

80 Figure 4.53 VHDL code for a 7-variable function

81 Figure 4.54 Two implementations of a 7-variable function x 6 x 4 f x 5 0 x 7 x 2 x 3 x 2 x 7 x 4 x 5 0 x 6 x 1 x 3 x 1 x 4 x 5 x 6 x 1 x 3 x 6 x 2 x 3 x 7 x 2 x 4 x 5 x 7 (a) Sum-of-products realization x 1 x 7 x 2 x 6 x 1 x 6 x 2 x 7 + x 5 x 3 x 4 f (b) Factored realization x 1

82 Logic Function Representation Truth tables Algebraic expressions Venn diagrams Karnaugh maps n-dimensional cubes

83 Figure 4.36 Representation of f =  m(1, 2, 3) x 1 0 0 1 1 0 1 0 1 f 0 1 1 1 01 00 11 10 x 2 x 1 x1 1x x 2

84 Figure 4.37 Representation of f =  m(0, 2, 4, 5, 6)

85 Figure 4.38 Representation of f =  m(0, 2, 3, 6, 7, 8, 10, 15)

86 n-Dimensional Hypercube Function of n variables maps to n-cube. Size of a cube is number of vertices. A cube with k x’s consists of 2 k vertices. n-cube has 2 n vertices. 2 vertices are adjacent if they differ in one coordinate. Each vertex in n-cube adjacent to n others.

87 Figure 4.39 The coordinate *-operation o o 0 0 11 1 0 x 1 0 x B i A i 0 1 x A i B i * C = A * B such that 1.C =  if A i * B i =  for more than one i. 2.Otherwise, C i = A i * B i when A i * B i   and C i = x for the coordinate where A i * B i = .

88 Using *-operation to Find Primes f is specified using a set of cubes, C k of f. Let c i and c j be any two cubes in C k. Apply *-operation to all pairs of cubes in C k : –G k+1 = c i * c j for all c i, c j in C k Form new cover for f as follows: –C k+1 = C k  G k+1 – redundant cubes –A is redundant if exists a B s.t. A i = B i or B i = x for all i. Repeat until C k+1 = C k.

89 Example 4.14

90 Example 4.15

91 Figure 4.40 The coordinate #-operation o 0 1 1 0 x B i A i 0 1 x A i B i #     o C = A # B, such that 1.C = A if A i # B i =  for some i. 2.C =  if A i # B i =  for all i. 3.Otherwise, C =  i (A 1, A 2,..., B i,... A n ), where the union is for all i for which A i = x and B i  x.

92 Finding Essential Primes Let P be set of all prime implicants. Let p i denote one prime implicant in P. Let DC denote the don’t cares vertices for f. Then p i is an essential prime implicant iff: –p i # (P – p i ) # DC  

93 Example 4.16

94 Example 4.17

95 Procedure to Find Minimal Cover Let C 0 = ON  DC be the initial cover of f. Find all primes, P, of C 0 using *-operation. Find the essential primes using #-operation. If essentials cover ON-set then done else –Delete any nonessential prime that is more expensive than some other prime. –Use branching technique to select lowest cost primes which cover ON-set.

96 Figure 4.41 An example four-variable function 1 x 2 x 3 x 4 00011110 1 111 11 00 01 11 10 x 1 x 2 x 3 x 4 00011110 d1 1 d d 11 00 01 11 10 1 x 5 0=x 5 1= d x

97 Summary Described 2-level logic synthesis methods. Discussed multilevel logic synthesis. Introduced CAD tools for logic synthesis.


Download ppt "CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 4: Logic Optimization Chapter 4."

Similar presentations


Ads by Google