27
FUNCTION OPTIMIZATION Switching Function Representations can be Classified in Terms of Levels Number of Levels, k, is Number of Unique Boolean (binary) Operators EXAMPLES 1 1 2 3 f x x x 2 f abcd 3 f ab cd afe 4 ( )( ) f a b c b c d 5 f ab cd abc 6 [( )( )] ( ) f ab c cd e ab ce dc 1-Level 2-Level multi-level

2012_0060. Two-level - Tabulation Method

Embed Size (px)

DESCRIPTION

ytyvhgvhbv

Citation preview

  • FUNCTION OPTIMIZATIONSwitching Function Representations can be Classified in Terms of Levels

    Number of Levels, k, is Number of Unique Boolean (binary) Operators

    EXAMPLES

    1-Level2-Levelmulti-level

  • k-Level functions22n Possible Switching Functions of n Variables (actually much fewer types obtained by permuting and/or complementing input variables)1-Level FormsCannot Represent all Possible Functions2-Level FormsCan Represent all Possible FunctionsWith Additional Restrictions CANONICALk-Level Forms (k2)Many Different Ways to Represent a Given FunctionsIf a multi-input Gate Represents a (binary or greater) Boolean OperatorExpression can Represent a Netlistk Indicates depth of NetlistEXAMPLES1-Level2-LevelMulti-Levelaccbcbabedafff

  • k-Level function properties1-Level FormsDue to Restriction of Representable Functions, Not as Useful2-Level FormsCan be CanonicalLongest PI to PO Path is Always 2 Related to DelayMinimization Usually MeansMinimum Number of TermsMinimum Number of Literals in Expressionk-Level Forms (k2)Many More Possible RepresentationsCan be Optimized for AreaDelay is More ComplicatedFalse Path ProblemSpatio-temporal CorrelationsTypically an Area versus Delay Tradeoff (e.g., Ripple versus CL Adder)

  • Common Terms for 2-Level MinimizationLiteral A variable in complemented or uncomplemented formProduct The disjunction (AND) of a set of literals; also represents a cubeSupport Set Set of all variables that define the domain of a switching functionMinterm A disjunction (AND) containing an instance of each literal corresponding to a variable in the support set that is in the on-set, fon,of a functionDont Care The absence of a supporting variable in a product termImplicant A product term that covers one or more minterms in the on-set, fon, of a functionPrime Implicant An implicant in the on-set, fon, of a function such that it is not a subproduct of any other possible implicant in the set.Essential Prime Implicant A prime implicant that covers at least one minterm NOT covered by any other implicant in the on-set, fon.

  • SOP Minimization Terms ExampleConsider: Each Element of fon is an Implicant Prime Implicants are: abc is a Prime Implicant but NOT an Essential Prime Implicant bcd is an Implicant but NOT a Prime Implicant bd is an Essential Prime Implicant Product abc: covers minterms:m4=abcd and m5=abcd disjunction of literals a, b, c variable d is a Dont Care f Represented by fon has Support Set:{a, b, c, d}

  • Karnaugh MapSimplification Using Karnaugh MapUse as few loops as possibleUse as large loop as possible

    Prime Implicant Corresponds to as large loop as Possible

    Karnaugh Map Simplification is Finding fon such that: fon contains as few prime implicants as possible fon must contain all essential prime implicants fon contains NO implicants that are NOT prime

  • Tabulation Method

  • Tabulation Method - NotationConsider Support Set of f:S={x1, x2, , xn}xici denotes: xi if ci = 1 xi if ci = 0 1 if ci = -

    If NO ci = -, then we have a mintermCan be Represented by Decimal Equivalent of ci

    EXAMPLE(S={x1, x2, x3, x4})x11x02x03x14 = m9, a minterm c1 c2 c3 c4 = 1001 = 9 x01x-2x-3x04 = a 4-cube 0--0

  • Cube MergingBasic Operation in Tabulation Method2 Cubes that Differ in a SINGLE ci can be Merged into a Single Cube EXAMPLE = 1-01 = 0-01Merge and into = --01Merging is also called star operator and is a special case of consensus

  • Tabulation MethodInput: f on as a set of mintermsOutput: f on as a set of All Essential Prime ImplicantsAs Few Prime Implicants as Possible

    Finding as few Prime Implicants as Possible is an NP-Hard Problem!!!!!

    Reduces to the Set Covering Problem for Unate FunctionsUnate function a constant or is represented by a SOP using either uncomplemented or complemented literals for each variableReduces to the Minimum Cost Assignment Problem for Binate Functions (ex. EXOR)This is 2-Level (SOP) Optimization (Minimization)

  • Tabulation MethodSTEP 1:Convert Minterm List (specifying f on) to Prime Implicant ListSTEP 2:Choose All Essential Prime ImplicantsIf all minterms are covered HALT Else GO To STEP 3STEP 3:Formulate the Reduced Cover Table Omitting the rows/cols of EPIIf Cover Table can be Reduced using Dominance Properties, Go To Step 2Else Must Solve the Cyclic Cover Problem 1) Use Exact Method (exponentially complex) 2) Use Heuristic Method (possibly non-optimal result)

    NOTE: Quine-McCluskey Refers to Using a Branch and Bound HeuristicNOTE: Petricks Method is Exact Technique Generates all Solutions Allowing the Best to be Used

  • Tabulation Method STEP 1Partition Prime Implicants (or minterms) According to Number of 1s

    Check Adjacent Classes for Cube Merging Building a New List

    If Entry in New List Covers Entry in Current List Disregard Current List Entry

    If Current List = New List HALT Else Current List New List New List NULL Go To Step 1

  • STEP 1 - EXAMPLEf on = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)

    Minterm

    Cube

    0

    0

    0

    0

    0

    1

    0

    0

    0

    1

    2

    0

    0

    1

    0

    8

    1

    0

    0

    0

    3

    0

    0

    1

    1

    5

    0

    1

    0

    1

    10

    1

    0

    1

    0

    11

    1

    0

    1

    1

    13

    1

    1

    0

    1

    15

    1

    1

    1

    1

  • STEP 1 - EXAMPLEf on = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)

    Minterm

    Cube

    0

    0

    0

    0

    0

    (

    1

    0

    0

    0

    1

    (

    2

    0

    0

    1

    0

    (

    8

    1

    0

    0

    0

    (

    3

    0

    0

    1

    1

    (

    5

    0

    1

    0

    1

    (

    10

    1

    0

    1

    0

    (

    11

    1

    0

    1

    1

    (

    13

    1

    1

    0

    1

    (

    15

    1

    1

    1

    1

    (

    Minterm

    Cube

    0,1

    0

    0

    0

    -

    0,2

    0

    0

    -

    0

    0,8

    -

    0

    0

    0

    1,3

    0

    0

    -

    1

    1,5

    0

    -

    0

    1

    2,3

    0

    0

    1

    -

    2,10

    -

    0

    1

    0

    8,10

    1

    0

    -

    0

    3,11

    -

    0

    1

    1

    5,13

    -

    1

    0

    1

    10,11

    1

    0

    1

    -

    11,15

    1

    -

    1

    1

    13,15

    1

    1

    -

    1

  • STEP 1 - EXAMPLEf on = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)

    Minterm

    Cube

    0

    0

    0

    0

    0

    (

    1

    0

    0

    0

    1

    (

    2

    0

    0

    1

    0

    (

    8

    1

    0

    0

    0

    (

    3

    0

    0

    1

    1

    (

    5

    0

    1

    0

    1

    (

    10

    1

    0

    1

    0

    (

    11

    1

    0

    1

    1

    (

    13

    1

    1

    0

    1

    (

    15

    1

    1

    1

    1

    (

    Minterm

    Cube

    0,1

    0

    0

    0

    -

    (

    0,2

    0

    0

    -

    0

    (

    0,8

    -

    0

    0

    0

    (

    1,3

    0

    0

    -

    1

    (

    1,5

    0

    -

    0

    1

    2,3

    0

    0

    1

    -

    (

    2,10

    -

    0

    1

    0

    (

    8,10

    1

    0

    -

    0

    (

    3,11

    -

    0

    1

    1

    (

    5,13

    -

    1

    0

    1

    10,11

    1

    0

    1

    -

    (

    11,15

    1

    -

    1

    1

    13,15

    1

    1

    -

    1

    Minterm

    Cube

    0,1,2,3

    0

    0

    -

    -

    0,8,2,10

    -

    0

    -

    0

    2,3,10,11

    -

    0

    1

    -

  • STEP 1 - EXAMPLEf on = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)

    f on = {A,B,C,D,E,F,G} = {00--, -01-, -0-0, 0-01, -101, 1-11, 11-1}

    Question: Can this be done on a CCM? How modified?

    Minterm

    Cube

    0

    0

    0

    0

    0

    (

    1

    0

    0

    0

    1

    (

    2

    0

    0

    1

    0

    (

    8

    1

    0

    0

    0

    (

    3

    0

    0

    1

    1

    (

    5

    0

    1

    0

    1

    (

    10

    1

    0

    1

    0

    (

    11

    1

    0

    1

    1

    (

    13

    1

    1

    0

    1

    (

    15

    1

    1

    1

    1

    (

    Minterm

    Cube

    0,1

    0

    0

    0

    -

    (

    0,2

    0

    0

    -

    0

    (

    0,8

    -

    0

    0

    0

    (

    1,3

    0

    0

    -

    1

    (

    1,5

    0

    -

    0

    1

    PI=D

    2,3

    0

    0

    1

    -

    (

    2,10

    -

    0

    1

    0

    (

    8,10

    1

    0

    -

    0

    (

    3,11

    -

    0

    1

    1

    (

    5,13

    -

    1

    0

    1

    PI=E

    10,11

    1

    0

    1

    -

    (

    11,15

    1

    -

    1

    1

    PI=F

    13,15

    1

    1

    -

    1

    PI=G

    Minterm

    Cube

    0,1,2,3

    0

    0

    -

    -

    PI=A

    0,8,2,10

    -

    0

    -

    0

    PI=C

    2,3,10,11

    -

    0

    1

    -

    PI=B

  • STEP 2 Construct Cover TablePIs Along Vertical Axis (in order of # of literals)Minterms Along Horizontal Axis

    NOTE: Table 4.2 in book is incomplete

    0

    1

    2

    3

    5

    8

    10

    11

    13

    15

    A

    x

    x

    x

    x

    B

    x

    x

    x

    x

    C

    x

    x

    x

    x

    D

    x

    x

    E

    x

    x

    F

    x

    x

    G

    x

    x

  • STEP 2 Finding the Minimum CoverExtract All Essential Prime Implicants, EPIEPIs are the PI for which a Single x Appears in a ColumnC is an EPI so: f on={C, ...}Row C and Columns 0, 2, 8, and 10 can be Eliminated Giving Reduced Cover TableExamine Reduced Table for New EPIs

    0

    1

    2

    3

    5

    8

    10

    11

    13

    15

    A

    x

    x

    x

    x

    B

    x

    x

    x

    x

    C

    x

    x

    x

    x

    D

    x

    x

    E

    x

    x

    F

    x

    x

    G

    x

    x

  • STEP 2 Reduced TableEssential rowDistinguished ColumnThe Row of an EPI is an Essential rowThe Column of the Single x in the Essential Row is a Distinguished Column

    0

    1

    2

    3

    5

    8

    10

    11

    13

    15

    A

    x

    x

    x

    x

    B

    x

    x

    x

    x

    C

    x

    x

    x

    x

    D

    x

    x

    E

    x

    x

    F

    x

    x

    G

    x

    x

    1

    3

    5

    11

    13

    15

    A

    x

    x

    B

    x

    x

    D

    x

    x

    E

    x

    x

    F

    x

    x

    G

    x

    x

  • Row and Column DominanceIf Row P has xs Everywhere Row Q Does Then Q Dominates P if P has fewer xs

    If Column i has xs Everywhere j Does Then j Dominates i if i has fewer xs

    If Row P is equal to Row Q and Row Q does not cost more than Row P, eliminate Row P, or if Row P is dominated by Row Q and Row Q Does not cost more than Row P, eliminate Row P

    If Column i is equal to Column j, eliminate Column i or if Column i dominates Column j, eliminate Column i

  • STEP 3 The Reduced Cover TableInitially, Columns 0, 2, 8 and 10 RemovedNo EPIs are Present No Row Dominance ExistsNo Column Dominance ExistsThis is Cyclic Cover TableMust Solve Exactly OR Use a Heuristic

    1

    3

    5

    11

    13

    15

    A

    x

    x

    B

    x

    x

    D

    x

    x

    E

    x

    x

    F

    x

    x

    G

    x

    x

  • The Cyclic Cover Table

  • The Cyclic Cover TableFor now, we Arbitrarily Choose a PILater we will Study Exact and Heuristic MethodsArbitrarily Choose F so: fon={C, F, ...} This Choice May Lead to a Non-Optimal Result!!!!Form Reduced Cover and Go To Step 2

    1

    3

    5

    11

    13

    15

    A

    x

    x

    B

    x

    x

    D

    x

    x

    E

    x

    x

    F

    x

    x

    G

    x

    x

  • STEP 3 DominanceInitially, Reduced Table has Columns 11 and 15 RemovedG is Dominated by EB is Dominated by AForm Reduced Cover Table and Go To Step 2

    1

    3

    5

    13

    A

    x

    x

    B

    x

    D

    x

    x

    E

    x

    x

    G

    x

  • STEP 2 The Reduced CoverInitially, Table has Rows G and B RemovedSecondary EPIs A and EAll Columns CoveredEliminate D fon={C, F, A, E}

    1

    3

    5

    13

    A

    x

    x

    D

    x

    x

    E

    x

    x

  • Result CheckInitial Minterm Listfon = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)Final Resultf on={A, C, E, F}11110001111000011110abcd11111111110001111000011110abcd111111

  • QuestionsExplain Quine-McCluskey Method.How to program QM Method in CCM?Methods to solve Covering Problem.Possible Applications of Covering.Reduction of Covering to Petrick Function.Merging Operator.

    **************************