ECE 667 Synthesis and Verification of Digital Systems Heuristic Logic Optimization (Espresso)
Outline Two-level logic minimization Unate recursive paradigm Heuristic logic optimizer Espresso Unate recursive paradigm Unateness Recursive optimization Single output optimization Application of containment check Multiple output optimization Generalization from single-output optimization Concept of a characteristic function ECE 667- Espresso logic minimizer
ESPRESSO – two-level logic optimizer ECE 667- Espresso logic minimizer
Shannon Expansion f : Bn B Shannon Expansion: Theorem: F is a cover of f. Then F = x Fx + x’i Fx ‘ We say that f (F) is expanded about xi. xi is called the splitting variable. ECE 667- Espresso logic minimizer
List of Cubes (Cover Matrix) We often use matrix notation to represent a cover: Example: F = ac + c’d + bcd’ a b c d a b c d a c 1 2 1 2 1 - 1 - c’d 2 2 0 1 or - - 0 1 bcd’ 2 1 1 0 - 1 1 0 Each row represents a cube 1 means that the positive literal appears in the cube 0 means that the negative literal appears in the cube The 2 (or -, don’t care) means that the variable does not appear in the cube. Finding factors from matrix representation is easy. ECE 667- Espresso logic minimizer
Cover Matrix ECE 667- Espresso logic minimizer
Fundamental Theorem Theorem: Let c be a cube and f a function. Then c f fc 1. Proof. We use the fact that x fx = x f, and fx is independent of x. If : Suppose fc 1. Then cf =fcc = c. Thus, c f. f c ECE 667- Espresso logic minimizer
Some Special Functions Definition: A function f : Bn B is symmetric with respect to variables xi and xj iff f(x1,…,xi,…,xj,…,xn) = f(x1,…,xj,…,xi,…,xn) Definition: A function f : Bn B is totally symmetric iff any permutation of the variables in f does not change the function Symmetry can be exploited in searching the binary decision tree because: - That means we can skip one of four sub-cases - used in automatic variable ordering for BDDs ECE 667- Espresso logic minimizer
Unate Functions ECE 667- Espresso logic minimizer Definition: A function f : Bn B is positive unate in variable xi iff This is equivalent to monotone increasing in xi: for all minterm pairs (m-, m+) where For example, m-3=1001, m+3=1011 (where i =3) ECE 667- Espresso logic minimizer
Unate Functions ECE 667- Espresso logic minimizer Similarly for negative unate monotone decreasing: A function is unate in xi if it is either positive unate or negative unate in xi. Definition: A function is unate if it is unate in each variable. Definition: A cover F is positive unate in xi iff xi cj for all cubes cjF ECE 667- Espresso logic minimizer
Example - unateness ECE 667- Espresso logic minimizer f is positive unate in a,b : f(ma+) f(ma-) f(mb+) f(mb-) and negative unate in c: f(mc-) = 1 f(mc+) = 0 mc+ c b a off on mc- Minterms associated with c mc- = (010) = 1 mc+ = (011) = 0 ECE 667- Espresso logic minimizer
The Unate Recursive Paradigm Key pruning technique based on exploiting the properties of unate functions based on the fact that unate leaf cases can be solved efficiently New case splitting heuristic splitting variable is chosen so that the functions at lower nodes of the recursion tree become unate ECE 667- Espresso logic minimizer
The Unate Recursive Paradigm Unate covers F have many extraordinary properties: If a cover F is minimal with respect to single-cube containment, all of its cubes are essential primes. In this case F is the unique minimum cube representation of its logic function. A unate cover represents the tautology iff it contains a cube with no literals (constant 1). Positive unate: f = x fx + fx’ Negative unate: f = fx + x’fx’ This type of implicit enumeration applies to many sub-problems (prime generation, reduction, complementation, etc.). ECE 667- Espresso logic minimizer
Unate Recursive Paradigm Create cofactoring tree stopping at unate covers choose, at each node, the “most binate” variable for splitting recurse until no binate variable left (unate leaf) “Operate” on the unate cover at each leaf to obtain the result for that leaf. Return the result At each non-leaf node, merge (appropriately) the results of the two children. Main idea: Operation on unate leaf is computationally less complex Operations: complement, simplify, tautology, generate-primes,...etc. a c b merge ECE 667- Espresso logic minimizer
Two Useful Theorems - Tautology Checking for tautology is simplified for unate functions Positive unate (f = x fx + fx’ ) f 1 fx’ = 1 Negative unate (f = fx + x’fx’) f 1 fx = 1 Theorem 2: Let A be a unate cover matrix. Then A 1 if and only if A has a row of all “-”s. Proof: If. A row of all “-”s is the tautology cube. Only if. Assume no row of all “-”s. Without loss of generality, suppose function is positive unate. Then each row has at least one “1” in it. Consider the point (0,0,…,0). This is not contained in any row of A. Hence A1. ECE 667- Espresso logic minimizer
Recursive Tautology – termination rules ECE 667- Espresso logic minimizer
Recursive Tautology - example ECE 667- Espresso logic minimizer
Recursive Complement Operation Theorem: Proof: ECE 667- Espresso logic minimizer
COMPLEMENT Operation ECE 667- Espresso logic minimizer Algorithm COMPLEMENT(List_of_Cubes C) { if(C contains single cube c) { Cres = complement_cube(c) // generate one cube per return Cres // literal l in c with ^l } else { xi = SELECT_VARIABLE(C) C0 = COMPLEMENT(COFACTOR(C,^xi)) Ù ^xi C1 = COMPLEMENT(COFACTOR(C,xi)) Ù xi return OR(C0,C1) ECE 667- Espresso logic minimizer
Recursive Complement – termination rules ECE 667- Espresso logic minimizer
Recursive Complement – example (split) ECE 667- Espresso logic minimizer
Recursive Complement – example (merge) ECE 667- Espresso logic minimizer
Incompletely Specified Boolean Functions F = (f, d, r) : Bn {0, 1, *} where * represents a don’t care. f = onset function - f(x)=1 F(x)=1 r = offset function - r(x)=1 F(x)=0 d = don’t care function - d(x)=1 F(x)=* (f,d,r) forms a partition of Bn, i.e. f + d + r = Bn fd = fr = dr = (pairwise disjoint) ECE 667- Espresso logic minimizer
Incompletely Specified Boolean Functions A completely specified Boolean function g is a cover for F = (f,d,r) if f g f+d Note: g r = if xd , then g(x) = 0 or 1 (don’t care) if xf , then g(x)=1 if xr , then g(x)=0. Also: r = f’d’ g’ f’ f d r ECE 667- Espresso logic minimizer
ESPRESSO – 2-level logic optimizer ECE 667- Espresso logic minimizer
Example: Logic Minimization (single output) Consider F(a,b,c)=(f,d,r), where f={abc, abc, abc} and d ={abc, abc}, and the sequence of covers illustrated below: F1= abc + abc+ abc Expand abc a off on F2= a+abc + abc Don’t care abc is redundant a is prime F3= a+abc Expand abc bc c b a F4= a+bc ECE 667- Espresso logic minimizer
Two-level minimization (multiple-outputs) Initial representation: a b c 0 – 0 0 1 – – 1 1 1 – 1 f1 f2 0 1 1 0 000 100 110 010 111 011 001 f1 f2 101 a b c 0 – 0 0 1 1 1 – 1 f1 f2 0 1 1 1 1 0 Minimized cover: f1 f2 000 100 110 010 111 011 001 101 c b a ECE 667- Espresso logic minimizer
ESPRESSO Illustrated ECE 667- Espresso logic minimizer minimum Local
REDUCE ECE 667- Espresso logic minimizer Problem: Given a cover F and c F, find the smallest cube c c such that F\{ c } + { c } is still a cover. Cube c is called the maximally reduced cube of c. REDUCE is order dependent on off Don’t care ECE 667- Espresso logic minimizer
Expand and Reduce Fundamental procedures of Espresso ECE 667- Espresso logic minimizer
Validity of expansion ECE 667- Espresso logic minimizer Containment check: is the expanded cube contained in F ? ECE 667- Espresso logic minimizer
Expand - example ECE 667- Espresso logic minimizer Validity of expansion ECE 667- Espresso logic minimizer
Reduce Transform a cover of prime implicants: Replace each prime implicant p, wherever possible, with a smaller, non-prime implicant contained by p. Purpose of Reduce: iterative improvement Moves function away from local minimum The subsequent Expand may be able to find a better set of primes Similar to Expand, uses the same containment check ECE 667- Espresso logic minimizer
Single output function Expand input part: (0 0 0 | 1) (0 - 0 | 1) Check if (f – a’b’c’)a'’bc’ = 1 2. Reduce output part: (0 1 - | 1) (0 1 - | 0) (remove the cube) Check if (f – a’b)a'’b = 1 ECE 667- Espresso logic minimizer
Multiple output function - expand Expand output part: (0 - 1 | 1 0) (0 - 1 | 1 1) C = 0-1| 10, C~= 0-1|01 Check if (f – {0-1|10})0-1|01 = 1 ECE 667- Espresso logic minimizer
Multiple output function – remove redundancy Remove redundant cube: (0 0 - | 0 1) (0 0 - | 0 0) C = 00-|01 , C~= 00-|00 Check if (f – {00-|01})00-|01 = 1 ECE 667- Espresso logic minimizer
Multiple output function – summary ECE 667- Espresso logic minimizer
How to Expand and Reduce ECE 667- Espresso logic minimizer