Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

Multi-Level Minimization 1: Network Model

3
9 2-level minimization a la ESPRESSO 9 Manipulates (reshapes) SOP covers of functions 9 Heuristic: REDUCE - EXPAND - IRREDUNDANT 9 Multi-level minimization, where final form of logic network is not
just 2-level SOP AND-OR form

,9 4: ;08003841,7

3 3

,9 8 019

9 New, more general model of logic networks 9 New operators: forms of division 9 New heuristic minimization strategies to use this model + operators

,9/4 0300/

Why Multi-Level Forms


3 
0;0 94470897 .9 ;0 850. 1 .,70,;8/0 , 97,/0411
9 Area = gates + literals, i.e., things that take space on a chip 9 Delay = max levels of logic gates required to compute function 9 2-level is minimum delay possible (ignoring loading and fan-in effects),
but usually worst on area delay
multi-level designs = fewer gates, but > 2 levels

slower, >2 levels

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

fastest, 2 levels small, few gates+literals big, many gates+literals

area

Why Multi-Level?
3 #,70 800
0;0 /08 3814770, - 9 3 8 2489 147
5 0.0841- 079 3 8 9 Even smallest things routinely done as multi-level 9 Example: full adder cell
2-level form ab cin sum = 1 1 1
sum cin sum a b

Multilevel form
a b cin

sum = abcin + abcin + abcin + abcin

ab cin cout = 1 1 1 1
cout cout = ab + acin + bcin 9 gates, 25 inputs

cout 5 gates, 10 inputs

Boolean Logic Network Model


3 00/2470845 89 .,90/24/0 419 080309 47 8 3 0 24/0 44 0,3 4 .09 47
9 Idea:
its a netlist of connected components, like a logic diagram, but now individual components can be arbitrary Boolean functions Ordinary gate netlist a b c x y Same circuit as a Boolean logic network, x, y are now Boolean functions a x=ab b c y=x+c y x

primary inputs

internal vertices

primary outputs

Boolean Logic Networks


3 9 8 :89, 7,5  9
9 Primary inputs (usually vars) 9 Primary outputs (stuff network creates for other logic to consume) 9 Intermediate nodes that are themselves represented as single output
Boolean functions generally all in SOP form

3 4 

9 Look at some operators that one can use to manipulate these networks 9 Some are fairly simple structural operations on graphs 9 Some will require entirely new operators (like division) 9

,9

Boolean Logic Networks


3 438 /070 ,25 017420 . 0
p = ce + de q=a+b r = p + a s = r + b t = ac + ad + bc + bd + e u = qc + qc + qc v = ad + bd + cd + ae w=v x=s y=t z=u a b c t=ac+ad+bc+bd+e d e q=a+b u = qc+qc+qc z y v=ad+bd+cd+ae p=ce+de r=p+a s=r+b w x

Cost =

nodes

# literals = 33

Lets look at some operations on this network...

Reminder: Boolean Network Model


3 #0202-07
9 Its a graph 9 Has primary inputs and outputs 9 Internal nodes mean here is an SOP-form Boolean function 9 Edges means here are signals going into/out of these functions 9 #literals = count up all literals in every SOP equation in every Boolean
node As gates it looks like this...
w s=r+b x y z v=ad+bd+cd+ae p=ce+de r=p+a

,99 85 .9:7020,38

a b c

c e d a s b p r

t=ac+ad+bc+bd+e d e q=a+b u = qc+qc+qc

literals = 33

Network Ops: Elimination


3  2 3,9 43
9 9 Removes an internal vertex by replacing it (adding its SOP expression)
into all the other vertices it feeds Note: eliminate vertex for r substituting (p+a) in s node To eliminate node r,requires you must substitute (p + a) into node s, replacing variable r in the expression of node s.
a b c t=ac+ad+bc+bd+e d e q=a+b u = qc+qc+qc z y v=ad+bd+cd+ae p=ce+de r=p+a s=r+b w x

a b c

v=ad+bd+cd+ae p=ce+de t=ac+ad+bc+bd+e s=p+a+b

w x y z

d e q=a+b ( = -1 good ) u = qc+qc+qc

literals =

32

Network Ops: Decomposition


3 0.42548 9 43
9 9 Decompose internal vertex by replacing it with 2 or more new vertices
that make a subnetwork logically equivalent to it (and simpler) Example: Note that v=ad+bd+cd+ae = v=(a+b+c)d+ae Decomposes into
a b c t=ac+ad+bc+bd+e d e q=a+b u = qc+qc+qc z y v=ad+bd+cd+ae p=ce+de r=p+a s=r+b w x

j = a+b+c j=a+b+c p=ce+de

v = jd + ae v=jd+ae r=p+a s=r+b

a b c

w x y z

t=ac+ad+bc+bd+e d e q=a+b u = qc+qc+qc

literals =

32 ( = -1 good )

Network Ops: Extraction


3  97,.9 43
9 9 9
Create a new vertex that represents a common subexpression for 2 vertices, and add it to network Substitute the output of the new vertex for common parts elsewhere Note that: t = ac+ad+bc+bd+e = (a+b)(c+d) + e = (a+b)k + e = ak+bk+e p = ce+de = (c+d)e = ke where k = c+d
w s=r+b x y z

a b c

v=ad+bd+cd+ae p=ce+de r=p+a

a b c d e

v=ad+bd+cd+ae p=ke k=c+d q=a+b r=p+a s=r+b t=ka+kb+e u = qc+qc+qc

w x y z

t=ac+ad+bc+bd+e d e q=a+b u = qc+qc+qc

literals =

29

( = -4 good )

Network Ops: Simplification


3 $ 25 1 .,9 43
9 Just run a 2-level minimizer (ESPRESSO!) at a vertex -- see if the SOP
cover of the vertex gets simpler 9 Note -- if you dont eliminate any vars, its a local transformation 9 If you actually eliminate a var, its global -- changes the network 9 Note: u = qc+qc+qc = q+c (both cover all q,c minterms but qc) a
a b c t=ac+ad+bc+bd+e d e q=a+b u = qc+qc+qc z y v=ad+bd+cd+ae p=ce+de r=p+a s=r+b w x

v=ad+bd+cd+ae p=ce+de r=p+a s=r+b

w x y z

b c

t=ac+ad+bc+bd+e d e q=a+b u = q+c local change, inside vertex only

literals =

29

( = -4 good )

Network Ops: Substitution


3 $:-89 9:9 43
9
a b c d e q=a+b u = qc+qc+qc z

9 Uses existing node in network to simplify SOP form of another node 9 Change SOP form in a node by removing a factor, and adding a
connection from vertex with that common (eg, extracted) factor Note: After we extracted factor k, we can now recognize that t=ka+kb+e = kq +e so substitute in q for a+b
w s=r+b t=ka+kb+e x y

v=ad+bd+cd+ae p=ke k=c+d r=p+a

a b c d e

v=ad+bd+cd+ae p=ke k=c+d q=a+b r=p+a s=r+b t=kq+e u = qc+qc+qc

w x y z

literals =

27

( = -2 good )

Network Ops: Iterative Improvement


3 $47941 0$!#$$  445
9 9 Iteratively apply these (and other) ops to network to try to improve it 9 Usually count literals (all wires into each node of the network)
or count (gates + literals) Our example can simplify to this by applying these ops:

Literals Before: 33 After: 20

a b c d e

j=a+b+c

v=jd+ae s=ke+a+b

w x y z

k=c+d q=a+b u = q+c

t=kq+e

Network Ops: Scripts


3
9 Programs like MIS II, SIS, HSIS, VIS (from Berkeley) 9 Commercial tools from Synopsys, Ambit
,9/42: 9 0;0 8 39 08 8944 8 44  0 ,9/45045 070, :8094/42: 9
0;0 459 2 ,9 43

9 Use Boolean network model 9 Provide collections of network operators 9 Users invoke scripts that run a sequence of these ops on their design
,9 8,8.7 59 44  0 

Scripts
3 070 8, 1,24:8 8.7 5947 3, 1742 $ 944 3 % 084
., 0/ 7: 0/ 8.7 59
9 A sequence of network ops...
sweep; eliminate -1 simplify -m nocomp eliminate - 1 sweep; eliminate 5 simplify -m nocomp resub -a fx resub -a; sweep eliminate -1; sweep full_simplify -m nocomp

Rugged Ops: Sweep


3 $ 005
9 9 9 Eliminates all single-input
vertices Eliminates vertices with a constant function (i.e., ==0, ==1 always) Sort of a basic clean up op

sweep; eliminate -1 simplify -m nocomp eliminate - 1 sweep; eliminate 5 simplify -m nocomp resub -a
fx resub -a; sweep eliminate -1; sweep full_simplify -m nocomp

Sweep Examples
Sweep examples

a F=a G=F G

H=F

Network Ops: Eliminate


3  2 3,90 9 708 4 /
9 Eliminates node by 9 9
collapsing it into its fanout nodes Eliminates all nodes with value less than or equal to threshold. Value of node is number of literals added by eliminating the node: 9 Reduce literals by number of places node variable is used. 9 Increase literals by size of node times number of extra times (>1) its used -1 means eliminate nodes only used once elsewhere in network sweep; eliminate -1 simplify -m nocomp eliminate -1 sweep; eliminate 5 simplify -m nocomp resub -a fx resub -a; sweep

eliminate -1; sweep full_simplify -m nocomp

9 threshold > 0 means we allow some increase in literal count 9 Sets up opportunities for other simplifications (kind of like
REDUCE in ESPRESSO)

Value of Elimination
3 $.03,7 4
9 We have a vertex that has L literals; Its used N times in other vertices 9 What happens if we eliminate it? What is value of this? 9 Answer is: change in total number of literals in design
Now, eliminate vertex F G1 = F + ... G2 = F + ... F = L literals GN = F + ... G1 = L lits + ... G2 = L lits + ... GN = L lits + ... Total literals after eliminate= N*L Change = value = N*L - L - N

Total literals in this sub-piece = L + N

Eliminate Examples
Eliminate -1 F = ab G = ab + x G=F+x Eliminate 5 G1 = F + d G2 = F + ef F = abc G3 = F + gh G4 = Fd + e G1 = abc + d G2 = abc + ef G3 = abc + gh G4 = abcd + e literals = 3 - 4 = -1

literals = 19 - 14 = +5

Network Ops: Simplify


3 8 25 1
9 Run ESPRESSO on each node 9 Minimize SOP 2-level form of each 9 -m nocomp says dont try to
compute the full offset for each node-- makes it run faster 9 Run time of expand depends on size of blocking matrix sweep; eliminate -1 simplify -m nocomp eliminate -1 sweep; eliminate 5 simplify -m nocomp resub -a fx resub -a; sweep eliminate -1; sweep full_simplify -m nocomp

3 1: *8 25 1
9

9 Same as simplify, but uses a

larger set of dont cares... ...works harder to try to get a better (smaller SOP) answer

Simplify Examples
Simplify

F = a + ab + c

F=a+c

G = a + a

G=1

Network Ops: Resub


3 #08:-
,
9 9 9 9 9 9 Re-substitute each node in the
network into each other node in the network In other words, for each pair of nodes S, T, checks if S is a factor of T, or if T is a factor of S Tries to use both the true and complemented form of the output of each node it tries to substitute Loops until network stops getting better, ie, literal count stops decreasing -a means that algebraic division is used to see if one node can substitute (divide) into another (We talk about algebraic division next ) sweep; eliminate -1 simplify -m nocomp eliminate -1 sweep; eliminate 5 simplify -m nocomp resub -a fx resub -a; sweep eliminate -1; sweep full_simplify -m nocomp

Resub Example
Resub example 1 F = ab G = F+c G = ab+c H = ab+e Resub example 2 F = ab G = ab+c H = a+b+cd F = ab H = F+cd G = F+c F = ab H = F+e

Network Ops: Fx
3
9 Extracts common subexpressions
that are either 9 A single cube (eg, bcd) 9 A double cube (eg, ab + bcd) Result is a whole bunch of new nodes in the network that represent these common factors removed Note that after you get these factors, you run resub to see which ones you can use in other places sweep; eliminate -1 simplify -m nocomp eliminate -1 sweep; eliminate 5 simplify -m nocomp resub -a

9 9

fx resub -a; sweep


eliminate -1; sweep full_simplify -m nocomp

fx Example
fx example

F = ab+c+x F = N+x G = abx+cx+d H = ab+d N=ab+c G = Nx+d Extract ab+c H = ab+d

resub != fx
3 1 97 08941 3/ .422431,.9478
9 It adds nodes to the network to do this 9 It substitutes these new nodes in where it helps overall literal count 9 It CANNOT go find or extract new factors 9 It just looks at what nodes are already around in network 9 It tries to use these to substitute one node into another to save literals 9 Cost is opposite as well 9 Extract N instances of a factor with L literals 9 Literal savings is N + L - N*L
,9 8, 70,/  3309 47

3 708:-:808

3 708:- 89 045548 90410 2 3,90

Rugged Script

Initial houskeeping

sweep; eliminate -1 simplify -m nocomp eliminate -1 sweep; eliminate 5 simplify -m nocomp resub -a fx resub -a; sweep eliminate -1; sweep full_simplify -m nocomp

Prepare for factoring

Aggressive factoring Optimize 2-level nodes

You might also like