CUDD Overview - University of Michigan

Download Report

Transcript CUDD Overview - University of Michigan

CUDD Overview
DoRon Motter
July 31, 2001
CUDD
• CU Decision Diagram Package
– Written by Fabio Somenzi at
Univ. Colorado
• Able to create/manipulate
BDDs, ZDDs, ADDs
Data Structures
• Nodes (DdNode *)
– Reference Count, T-Edge, EEdge, Variable Index, (value)
• Manager (DdManager *)
– Encapsulates initialization and
uniqueness of a DD
• Cache
– Memoizes results of recursive
computation
Uniqueness of Nodes
• Nodes are requested (only) via
Unique Table
• Hashes T-Edge, E-Edge, index
– DdNode * cuddUniqueInter( DdManager *
DD, int index, DdNode * T, DdNode * E )
– If a node already exists, return that
node.
– Otherwise create new node.
• Nodes only shared within the
same manager
Memory Management
• Each node has a reference count
• When a BDD is no longer needed,
it is recursively dereferenced
– N->ref--;
if(N->ref == 0) {
free(N);
Cudd_RecursiveDeref(DD, cuddT(N));
Cudd_RecursiveDeref(DD, cuddE(N));
}
Creating BDDs
• BDD Variables can be created
by DdNode * Cudd_bddIthVar(
DdManager * dd, int i )
• Retrieves the BDD variable with
index i if it already exists, or
creates a new BDD variable.
Manipulating BDDs
• DdNode * Cudd_bddIte(
DdManager * dd, DdNode * f,
DdNode * g, DdNode * h )
• Cudd_bddAnd, Cudd_bddOr,
Cudd_bddXor, Cudd_bddNand,
Cudd_bddXnor, …
f = x0'x1'x2'x3'.
• f = Cudd_ReadOne(manager);
Cudd_Ref(f);
for (i = 3; i >= 0; i--) {
var = Cudd_bddIthVar(manager,i);
tmp = Cudd_bddAnd(manager,
Cudd_Not(var),f);
Cudd_Ref(tmp);
Cudd_RecursiveDeref(manager,f);
f = tmp;
}
Reordering Variables
• Variable ordering in DD’s
influences size
• CUDD provides methods for
reordering variables
– void Cudd_AutodynEnable(
DdManager * unique,
Cudd_ReorderingType method )
• Sifting, Random, Converging
Sift, Symmetric Sift, Random
Pivot, None…
Debugging CUDD
• Most important topic!
• CUDD can print the DD to stdout.
– int Cudd_PrintDebug( DdManager * dd,
DdNode * f, int n, int pr )
– CUDD can also redirect stdout, etc.
• CUDD can dump DD’s to .dot, .blif
– Often DD’s are too large to be
processed by GraphViz
– Often DD’s are too large to be
dumped to stdout!
CUDD .dot output
Questions?