Breadcrumb

CUDD Tutorials

Learn it by examples

By David Kebo Houngninou

On this page, you will find some simple and practical examples of how to use CUDD.
The full documentation for CUDD documentation is available at: http://vlsi.colorado.edu/personal/fabio/CUDD/Note: All Credits go to the author of the package, Fabio Somenzi at the Dept. of Electrical and Computer Engineering, University of Colorado at Boulder

Table of contents

What is CUDD?

CUDD stands for Colorado University Decision Diagram. It is a package for the manipulation of Binary Decision Diagrams (BDDs), Algebraic Decision Diagrams (ADDs) and Zero-suppressed Binary Decision Diagrams (ZDDs).

Where to download CUDD?

The CUDD package is available via anonymous FTP from vlsi.colorado.edu. You can download the CUDD package from the server using an FTP client such as FileZilla or you can use the ftp command from the command line.

Option 3: You can download versions of CUDD directly here:

These directories contain the decision diagram package, and a few support libraries

How to install CUDD?

To build an application that uses the CUDD package, you should add:

#include "util.h"#include "cudd.h"

to your source files, and should link libcudd.a , libmtr.a , libst.a , and libutil.a to your executable. (All these libraries are part of the distribution.) Some platforms require specific compiler and linker flags. Refer to the Makefile in the top-level directory of the distribution.

pr can be set from 0 to any number, depending on the amount of information you want to display.
This function prints out useful statistics including the number of nodes, the number of leaves, and the number of minterms.

Another handy function is Cudd_PrintInfo()Cudd_PrintInfo() prints out statistics and settings for a CUDD manager:
You can get a lot of useful information from Cudd_PrintInfo(). The lines below show the statistics dumped to a file:

Visualize the BDD

So, you successfully created a BDD, now what?

After you create a BDD or an ADD of type DdNode, you can plot it as a .dot file using the Cudd_DumpDot() function. You should provide an output file pointer, the DD manager, the number of nodes and the node array pointer. The following functions show how to print a DD to a file.

Once you generate the .dot file, you can open it using the GraphViz tool.
Graphviz is open source graph visualization software. It works very well for representing structural information as diagrams of abstract graphs and networks. GraphViz is available for download here: www.graphviz.org/download.php.
Just locate the .dot file and open it with Graphviz.

Graph representation of the BDD

Download Tutorial 1

Tutorial 2: BDD of Boolean functions

Common manipulations of BDDs can be accomplished by calling operators on variables.
The CUDD package includes Boolean functions that can be used for BDD operations such as Cudd_Not, Cudd_bddAnd, Cudd_bddOr, Cudd_Xor, etc.

BDD for the Exclusive-OR Boolean function

The truth table for an Exclusive-OR

x1

x2

f

0

0

0

0

1

1

1

0

1

1

1

0

Logic gate for an Exclusive-OR

BDD for an Exclusive-OR

For the Exclusive-OR Boolean function, we use Cudd_bddXor
The following fragment of code illustrates how to build the BDD for the function f = x1 ⊕ x2

Download Tutorial 2

Tutorial 3: Variable reordering

The purpose of variable reordering is to reduce the size (number of nodes) of the BDD by optimizing the order of the variables. Finding an optimal order for a BDD is an NP-complete problem; therefore, several heuristic methods were developed for variable ordering. The CUDD package provides a rich set of dynamic reordering algorithms that you can apply to your BDD.

After initializing the BDD manager, we can make a call to a variable reordering method (Choose only one of the options below)

Tutorial 4: Additional functions

Algebraic Decision Diagram (ADD) for a fanout

The fanout of a logic gate output is the number of gate inputs it can feed. A fanout can also be modeled as a Boolean function

An Algebraic Decision Diagram (ADD) is a BDD with a set of constant values different than the set {0,1}.
Instead of using a BDD, we use an ADD to represent a fanout because the leaf nodes have values different than 0 and 1.

Algebraic Decision Diagram (ADD) for a crossover

A crossover represents two wires crossing each other. A crossover can also be modeled as a Boolean function

An Algebraic Decision Diagram (ADD) is a BDD with a set of constant values different than the set {0,1}.
Instead of using a BDD, we use an ADD to represent a crossover because the leaf nodes have values different than 0 and 1.