multilevel ml

Upload: hari-prasad

Post on 04-Jun-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Multilevel ML

    1/28

    Multi Level Minimization 1: Network Model

    2-level minimization a la ESPRESSO

    Manipulates (reshapes) SOP covers of functions

    Heuristic: REDUCE - EXPAND - IRREDUNDANT

    Multi-level minimization, where final form of logic network is not

    just 2-level SOP AND-OR form

    New, more general model of logic networks

    New operators: forms of division

    New heuristic minimization strategies to use this model + operators

  • 8/13/2019 Multilevel ML

    2/28

    Why Multi-Level Forms

    Area = gates + literals, i.e., things that take space on a chip

    Delay = max levels of logic gates required to compute function

    2-level is minimumdelay possible (ignoring loading and fan-in effects),but usually worston area

    area

    delay

    typical 2-level design =many gates, but only 2 levelsof logic, so fastest possible

    multi-level designs =fewer gates, but > 2 levels

    small,few gates+literals

    big,many gates+literals

    fastest, 2 levels

    slower, >2 levels

  • 8/13/2019 Multilevel ML

    3/28

    Why Multi-Level?

    Even smallestthings routinely done as multi-level

    Example: full adder cell

    sum =

    ab

    cin

    cout=

    ab

    cin

    1

    1

    11

    11

    11

    2-level form Multilevel form

    sum = abcin + abcin+ abcin+ abcin

    cout= ab + acin+ bcin

    sum

    cout

    9 gates, 25 inputs 5 gates, 10 inputs

    sum

    cout

    a b cin

    bacin

  • 8/13/2019 Multilevel ML

    4/28

    Boolean Logic Network Model

    Idea: its a netlist of connected components, like a logic diagram, but

    now individual components can be arbitraryBoolean functions

    a

    b

    c

    x

    y

    Ordinary gate netlist Same circuit as aBoolean logic network,

    x, y are now Boolean functions

    primary

    inputs

    primaryoutputs

    internal

    vertices

    a

    b

    c

    x

    y

    x=ab

    y=x+c

  • 8/13/2019 Multilevel ML

    5/28

    Boolean Logic Networks

    Primary inputs (usually vars)

    Primary outputs (stuff network creates for other logic to consume)

    Intermediate nodes that are themselves represented as single outputBoolean functions generally all in SOP form

    Look at some operators that one can use to manipulate these networks

    Some are fairly simple structuraloperations on graphs

    Some will require entirely new operators (like division)

  • 8/13/2019 Multilevel ML

    6/28

    Boolean Logic Networks

    p = ce + de

    q = a + br = p + as = r + bt = ac + ad + bc + bd + e

    u = qc + qc + qc

    v = ad + bd + cd + aew = vx = sy = tz = u

    a

    b

    c

    d

    e

    v=ad+bd+cd+ae

    p=ce+de

    t=ac+ad+bc+bd+e

    q=a+b u = qc+qc+qc

    r=p+a s=r+b

    w

    x

    y

    z

    Lets look at some operations on this network...

    Cost = # literals = 33nodes

  • 8/13/2019 Multilevel ML

    7/28

    Reminder: Boolean Network Model

    Its a graph

    Has primary inputs and outputs

    Internal nodes mean here is an SOP-form Boolean function Edges means here are signals going into/out of these functions

    #literals = count up all literals in every SOP equation in every Booleannode

    a

    b

    c

    d

    e

    v=ad+bd+cd+ae

    p=ce+de

    t=ac+ad+bc+bd+e

    q=a+b u = qc+qc+qc

    r=p+a s=r+b

    w

    x

    y

    z

    As gates it looks like this...

    c

    e

    d

    p

    a

    b

    s

    r

    literals = 33

  • 8/13/2019 Multilevel ML

    8/28

    Network Ops: Elimination

    Removes an internal vertex by replacing it (adding its SOP expression)into all the other vertices it feeds

    Note: eliminate vertex for rrequires substituting (p+a) in snode

    a

    b

    c

    d

    e

    v=ad+bd+cd+ae

    p=ce+de

    t=ac+ad+bc+bd+e

    q=a+b u = qc+qc+qc

    s=p+a+b

    w

    x

    y

    z

    a

    b

    c

    d

    e

    v=ad+bd+cd+ae

    p=ce+de

    t=ac+ad+bc+bd+e

    q=a+b u = qc+qc+qc

    r=p+a s=r+b

    w

    x

    y

    z

    literals =

    To eliminate node r, you must substitute (p + a) into node s,replacing variable r in the expression of node s.

    32 ( = -1 good )

  • 8/13/2019 Multilevel ML

    9/28

    Network Ops: Decomposition

    Decompose internal vertex by replacing it with 2 or more new verticesthat make a subnetwork logically equivalent to it (and simpler)

    Example:

    a

    b

    c

    d

    e

    v=jd+ae

    p=ce+de

    t=ac+ad+bc+bd+e

    q=a+b u = qc+qc+qc

    r=p+a s=r+b

    w

    x

    y

    z

    j=a+b+c

    a

    b

    c

    d

    e

    v=ad+bd+cd+ae

    p=ce+de

    t=ac+ad+bc+bd+e

    q=a+b u = qc+qc+qc

    r=p+a s=r+b

    w

    x

    y

    z

    Decomposes into

    Note that =

    literals =

    v=ad+bd+cd+ae

    j = a+b+c v = jd + ae

    32 ( = -1 good )

    v=(a+b+c)d+ae

  • 8/13/2019 Multilevel ML

    10/28

    Network Ops: Extraction

    Create a new vertex that represents a common subexpression for2 vertices, and add it to network

    Substitute the output of the new vertex for common parts elsewhere Note that:

    a

    b

    c

    d

    e

    v=ad+bd+cd+ae

    p=ke

    t=ka+kb+e

    q=a+b u = qc+qc+qc

    r=p+a s=r+b

    w

    x

    y

    z

    k=c+d

    a

    b

    c

    d

    e

    v=ad+bd+cd+ae

    p=ce+de

    t=ac+ad+bc+bd+e

    q=a+b u = qc+qc+qc

    r=p+a s=r+b

    w

    x

    y

    z

    literals =

    t = ac+ad+bc+bd+e = (a+b)(c+d) + e = (a+b)k + e = ak+bk+e

    p = ce+de = (c+d)e = kewhere k = c+d

    29 ( = -4 good )

  • 8/13/2019 Multilevel ML

    11/28

    Network Ops: Simplification

    Just run a 2-level minimizer (ESPRESSO!) at a vertex -- see if the SOPcover of the vertex gets simpler

    Note -- if you dont eliminate any vars, its a localtransformation

    If you actually eliminate a var, its global-- changes the network

    Note:

    a

    b

    c

    d

    e

    v=ad+bd+cd+ae

    p=ce+de

    t=ac+ad+bc+bd+e

    q=a+b u = q+c

    r=p+a s=r+b

    w

    x

    y

    z

    local change,inside vertex only

    a

    b

    c

    d

    e

    v=ad+bd+cd+ae

    p=ce+de

    t=ac+ad+bc+bd+e

    q=a+b u = qc+qc+qc

    r=p+a s=r+b

    w

    x

    y

    z

    literals =

    u = qc+qc+qc = q+c (both cover all q,c minterms but qc)

    29 ( = -4 good )

  • 8/13/2019 Multilevel ML

    12/28

  • 8/13/2019 Multilevel ML

    13/28

  • 8/13/2019 Multilevel ML

    14/28

    Network Ops: Scripts

    Programs like MIS II, SIS, HSIS, VIS (from Berkeley)

    Commercial tools from Synopsys, Ambit

    Use Boolean network model

    Provide collections of network operators

    Users invoke scriptsthat run a sequence of these ops on their design

  • 8/13/2019 Multilevel ML

    15/28

    Scripts

    A sequence of network ops...

    sweep; eliminate -1simplify -m nocomp

    eliminate - 1

    sweep; eliminate 5

    simplify -m nocompresub -a

    fxresub -a; sweep

    eliminate -1; sweepfull_simplify -m nocomp

  • 8/13/2019 Multilevel ML

    16/28

    Rugged Ops: Sweep

    Eliminates all single-inputvertices

    Eliminates vertices with aconstant function (i.e., ==0, ==1always)

    Sort of a basic clean up op

    sweep; eliminate -1simplify -m nocomp

    eliminate - 1

    sweep; eliminate 5simplify -m nocompresub -a

    fxresub -a; sweep

    eliminate -1; sweep

    full_simplify -m nocomp

  • 8/13/2019 Multilevel ML

    17/28

    Sweep Examples

    Sweep examples

    a

    G

    F=a

    G=F

    HH=F

    a

    G

    H

  • 8/13/2019 Multilevel ML

    18/28

    Network Ops: Eliminate

    Eliminates node by collapsing it into itsfanout nodes

    Eliminates all nodes with value less than

    or equal to threshold. Value of node is number of literals added

    by eliminating the node:

    Reduce literals by number of placesnode variable is used.

    Increase literals by size of node timesnumber of extra times (>1) its used

    -1 means eliminate nodes only usedonce elsewhere in network

    sweep; eliminate -1

    simplify -m nocompeliminate -1

    sweep; eliminate 5

    simplify -m nocompresub -a

    fxresub -a; sweep

    eliminate -1; sweepfull_simplify -m nocomp

    threshold > 0 means we allow some increase in literal count

    Sets up opportunities for other simplifications (kind of likeREDUCE in ESPRESSO)

  • 8/13/2019 Multilevel ML

    19/28

    Value of Elimination

    We have a vertex that has L literals; Its used N times in other vertices

    What happens if we eliminate it? What is value of this?

    Answer is: change in total number of literals in design

    F = L literals

    G1 = F + ...

    G2 = F + ...

    GN = F + ...

    Total literals in thissub-piece =

    Now, eliminate vertex F

    Total literals aftereliminate=

    Change = value =

    G1 = L lits + ...

    G2 = L lits + ...

    GN = L lits + ...

    L + N

    N*L

    N*L - L - N

  • 8/13/2019 Multilevel ML

    20/28

    Eliminate Examples

    Eliminate -1

    Eliminate 5

    F = ab

    G = F + x G = ab + x

    F = abc

    G4 = Fd + e

    G1 = F + d

    G2 = F + ef

    G3 = F + gh

    G4 = abcd + e

    G1 = abc + d

    G2 = abc + ef

    G3 = abc + gh

    literals =19 - 14 = +5

    literals =3 - 4 = -1

  • 8/13/2019 Multilevel ML

    21/28

    Network Ops: Simplify

    Run ESPRESSO on each node

    Minimize SOP 2-level form of each

    -m nocomp says dont try tocompute the full offset for eachnode-- makes it run faster

    Run time of expand dependson size of blocking matrix

    Same as simplify, but uses a

    larger set of dont cares...

    ...works harder to try to get a

    better (smaller SOP) answer

    sweep; eliminate -1simplify -m nocomp

    eliminate -1

    sweep; eliminate 5simplify -m nocomp

    resub -a

    fxresub -a; sweep

    eliminate -1; sweepfull_simplify -m nocomp

  • 8/13/2019 Multilevel ML

    22/28

    Simplify Examples

    Simplify

    F = a + ab + c

    G = a + a

    F = a + c

    G = 1

  • 8/13/2019 Multilevel ML

    23/28

    Network Ops: Resub

    Re-substitute each node in thenetwork into each other node inthe network

    In other words, for each pair ofnodes S, T, checks if S is a factorof T, or if T is a factor of S

    Tries to use both the true andcomplemented form of the outputof each node it tries to substitute

    Loops until network stops gettingbetter, ie, literal count stopsdecreasing

    -a means that algebraic divisionis used to see if one node cansubstitute (divide) into another

    (We talk aboutalgebraic divisionnext )

    sweep; eliminate -1simplify -m nocompeliminate -1

    sweep; eliminate 5simplify -m nocomp

    resub -a

    fxresub -a; sweep

    eliminate -1; sweepfull_simplify -m nocomp

  • 8/13/2019 Multilevel ML

    24/28

    Resub Example

    Resub example 1

    Resub example 2

    G = ab+c

    F = ab

    H = ab+e

    G = F+c

    F = ab

    H = F+e

    G = ab+c

    F = ab

    H = a+b+cd

    G = F+c

    F = ab H = F+cd

  • 8/13/2019 Multilevel ML

    25/28

    Network Ops: Fx

    Extracts common subexpressionsthat are either

    A single cube (eg, bcd)

    A double cube (eg, ab + bcd)

    Result is a whole bunch of newnodes in the network thatrepresent these common factors

    removed Note that after you get these

    factors, you run resub to seewhich ones you can use in otherplaces

    sweep; eliminate -1simplify -m nocompeliminate -1

    sweep; eliminate 5simplify -m nocompresub -a

    fxresub -a; sweep

    eliminate -1; sweepfull_simplify -m nocomp

  • 8/13/2019 Multilevel ML

    26/28

    fx Example

    fx example

    G = abx+cx+d

    F = ab+c+x

    H = ab+dExtract

    ab+c

    G = Nx+d

    F = N+x

    H = ab+d

    N=ab+c

  • 8/13/2019 Multilevel ML

    27/28

    resub != fx

    It addsnodes to the network to do this

    It substitutes these new nodes in where it helps overall literal count

    It CANNOT go find or extract new factors

    It just looks at what nodes are alreadyaround in network

    It tries to use these to substitute one node into another to save literals

    Cost is opposite as well

    Extract N instances of a factor with L literals

    Literal savings is N + L - N*L

  • 8/13/2019 Multilevel ML

    28/28

    Rugged Script

    sweep; eliminate -1

    simplify -m nocompeliminate -1

    sweep; eliminate 5

    simplify -m nocomp

    resub -a

    fxresub -a; sweep

    eliminate -1; sweep

    full_simplify -m nocomp

    Initial

    houskeeping

    Prepare for

    factoring

    Aggressivefactoring

    Optimize

    2-level nodes