0% found this document useful (0 votes)
32 views34 pages

Lec 07

Uploaded by

Basma Gamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views34 pages

Lec 07

Uploaded by

Basma Gamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

(Lec 7) Multi-Level Minimize I: Models & Methods

^ What you’ve seen so far...


X 2-level minimization a la ESPRESSO
Z Manipulates (reshapes) SOP covers of functions
Z Heuristic: REDUCE - EXPAND - IRREDUNDANT

^ What’s left?
X Multi-level minimization, where final form of logic network is not
just 2-level SOP AND-OR form

^ What do we need?
X New, more general model of logic networks
X New operators: forms of division for Boolean functions
X New heuristic minimization strategies to use this model + operators

© R. Rutenbar 2001, CMU 18-760, Fall 2001 1

Copyright Notice

© Rob A. Rutenbar, 2001


All rights reserved.
You may not make copies of this
material in any form without my
express permission.

© R. Rutenbar 2001, CMU 18-760, Fall 2001 2

Page 1
Where Are We?
^ Moving on to real logic synthesis--for multi-level stuff
M T W Th F
Aug 27 28 29 30 31 1 Introduction
Sep 3 4 5 6 7 2 Advanced Boolean algebra
10 11 12 13 14 3 JAVA Review
17 18 19 20 21 4 Formal verification
24 25 26 27 28 5 2-Level logic synthesis
Oct 1 2 3 4 5 6 Multi-level logic synthesis
8 9 10 11 12 7
Technology mapping
15 16 17 18 19 8
Placement
22 23 24 25 26 9
Routing
29 30 31 1 2 10
Nov 5 Static timing analysis
6 7 8 9 11
12 13 14 15 16 12 Electrical timing analysis
Thnxgive 19 20 21 22 23 13 Geometric data structs & apps
26 27 28 29 30 14
Dec 3 4 5 6 7 15
10 11 12 13 14 16
© R. Rutenbar 2001, CMU 18-760, Fall 2001 3

Readings
^ DeMicheli has a lot of relevant stuff
X Again, he worked on some of this at Berkeley and at IBM

^ Read this in Chapter 8


X 8.1 Intro: take a look.
X 8.2 Models and Transforms--this is about the “Boolean network model”
X 8.3 The Algebraic Model -- how people do factoring for complex
Boolean logic networks

© R. Rutenbar 2001, CMU 18-760, Fall 2001 4

Page 2
Why Multi-Level Forms
^ 2-level too restrictive: specific area vs delay tradeoff
X Area = gates + literals (wires), ie, things that take space on a chip
X Delay = max levels of logic gates required to compute function
X 2-level is minimum gate delay possible, but usually worst on area

multi-level designs =
delay 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
area
small, big,
few gates+lits many gates+lits

© R. Rutenbar 2001, CMU 18-760, Fall 2001 5

Why Multi-Level?
^ Rarely see 2-level designs for really big things, mostly for
pieces of bigger things
X Even smallish things routinely done as multi-level

1 2 3 4 999
?
~1000 gate
“block” of logic
1000

This is usually NOT going to be the


preferred logic network structure...

© R. Rutenbar 2001, CMU 18-760, Fall 2001 6

Page 3
Real MultiLevel Example
X …and this is a pretty small design, done by Synopsys DesignCompiler

Levels of
1 2 3 4 5 6 7 8 9 10 11 logic in
network

© R. Rutenbar 2001, CMU 18-760, Fall 2001 7

Boolean Logic Network Model


^ Need more sophisticated model of these networks
^ New model: Boolean Logic Network
X Idea: it’s a netlist of connected components, like a logic diagram, but
now individual components can be arbitrary Boolean func’s

Ordinary gate netlist Same circuit as a


Boolean logic network,
a x, y are now Boolean functions
x
b

c y

primary internal primary


inputs vertices outputs

© R. Rutenbar 2001, CMU 18-760, Fall 2001 8

Page 4
Boolean Logic Networks
^ It’s just a graph, with:
X Primary inputs (usually vars)
X Primary outputs (stuff network creates for other logic to consume)
X Intermediate nodes that are themselves represented as Boolean
functions...all in SOP form

^ Now what?
X Look at some operators that one can use to manipulate these networks
X Some are fairly simple structural operations on graphs
X Some will require entirely new operators (like division)
X Our derivation follows DeMicheli closely, sections 8.1 and 8.2

© R. Rutenbar 2001, CMU 18-760, Fall 2001 9

Boolean Logic Networks


^ Consider example from De Micheli
X Let’s look at some operations on this network…

p = ce + de
q=a+b a v=a’d+bd+c’d+ae’ w
r = p + a’
s = r + b’ b
t = ac + ad + bc + bd + e p=ce+de r=p+a’ s=r+b’ x
u = q’c + qc’ + qc c
v = a’d + bd + c’d + ae’ t=ac+ad+bc+bd+e y
w=v d
x=s
y=t e q=a+b u = q’c+qc’+qc z
z=u

Network Quality measure = ∑nodes ( literals ) =

© R. Rutenbar 2001, CMU 18-760, Fall 2001 10

Page 5
Reminder: Boolean Network Model
^ Remember what this picture means
X It’s a graph
X Has primary inputs and outputs
X Internal nodes mean “here is an SOP-form Boolean function”
X Edges means “here are signals going into/out of these functions”
X #literals = count up all lits in every SOP equation in every Boolean node
As gates it looks like this...
a v=a’d+bd+c’d+ae’ w

b
p=ce+de r=p+a’ s=r+b’ x
c
t=ac+ad+bc+bd+e y
d

e q=a+b u = q’c+qc’+qc z

© R. Rutenbar 2001, CMU 18-760, Fall 2001 11

Operations on Boolean Network


^ What’s the overall goal here?
X Simplify the network – reduce total number of literals
X Optimize timing – reduce delay from input to output thru gates, wires

^ 3 basic types of operations


X Add new network nodes: this is related to factoring—take “big” nodes
and factor them into more, better, smaller nodes
X Remove network nodes: take nodes that are “too small” and substitute
them back into the fanout nodes that they feed
X Simplify network nodes: no change in # of nodes, just simplify insides

^ A big set of possible operators in real implementations


X Look at just a couple of examples…

© R. Rutenbar 2001, CMU 18-760, Fall 2001 12

Page 6
Network Ops: Elimination
^ Reducing #nodes: Elimination
X Removes an internal vertex by replacing it (adding its SOP expression)
into all the other vertices it feeds
X Note: eliminate vertex for r requires substituting (p+a’) in s node

a v=a’d+bd+c’d+ae’ w

b
a v=a’d+bd+c’d+ae’ w
p=ce+de r=p+a’ s=r+b’ x
c
t=ac+ad+bc+bd+e y b
d
p=ce+de s=p+a’+b’ x
e q=a+b u = q’c+qc’+qc z

c
t=ac+ad+bc+bd+e y
d

e q=a+b u = q’c+qc’+qc z

Σlits =
© R. Rutenbar 2001, CMU 18-760, Fall 2001 13

Network Ops: Extraction


^ Adding nodes: Extraction
X Create a new vertex that represents a common subexpression for
>= 2 vertices, and add it to network
X Substitute the output of the new vertex for common parts elsewhere
X Note that: p = (c+d) e and t=(c+d)(a+b) + e, so extract c+d

a v=a’d+bd+c’d+ae’ w

b
p=ce+de r=p+a’ s=r+b’
a v=a’d+bd+c’d+ae’ w
x
c
t=ac+ad+bc+bd+e y
d b
e q=a+b u = q’c+qc’+qc z
p=ke r=p+a’ s=r+b’ x
c
k=c+d t=ka+kb+e y
d

e q=a+b u = q’c+qc’+qc z

Σlits =
© R. Rutenbar 2001, CMU 18-760, Fall 2001 14

Page 7
Network Ops: Simplification
^ Simplifying a node: 2-Level Simplification
X Run a 2-level minimizer (ESPRESSO!) at a vertex -- see if the SOP cover
of the vertex gets simpler
Z Note -- if you don’t eliminate any vars, it’s a local transformation
Z If you actually eliminate a var, it’s global -- changes the network
Z Note: note u = q’c+qc’+qc = q+c

a v=a’d+bd+c’d+ae’ w

b
a v=a’d+bd+c’d+ae’ w
p=ce+de r=p+a’ s=r+b’ x
c

d
t=ac+ad+bc+bd+e y
b
p=ce+de r=p+a’ s=r+b’ x
e q=a+b u = q’c+qc’+qc z

c
t=ac+ad+bc+bd+e y
d

e q=a+b u = q+c z
local change,
Σlits = inside vertex only
© R. Rutenbar 2001, CMU 18-760, Fall 2001 15

Network Ops: Iterative Improvement


^ Sort of like ESPRESSO loop
X Iteratively apply these (and other) ops to network to try to improve it
X Usually count literals (all wires into each node of the network)
or count (gates + literals)
X Our example can simplify to this by applying these (and other) ops:

Literals a j=a’+b+c’ v=jd+ae’ w

Before: b
s=ke+a’+b’ x
After: c
k=c+d t=kq+e y
d

e q=a+b u = q+c z

© R. Rutenbar 2001, CMU 18-760, Fall 2001 16

Page 8
Network Ops: Scripts
^ What do people really use to do multi-level optimization?
X Programs like MIS II, SIS, HSIS, VIS (from Berkeley)
X Commercial tools from Synopsys, Synplify, Cadence, Avanti

^ What do multilevel synthesis tools look like?


X Use Boolean network model
X Provide collections of network operators
X Users invoke scripts that run a sequence of these ops on their design

^ What’s a script look like...?

© R. Rutenbar 2001, CMU 18-760, Fall 2001 17

Scripts
^ Here is a “famous” script originally from MIS II tool
^ The so-called “rugged” script
X 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

© R. Rutenbar 2001, CMU 18-760, Fall 2001 18

Page 9
Running Real Logic Synthesis: SIS
^ SIS is a Berkeley multi-level synthesis tool
X /afs/ece/class/ee760/sis is the binary for IBM and SUN

UC Berkeley, SIS Development Version (compiled 2-Nov-95 at 6:54 PM)


sis>

Command prompt
Type “help” to get a list of all commands

© R. Rutenbar 2001, CMU 18-760, Fall 2001 19

Rugged Ops: Sweep


^ Sweep ...
X Eliminates all single-input
vertices sweep; eliminate -1
simplify -m nocomp
X Eliminates vertices with a eliminate - 1
constant function (ie, ==0, ==1
always)
sweep; eliminate 5
X Sort of a basic “clean up” op simplify -m nocomp
resub -a

fx
resub -a; sweep

eliminate -1; sweep


full_simplify -m nocomp

© R. Rutenbar 2001, CMU 18-760, Fall 2001 20

Page 10
Sweep Examples

Sweep examples

a a
F=a sweep

G=F G G
H=F H H

Q = a + a’ Q Q

© R. Rutenbar 2001, CMU 18-760, Fall 2001 21

Running sweep in SIS


^ SIS session
sis> read_eqn sweep.eqn UNIX file: sweep.eqn
sis> print a
F=a;
F=a F=a
G=F;
{G} = F G=F
H=F;
G
{H} = F H=F
Q = a + a' ;
H

{Q} = a + a' Q = a + a’ Q

sis> sweep
sis> print
{Q} = a + a'
{G} = a
{H} = a

Change in total literal count:

© R. Rutenbar 2001, CMU 18-760, Fall 2001 22

Page 11
Aside: SIS Syntax
^ For a typical eqn format input file
X + means OR
X * means AND
X “ “ (a space) also means AND
X ‘ (one apostrophe) means NOT (on a literal)
X ( ) used for grouping
X != means EXOR
X == means EXNOR
X !( ) means NEGATE the contents of the parens
X F (a capital letter) usually means a function, output of a network node
X x ( a small letter) usually means a primary input to the overall network
^ SIS “print” output
X {G} means G is a primary output of the network (nobody else eats it)
X [31] means SIS creates a new Boolean network node during
simplification, and it gives you a number in brackets as an ID.

© R. Rutenbar 2001, CMU 18-760, Fall 2001 23

Network Ops: Eliminate


^ Eliminate <threshold>...
sweep; eliminate -1
X Eliminates all nodes in the network
simplify -m nocomp
whose “value” is less than or equal
to threshold. eliminate -1
X Value of node
sweep; eliminate 5
Z =Number of times the node is simplify -m nocomp
used in the factored form for resub -a
each of its fanout nodes
Z =Number of lits saved by NOT fx
eliminating the node resub -a; sweep
X Eliminates node by collapsing it
into its fanout nodes eliminate -1; sweep
X “-1” means eliminate nodes only full_simplify -m nocomp
used once elsewhere in network

© R. Rutenbar 2001, CMU 18-760, Fall 2001 24

Page 12
“Value” of Elimination
^ Scenario
X We have a vertex that has L literals in it; It feeds N other vertices
X What happens if we eliminate it? What is “value” of this?
X Answer is: change in total number of literals in design

eliminate We eliminate vertex F


G1 = F + ... G1 = (L literals) + stuff…

G2 = F + ... G2 = (L literals) + stuff…


F = L literals
• •
• •
• •
GN = F + ... G2 = (L literals) + stuff…

Total literals before = Total literals after =


Change = value =

© R. Rutenbar 2001, CMU 18-760, Fall 2001 25

Eliminate Examples

Eliminate -1

F = ab G = F+x eliminate G = ab+x

Eliminate 5

G1 = F+d G1 = abc +d

G2 = F+ef G2 = abc +ef


F = abc eliminate
G3 = F+gh G3 = abc +gh

G4 = abc +de
G4 = F+de Σlits = Σlits =

© R. Rutenbar 2001, CMU 18-760, Fall 2001 26

Page 13
Running eliminate in SIS
^ SIS session
sis> read_eqn elim.eqn UNIX file: elim.eqn
sis> print F=abc;
F=abc G1 = F + d ;
G2 = F + e f ;
{G1} = F + d
G3 = F + g h ;
{G2} = F + e f G4 = F + de ;
{G3} = F + g h
{G4} = F + de
sis> eliminate 1
sis> print
F=abc
{G1} = F + d No change. Why?
{G2} = F + e f Cost to eliminate F node is +5 literals.
But, we set threshold to +1 literal, so—eliminate
{G3} = F + g h
won’t do anything here. Cost is too high.
{G4} = F + de

© R. Rutenbar 2001, CMU 18-760, Fall 2001 27

Running eliminate in SIS


^ SIS session continued
sis> eliminate 3
sis> print
F=abc
{G1} = F + d No change. Why? Same reason.
{G2} = F + e f Cost to eliminate F node is +5 literals.
But, we set threshold to +3 literals, so—eliminate
{G3} = F + g h
won’t do anything here. Cost is too high.
{G4} = F + de
sis> eliminate 5
sis> print
G1 = abc +d
{G1} = a b c + d
G2 = abc +ef
{G2} = a b c + e f
Now it does it.
{G3} = a b c + g h G3 = abc +gh

{G4} = a b c + de G4 = abc +de


sis>

© R. Rutenbar 2001, CMU 18-760, Fall 2001 28

Page 14
Network Ops: Simplify
^ simplify
sweep; eliminate -1
X Run ESPRESSO on each node
simplify -m nocomp
X Minimize SOP 2-level form of each eliminate -1
X “-m nocomp” says don’t try to
compute the full offset for each sweep; eliminate 5
node-- makes it run faster simplify -m nocomp
^ full_simplify resub -a
X Same as simplify, but uses a larger
fx
set of don’t cares...
resub -a; sweep
X ...works harder to try to get a
better (smaller SOP) answer
eliminate -1; sweep
full_simplify -m nocomp

© R. Rutenbar 2001, CMU 18-760, Fall 2001 29

Simplify Examples

Simplify

F = a + a’b + c simplify G1 = a + b + c

G = a + a’ simplify 1

Goal is just to “clean up” insides of each


node in the Boolean network

© R. Rutenbar 2001, CMU 18-760, Fall 2001 30

Page 15
Network Ops: Resub
^ Resub -a
sweep; eliminate -1
X Substitute each node in the
simplify -m nocomp
network into each other node in
the network eliminate -1
X In other words, for each pair of
sweep; eliminate 5
nodes S, T, checks if S is a factor of
T, or if T is a factor of S simplify -m nocomp
resub -a
X Tries to use both the true and
complemented form of the output
of each node it tries to substitute fx
resub -a; sweep
X Loops until network stops getting
“better”, ie, literal count stops
decreasing eliminate -1; sweep
full_simplify -m nocomp
X “-a” means that algebraic division
is how it checks to see if one node
can substitute (divide) into another
X (We talk about algebraic division
next -- don’t worry...)

© R. Rutenbar 2001, CMU 18-760, Fall 2001 31

Resub Example
Resub example 1

F = ab G = F +c

G = ab+c resub F = ab
H = F+e
H = ab+e

Resub example 2

F = ab Note: F was
G = F +c complemented
G = ab+c resub F = ab

H = a’ + b’ + cd H = F’ +cd

© R. Rutenbar 2001, CMU 18-760, Fall 2001 32

Page 16
Running resub in SIS
^ SIS session
UNIX file: resub.eqn
sis> read_eqn resub.eqn
F=ab;
sis> print G=ab+c;
{F} = a b H=ab+e;
{G} = a b + c
{H} = a b + e
sis> resub -a
sis> print
{F} = a b
G = F +c
{G} = {F} + c
F = ab
{H} = {F} + e H = F+e

© R. Rutenbar 2001, CMU 18-760, Fall 2001 33

Network Ops: Fx
^ Fx
sweep; eliminate -1
X Extracts common subexpressions
simplify -m nocomp
that are either
eliminate -1
Z A single cube (eg, b’cd)
Z A double cube (eg, ab + b’cd) sweep; eliminate 5
X Result is a new nodes in the simplify -m nocomp
network that represent these resub -a
common “factors” removed
X Note that after you get these fx
factors, you run “resub” to see resub -a; sweep
which ones are worth keeping
Z …ie, if it made the network eliminate -1; sweep
worse to factor them out, full_simplify -m nocomp
resub will put the factors back
into the fanout nodes

© R. Rutenbar 2001, CMU 18-760, Fall 2001 34

Page 17
fx Example
fx example

F = ab + c + x F=N+x

fx N = ab+c
G = abx + cx + d G = Nx+d

Fx will conside several


H = ab + d potential factors: H = ab+d
ab, ab+c,
then decide which
ones are worth extracting

© R. Rutenbar 2001, CMU 18-760, Fall 2001 35

Running fx in SIS
^ SIS session
sis> read_eqn fx.eqn UNIX file: fx.eqn
sis> print F = a b + c + x;
{F} = a b + c + x G=abx+cx+d;
{G} = a b x + c x + d H=ab+d;
{H} = a b + d
sis> fx
sis> print
F = [31] + x
{F} = [31] + x
{G} = [31] x + d [31] = ab+c
{H} = a b + d G = [31]x+d
[31] = a b + c
H = ab+d

© R. Rutenbar 2001, CMU 18-760, Fall 2001 36

Page 18
resub != fx
^ fx tries to find NEW common factors
X It adds nodes to the network to do this
X Tries to find good (usable) common subexpressions

^ resub uses what is already in network


X It CANNOT go find or “extract” new factors
X It just looks at what nodes are already around in network
X It tries to use these to substitute one node into another to save literals

^ So….
X Do fx first: create a bunch of good-looking common factors
X Do resub next: try to use these factors to improve network

© R. Rutenbar 2001, CMU 18-760, Fall 2001 37

Rugged Script
^ Now it’s possible to go back sweep; eliminate -1
and really read the script simplify -m nocomp Housekeeping
eliminate -1
^ It should make sense...
X 4 major phases of simplification sweep; eliminate 5
simplify -m nocomp First round of
X Goes from easy optimizations to
harder, more expensive ones resub -a “easy” factoring
X Uses ESPRESSO to do each
individual node fx Second round of
X Uses algebraic division to find resub -a; sweep “aggressive” factoring
good common subexpressions Optimize
eliminate -1; sweep
X Tracks literal count to judge each node
full_simplify -m nocomp
quality of network aggressively

© R. Rutenbar 2001, CMU 18-760, Fall 2001 38

Page 19
Multilevel Synthesis: What’s Left?
^ Factoring: how do we really do it?
X Operators we don’t have are those related to factoring out (extracting)
common subexpressions from multiple vertices
Z Allow us to do the substitution, decomposition, extraction ops
Z (Simplification op is just ESPRESSO on 1 vertex)
Z We need this to be able to do the “fx” factoring

^ New model of Boolean functions: Algebraic model


X Yet another way of thinking about Boolean functions that allows us easily
to do several division-like operations
X Term “algebraic” comes from pretending that Boolean expressions
behave like polynomials of real numbers, not like Boolean algebra
X Big new Boolean operator: algebraic division

© R. Rutenbar 2001, CMU 18-760, Fall 2001 39

Algebraic Model
^ Idea: keep just those rules (axioms) that work for polynomials
of reals AND Boolean algebra, dump rest
Real numbers Boolean algebra

a•b = b•a a•b = b•a


a+b = b+a a+b = b+a
a•(b•c) = (a•b)•c a•(b•c) = (a•b)•c
a+(b+c) = (a+b)+c SAME a+(b+c) = (a+b)+c
a•(b+c) = a•b + a•c a•(b+c) = a•b+a•c
a•1 = a a•0 = 0 a•1 = a a•0 = 0
a+0 = a a+0 = a

a+a’ = 1 a•a’ = 0

x NOT
ALLOWED
a•a = a
a+1 = 1
a+(b•c) = (a+b)•(a+c)
a+a = a

© R. Rutenbar 2001, CMU 18-760, Fall 2001 40

Page 20
Algebraic Model
^ In English
X Only get to use algebra rules from real numbers
X A variable and its complement are treated as totally unrelated

^ Idea
X Boolean functions represented / manipulated as SOP expressions
X Each product term in such an expression is just a set of variables
X The expression itself is just a set of these products (cubes)

© R. Rutenbar 2001, CMU 18-760, Fall 2001 41

Algebraic Division
^ Model for factoring
X Given function f we want to factor like this:

f = d•q + r

divisor remainder (if =0, then we say the


quotient
say quotient is a factor)
X (just like regular numbers, eg, 15 = 7 • 2 + 1)
X Boolean example

© R. Rutenbar 2001, CMU 18-760, Fall 2001 42

Page 21
Algebraic Division
^ Example

f = ac + ad + bc + bd + e want f = d • q + r

Divisors (d) Quotient (q) Remainder (r) Factor?


ac+ad+bc+bd+e
a+b
c+d
a
b
c
d
e

© R. Rutenbar 2001, CMU 18-760, Fall 2001 43

Algebraic Division
^ Turns out there is a very nice algorithm for this
^ Inputs
X A Boolean expression A and a divisor (to divide by) D, represented as
sets of cubes (and each cube a set of literals)
^ Output
X Quotient q = A/D = cubes in quotient, or 0 if none
X Remainder r = cubes in remainder, or 0 if D was a factor
X ie, figures out q, r so that A = D•q+ r = D•(A/D) + r

^ Strategy
X Cubewise walk thru cubes in divisor D, trying to divide them into A
X ...being careful to track which cubes do divide into A

© R. Rutenbar 2001, CMU 18-760, Fall 2001 44

Page 22
Algebraic Division Algorithm
^ Algorithm bugfix
Example:
AlgebraicDivision( A, D) { /* divide D into A */ Cube xyzw contains
product term “yz”
for ( each cube d in divisor D ) {
let C = { cubes in A that contain this product term “d” };
if ( C is empty ) {
return ( quotient = 0, remainder = A);
}
let C = cross out literals of cube “d” in each cube of C;
if ( d is the first cube we have looked at in divisor D )
let Q = C;
bugfix
else Q = Q ∩ C;
} Example:
R = A - ( Q * B ); Suppose C = xyz + yzw +pqyz
return ( quotient = Q, remainder = R) and d = “xy”. Then crossing
} out all the “xy” parts yields
z + y + pq

© R. Rutenbar 2001, CMU 18-760, Fall 2001 45

Algebraic Division: Example


A/D: A = axc + axd + axe + bc + bd + e D = ax + b

D cube: ax D cube: b Easiest way manually is to make this


A cube C=… C=… table:
axc axc one row per cube in A,
one column per cube in D,
axd axd bottom row to evolve Quotient Q
axe axe and, when done, remember to get remainder
bc
bd
e
Q= Q=
Remainder R = A – Q*D

R = (axc + axd + axe + bc + bd + e) – [ (ax+b)*( )]

© R. Rutenbar 2001, CMU 18-760, Fall 2001 46

Page 23
Algebraic Division: Warning
^ Remember the basic model assumptions
X Cannot do any “boolean” simplification, only “algebraic”
^ So what?
X OK, suppose you have this

A = ab’c’ + ab + ac + bc B = ab + c’ want A / B
X You must transform it to something like this...

X Because you MUST treat the true and compl forms of var as different

© R. Rutenbar 2001, CMU 18-760, Fall 2001 47

One More Constraint: Redundant Cubes


^ To do A/D, we need function A not to have redundant cubes
X Redundant meaning formally minimal with respect to single-cube
containment, ie, “completely covered by other cubes in SOP cover”
ab
F = a + ab + bc is redundant c 00 01 11 10
D = a is the divisor; we want to do F/D
0

now: compute F / D, ie, F / a 1


use our algebraic division algorithm...

© R. Rutenbar 2001, CMU 18-760, Fall 2001 48

Page 24
Multilevel Synthesis Models: Where are We?
^ Given Boolean A, D, you can compute A = Q*D + R easily
X This is great—but its still not enough
X Real problem: I give you n functions F1, F2, … Fn, and want to find a
set of good common divisors di

F1 = ab + c + x F1 = d1 + x

factor d1 = ab+c
F2 = abx + cx + q F2 = (d1)x+q

F3 = ab + q F3 = ab+q

^ How to find?
X Case 1: divisors d that are just 1 cube (1 product term), eg, d = ab
X Case 2: “bigger” multiple-cube divisors, eg d = ab + c’d + e

© R. Rutenbar 2001, CMU 18-760, Fall 2001 49

New Idea: Kernels


^ Where to look for multiple cube divisors? Kernels
X Kernel of a Boolean expression f is:

A cube-free quotient of the expression f that results when you


divide f by a divisor that is itself a single cube (ie, 1 product term)
X Co-kernel of f is:

quotient q kernel if cube-free

divisor d expression f d = 1 cube expression f

remainder r remainder r

f = d•q + r f = d•q + r
© R. Rutenbar 2001, CMU 18-760, Fall 2001 50

Page 25
Kernels
^ Cube-free means...?
X Means you cannot factor out a single cube (product term) divisor that
leaves no remainder
X Technically -- has no one cube that is a factor of expression
X So, you divide expression f by a cube, look at result, if you can pull out a
cube -- any cube -- with 0 remainder, it’s not a kernel

Expression f f=d*q+r Cube-free?


a

a+b

ab + ac

abc + abd

ab + acd + bd

© R. Rutenbar 2001, CMU 18-760, Fall 2001 51

Kernels
^ Kernels of expression f denoted K(f)
X Look at example f = abc + abd + bcd
Divisor cube d f= d • q + r Is it a Kernel of f?
1 (1)(abc+abd+bcd)+0 No, has cube = b as factor
a
b
c
d
ab
ac
ad
bc
bd
cd
abc
...

© R. Rutenbar 2001, CMU 18-760, Fall 2001 52

Page 26
Kernels
^ What don’t we know yet?
X Why we should care about kernels
X If we should care, how to find them

^ Why you should care:


Theorem: Brayton & McMullen

Expressions f, g have a common multiple-cube divisor d


if and only if

there are kernels k1 ε K(f), k2 ε K(g)


such that d ε κ1 ∩ κ2
and | k1 ∩ κ2 | ≥ 2

© R. Rutenbar 2001, CMU 18-760, Fall 2001 53

Kernel Theorem
^ OK, let’s try that in English...
X Start with expressions f and g
X Look at sets of kernels of each K(f), K(g)
X Since k1 is a kernel of f, k2 is a kernel of g, we know that

f = cube1 • k1 + remainder1
g = cube2 • k2 + remainder2

X Remember: k1, k2 are cube-free, they have to be multi-term SOP


expressions lacking a common factorable cube

suppose k1 = (stuff1 + Xcube + Ycube + Zcube)


suppose k2 = (stuff2 + Xcube + Ycube + Zcube)

then k1 ∩ k2 = terms in both = (Xcube + Ycube + Zcube)

© R. Rutenbar 2001, CMU 18-760, Fall 2001 54

Page 27
Kernels
X So if we substitute back into f, g

f = cube1 • (stuff1 + Xcube + Ycube + Zcube) + remainder1


g = cube2 • (stuff2 + Xcube + Ycube + Zcube) + remainder2

X ...but we can rewrite this, pulling out k1 ∩ k2 = (X + Y + ... )

f = (Xcube + Ycube + Zcube )•cube1 + [cube1•stuff1 + remainder1]


g =(Xcube + Ycube + Zcube )•cube2 + [cube1•stuff2 + remainder2]

X ...but now it’s clear that k1 ∩ k2 = (X + Y + ... )


is a common, multiple-cube divisor! It’s a nice, big common factor!

© R. Rutenbar 2001, CMU 18-760, Fall 2001 55

Kernels
^ That was NOT a Proof!!
X ...it was just an example, but it illustrates what’s going on

^ Why is Brayton/McMullen so important?


X It’s a necessary and sufficient condition

You can find kernels in f, and in g


There is a common
such that intersection of kernels
multiple-cube divisor IFF
gives expression with >=2 cubes;
for your functions f, g
...that intersection is your divisor

X It’s hugely practical: the only place to look for multiple-cube factors is
in intersections of the kernels of your functions. There’s no place else.

© R. Rutenbar 2001, CMU 18-760, Fall 2001 56

Page 28
Kernels: Example
^ Consider this f, g

f = ae + be + cde + ab g = ad + ae + bd + be + bc

K(f) Kernel Co-kernel K(g) Kernel Co-kernel


a+b+cd e a+b d or e
b+e a d+e a or b
a+e b d+e+c b
ae+be+cde+ab 1 ad+ae+bd+be+bc 1

Intersecting these 2 kernels: (a+b+cd) * (a+b) = (a+b)

(a+b) is a divisor we can consider for both f, g

© R. Rutenbar 2001, CMU 18-760, Fall 2001 57

Kernels
^ So, they are quite useful, but how to get them?
X Another recursive algorithm (are we surprised...?)
X There are 2 more useful properties of kernels we need to see first…

^ Start with a function f and a kernel k1 in K(f)

f = cube1 • k1 + remainder1

^ First: a new, interesting question: what about K( k1) ??


X k1 is a perfectly nice Boolean expression, so its got its own kernels
X Do these kernels have anything interesting to say about K(f)...?

© R. Rutenbar 2001, CMU 18-760, Fall 2001 58

Page 29
Kernels
^ Look at K( k1 )
X Suppose k2 is a kernel in K( k1 ), then we know

k1 = cube2 • k2 + remainder2
X Substitute this in for k1 in original expression for f

f = cube1 • k1 + remainder1
=

X Neat trick: cube1•cube2 is itself just another single cube, so rewrite to


emphasize this fact:

© R. Rutenbar 2001, CMU 18-760, Fall 2001 59

Kernel Hierarchy
^ So , what does this say?
X k2 is itself a kernel of function f !
X There is a hierarchy of kernels, each inside the next, up the hierarchy

^ Terminology
X A kernel k in K(f) is a level 0 kernel if it has no kernels inside it except
itself
Z In English: only cube you can pull out is ‘1’ and get a cube-free
quotient as the result

X A kernel k in K(f) is a level i kernel if it contains only kernels


of level < i, and just one kernel at level i which is itself
Z In English: a level-1 kernel only has level-0 kernels inside it.
A level-2 kernel only has level-1 kernels in it, etc…

© R. Rutenbar 2001, CMU 18-760, Fall 2001 60

Page 30
Kernel Hierarchy
^ 2nd useful result [Brayton et al]

Co-kernels of a Boolean expression in SOP form correspond to intersections


of 2 or more of its cubes in this SOP form

X NOTE: Intersections here means specifically that we regard a cube as a


set of literals, and look at common subsets of literals
Z Note: this is not like “AND” for products.

X Example

ace + bce + de + g

ace ∩ bce = ce => ce is a potential co-kernel

ace ∩ bce ∩ de = e => e is a potential co-kernel

© R. Rutenbar 2001, CMU 18-760, Fall 2001 61

Kernel Hierarchy
^ How do we use these 2 results?
X Find the kernels recursively –
Z Whenever we find one, call kernel( ) routine on it, so find (if any)
lower level kernels inside
X Use algebraic division to divide function by potential co-kernels, to
generate recursive calls…
Z …but be smart: co-kernels are intersections of the cubes
Z ...if there’s at least 2 cubes, then look at the intersection C of the
literals in those cubes and use the result as our co-kernel cube

© R. Rutenbar 2001, CMU 18-760, Fall 2001 62

Page 31
Kernel Algorithm
^ Algorithm is then...

FindKernels( expression F) {
K = null;
for ( each variable x in F ) {
if ( there are at least 2 cubes in F that have variable x ) {
let S = { cubes in F that have variable x in them };
let c = cube that results from intersection of all cubes in S,
this will be the product of just those literals
that appear in each of these cubes in S;
K = K ∪ FindKernels( F / c ) ;
}
} algebraic division, but
K=K∪F; simpler since it always
return( K ) just divides by exactly
} 1 cube, a simple product term
Function F is always its
own kernel, with
trivial cokernel = 1
© R. Rutenbar 2001, CMU 18-760, Fall 2001 63

Kerneling Example
^ To start, divide f by each of the variables, and use to recurse
X We’re looking for co-kernels with ONE variable in them
X But—be smart, it cannot be a cokernel unless its in at least 2 cubes

f = ace + bce + de + g
a
b c d g
e
no recurs no recurs cubes wi c= no recurs cubes wi e= no recurs
only 1 only 1 only 1 only 1
cube wi a cube wi b cube wi d cube wi e
C =∩= C = ∩=

f/C = f/C =

recurse on: recurse on:

© R. Rutenbar 2001, CMU 18-760, Fall 2001 64

Page 32
Kernel Hierarchy, Example Revisited
^ With this algorithm, overall recursion tree looks like this

f = ace + bce + de + g
a
b c d g
e
cubes= cubes=
C= C=
f/C = f/C =

a b c d e g
cubes=
C=
f/C =

© R. Rutenbar 2001, CMU 18-760, Fall 2001 65

Kernel Hierarchy
^ With this algorithm...
X Can find all the kernels (and cokernels too)

^ Problem
X Will revisit same kernel multiple times

^ Solution
X Trick: remember which variables you already tried in the cokernels
X Problem: kernel you get for cokernel abc is same as for cba, but current
algorithm doesn’t know this and will find same kernel for both cubes
X A little extra book keeping solves this -- see De Michelli pp 367-369

© R. Rutenbar 2001, CMU 18-760, Fall 2001 66

Page 33
Using Kernels and Co-Kernels
^ What good are these?
^ Exactly the right component pieces for...
X Extraction of a single-cube divisor from multiple expressions
X Extraction of a multiple-cube divisor from multiple expressions

f
f = d•q1 + r1
d
g
g = d•q2 + r2

X When you want a single-cube divisor: go looking for co-kernels


X When you want a multiple-cube divisor: go looking for kernels

© R. Rutenbar 2001, CMU 18-760, Fall 2001 67

Multilevel Synthesis Models: Summary


^ Boolean network model
X Like a gate network, but each node in network is an SOP form
X Supports many operations to add, reduce, simplify nodes in network

^ Algebraic model & algebraic division


X Simplified Boolean functions to behave like polynomials of real numbers
X Lets you divide one Boolean function by another
X function f = (divisor d )• (quotient q) + remainder r

^ Kernels / Co-kernels of a function


X Kernel = cube-free quotient got by dividing by a single cube
X Intersections of kernels of 2 functions f, g are where all the interesting
multiple-cube common subexpressions are to be found
X Strong theorem here: Brayton-McMullen

^ Still have to figure out what the right common factors are to
have, given all this machinery...
© R. Rutenbar 2001, CMU 18-760, Fall 2001 68

Page 34

You might also like