ECE 3060 VLSI and Advanced Digital Design Lecture 10 Two Level Logic Minimization
Motivation • We will study modern techniques for manipulating and minimizing boolean functions • Issue: Tractibility of minimization problem for large number of variables • Exact methods • Heuristic methods • Issue: Representation of boolean expressions in a form conducive to boolean operations • Implicant tables • Binary decision diagrams • Issue: Manipulation of realistic multilevel networks • Graph representations • multilevel minimization • Technology mapping ECE 3060 Lecture 10–2
Definitions • Binary space = { 0 1 , } B • Operations OR(+), AND(.), NOT f : B n • Single output: → B • Incompletely specified single output function: f : B n → { 0 1 * , , } f : B n B m • Multiple output: → • Incompletely specified multiple output function: f : B n } m → { 0 1 * , , ECE 3060 Lecture 10–3
Cube Representation B n • can be represented by a binary n-cube, i.e. an n- dimensional binary hypercube a b c a a b a b a b c a b c a b c a c a a b a b a b c a b c a b c a b c b • As usual, literals may be replaced with binary values, i.e. ≡ 010 abc • Adjacent minterms (vertices) differ in only one vari- able similar to K-map ECE 3060 Lecture 10–4
Definitions • Boolean variable : ∈ a B • Boolean literal : or a a • Product or cube : product of literals • Implicant : product term implying a value of a function (usually TRUE) • binary hypercube in the boolean space • Minterm : product using all input variables implying a value of a function (usually TRUE) • vertex in the boolean space ECE 3060 Lecture 10–5
Tabular Representations • Truth table • list of all minterms of a function • Implicant table or cover • list of all implicants of a function sufficient to define the function • Comment: • Implicant tables are smaller in size • Example Cover = + x ab ac abc xy = + + y ab bc ac 001 10 *11 11 101 01 11* 11 ECE 3060 Lecture 10–6
Cube Representation 011 111 101 001 010 110 c b 000 100 a • = + + + + F abc abc abc abc abc • F = + + + ab bc ac ab ECE 3060 Lecture 10–7
Prime Definitions • Prime implicant • implicant not contained by any other implicant • Prime cover • cover of prime implicants • Essential Prime Implicant (EPI): • there is at least one minterm covered by EPI and not covered by any other prime implicant ECE 3060 Lecture 10–8
Two level logic optimization • Assumptions: • primary goal is to reduce the number of implicants • all implicants have the same cost • secondary goal is to reduce the number of literals • Minimum cover c 011 b 111 • cover of the function a with the minimum 101 number of implicants 001 • global optimum • f = 010 110 000 100 ECE 3060 Lecture 10–9
Minimal or Irredundant Cover • Cover of the function that is not a proper superset of another cover • no implicant can be dropped • local optimum 011 111 101 001 010 110 c b 000 100 a ECE 3060 Lecture 10–10
Minimal Cover with respect to single-implicant containment • no implicant is contained by any other implicant • weak local optimum 011 111 101 001 010 110 c b 000 100 a ECE 3060 Lecture 10–11
Logic Minimization • Exact methods: • compute minimum cover • often intractable for large functions • based on Quine-McCluskey method • Heuristic methods: • Compute minimal cover (possibly minimum) • There are a large variety of methods and programs • academic: MINI, PRESTO, ESPRESSO (UCBerkeley) • industry: Synopsys, Cadence, Mentor Graphics, Zuken ECE 3060 Lecture 10–12
Exact Logic Minimization • Quine’s theorem: • There is a minimum cover that is prime • Consequently, the search for minimum cover can be restricted to prime implicants • Quine-McCluskey method: 1. compute prime implicants 2. determine minimum cover via branching • Petrick’s method 1. compute prime implicants 2. determine minimum cover via covering clause ECE 3060 Lecture 10–13
Computing Prime Implicants • The Hamming weight of a minterm is the number of ones in that minterm. • Start with list of minterms sorted by Hamming weight. 1. Combine all possible implicants (minterms) using α y + α y = α . Note that this algebraic reduction specifies two implicants with Hamming weights that differ by one. 2. Group resulting implicants by Hamming weight. 3. Repeat 1. and 2. on the resulting implicants until no further factoring is possible (i.e. all implicants are prime) • Example: = + + + + + f abcd abcd abcd abcd abcd abcd + + + + abcd abcd abcd abcd ECE 3060 Lecture 10–14
Prime Implicant Table • Rows: minterms • Columns: prime implicants f : B n • Exponential size: for a function → B 2 n • minterms 3 n n ⁄ • up to prime implicants ECE 3060 Lecture 10–15
Example • Function: = + + + + f abc abc abc abc abc • Primes: • Implicant Table: Label PIs Primes Minterms 00* α α β γ δ *01 β 1 0 0 0 abc 1*1 γ 1 1 0 0 abc 11* δ 0 1 1 0 abc 0 0 1 1 abc 0 0 0 1 abc • Choose cover by selecting a set of implicants which cover all minterms. ECE 3060 Lecture 10–16
Cube Representation 011 011 111 111 101 101 001 001 010 010 110 110 000 100 000 100 c b (a) prime implicants (b) minimum cover a ECE 3060 Lecture 10–17
Petrick’s Method • Determine minimum cover via covering clause: 1. Write covering clauses in pos form 2. Multiply out pos form into sop form (and simpify). 3. Select cube of minimum size • Covering clause describes necessary and sufficient conditions to cover function • Note: multiplying out clauses is exponential. • Example: • pos clauses: ( ) α α ( + β ) β ( + γ ) γ ( + δ ) δ ( ) (Each term covers a minterm) • sop clauses: αβδ + αγδ • Covers: { α β δ , , } or { α γ δ , , } ECE 3060 Lecture 10–18
Exact Two-level Logic Minimization • Matrix representation • Covering problem • Reduction strategies • Branch and bound covering algorithm ECE 3060 Lecture 10–19
Matrix representation • View implicant table of some function as Boolean f matrix: A ( = 1 ) ⇒ a ij • the ith minterm is covered by the jth prime implicant • The (Boolean) selection vector selects which prime x implicants will be in the cover. • To cover , find an which satisfies f x ≥ 1 i ∀ = y i Ax y • i.e. select enough columns to cover all rows • To find a minimum cover, minimize cardinality of , i.e. x the number of nonzero entries of . x ECE 3060 Lecture 10–20
Example • The magnitude of indicates the number of prime y i implicants which cover the ith minterm. 1 0 0 0 1 1 1 1 0 0 2 1 = 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1 ECE 3060 Lecture 10–21
Branch and Bound Algorithm • Exact algorithm, but not polynomial time. • First step: • Remove Essential Prime Implicants (EPIs) which are columns incident to one (or more) row(s) with a single 1 in them. • Modify by removing the column and incident rows A • Example: rows 1 and 5 from previous matrix 1 0 0 0 1 1 0 0 = becomes A 0 1 1 0 1 1 0 0 1 1 0 0 0 1 ECE 3060 Lecture 10–22
Reduction Strategies • Column (implicant) dominance: • a column dominates column iff, for all rows , ≥ i j k a ki a kj 1 0 0 0 1 1 0 1 0 1 0 0 • In this example, which columns dominate? • any dominated column may be removed, because the j implicant corresponding to column is not prime j ECE 3060 Lecture 10–23
Reduction Strategies • Row (minterm) dominance • a row dominates row iff, for all columns ≥ k l i a ki a li 1 0 0 0 0 1 0 1 0 1 1 0 • Which rows dominate? • a row , which dominates another row , may be k l removed because whichever implicant is eventually chosen to cover will also cover l k ECE 3060 Lecture 10–24
Branching Algorithm • Remove essential primes from consideration. • Perform a depth-first search of remaining covers. • Bounding algorithm used to prune search tree. α ∈ α ∉ C C γ ∉ β ∈ β ∉ γ ∈ C C C C ECE 3060 Lecture 10–25
Branch and Bound Algorithm EXACT_COVER( , , ) { /* is current best estimate */ A x b b Reduce matrix and update corresponding ; A x Calculate current_estimate for this branch; /* we don’t cover this */ if ( current_estimate >= | |) return ( ); b b if ( has no rows) return ( ); A x Select a branching column ; c = 1 ; /* this changes element in */ x c c x ˜ ˜ = after deleting column and rows incident to ; A A c c ˜ ˜ x b ˜ = EXACT_COVER( , , ); x A ˜ ˜ if ( < ) b = ˜ ; x b x = 0 ; x c ˜ ˜ = after deleting column ; A A c ˜ ˜ x b ˜ = EXACT_COVER( , , ); x A ˜ ˜ if ( < ) b = ; x b x return ( ); b } ECE 3060 Lecture 10–26
Example 1 1 0 0 0 x 1 1 0 1 1 0 0 x 2 1 • Consider = , = , = A x b 0 0 1 1 0 x 3 1 0 0 0 1 1 x 4 1 1 0 0 0 1 x 5 1 There are no essential primes, and no row or column dominance. µ i • Denote the implicants and the minterms as P j • Choose (i.e. = 1 ) P 1 c ECE 3060 Lecture 10–27
Recommend
More recommend