Title: ECE%20667%20Synthesis%20and%20Verification%20of%20Digital%20Systems
1ECE 667Synthesis and Verificationof Digital
Systems
- Binary Decision Diagrams
- (BDD)
2Outline
- Background
- Canonical representations
- BDDs
- Reduction rules
- Construction of BDDs
- Logic manipulation of BDDs
- Application to verification and SAT
- Reading
- read one of the BDD tutorials available on class
web site - Anderson, or
- Somenzi
3Common Representations
- Boolean functions ( f B ? B )
- Truth table, Karnaugh map
- SoP, PoS, ESoP
- Reed-Muller expansions (XOR-based)
- Decision diagrams (BDD, ZDD, etc.)
- Each minimal, canonical representation is
characterized by - Decomposition type
- Shannon, Davio, moment decomposition, Taylor
exp., etc. - Reduction rules
- Redundant nodes, isomorphic sub-graphs, etc.
- Composition method (Apply, compose rule)
- What they represent
- Boolean functions (f B ? B)
- Arithmetic functions (f B ? Int )
- Algebraic expressions (f Int ? Int )
4Binary Decision Diagrams (BDD)
- Based on recursive Shannon expansion
- f x fx x fx
- Compact data structure for Boolean logic
- can represents sets of objects (states) encoded
as Boolean functions - Canonical representation
- reduced ordered BDDs (ROBDD) are canonical
- essential for verification
5ROBDDs
- Directed acyclic graph (DAG)
- One root node, two terminal nodes 0, 1 (sinks)
- Each node has exactly two children, associated
with a variable - Shannon co-factoring tree, except reduced and
ordered (ROBDD) - Reduced
- any node with two identical children is removed
- two nodes with isomorphic BDDs are merged
- Ordered
- Co-factoring variables (splitting variables)
always follow the same order along all paths - xi1 lt xi2 lt xi3 lt lt xin
6BDD Example
f abacbcd
1
0
- Two different orderings, same function.
7ROBDD
- Ordered BDD (OBDD) Input variables are ordered -
each path from root to sink visits nodes with
labels (variables) in the same order.
not ordered
ordered a,c,b
- Reduced Ordered BDD (ROBDD) - reduction rules
- if the two children of a node are the same, the
node is eliminated - f v f v f
- if two nodes have isomorphic graphs, they are
replaced by one of them - These two rules make it so that each node
represents a distinct logic function.
8Efficient Implementation of BDDs
- BDDs is a compressed Shannon co-factoring tree
- f v fv v fv
- leafs are constants 0 and 1
- Three components make ROBDDs canonical (Proof
Bryant 1986) - unique nodes for constant 0 and 1
- identical order along each path
- hash table that ensures
- (node(fv) node(gv)) Ù (node(fv) node(gv)) Þ
node(f) node(g) - provides recursive argument that node(f) is
unique when using the unique hash-table
9Onset is Given by all Paths to 1
F bac abacbac BDD encodes all
paths to the 1 node
f
a
0
1
fa cbc
c
1
fa b
b
0
0
1
0
1
- Notes
- By tracing paths to the 1 node, we get a cover of
pairwise disjoint cubes. - The power of the BDD representation is that it
does not explicitly enumerate all paths rather
it represents paths by a graph whose size is
measured by the number of the nodes, and not
paths. - A DAG can represent an exponential number of
paths with a linear size (number of nodes) in
terms of its variables. - BDDs can be used to efficiently represent sets
- interpret elements of the onset as elements of
the set - f is called the characteristic function of that
set
10Implementation
- Variables are totally ordered
- If v lt w then v occurs higher up in the
ROBDD - Top variable of a function f is a variable
associated with its root node.
Reduction (redundant node) fa b, f?a b f
does not depend on a since fa f?a .
- Each node is written as a triple f (v,g,h),
where g fv and h f?v . - We read this triple as
- f if v then g else h ite (v,g,h) vgv h
11BDD Construction naïve way
12BDD Reduction Rules -1
- Eliminate redundant nodes
- (with both edges pointing to same node)
13BDD Reduction Rules -2
- Merge duplicate nodes (isomorphic subgraphs)
- Nodes must be unique
14BDD Construction contd
15BDD Construction the right way
f (a b) c
16Logic Manipulation using BDDs
- Complement F F
- (switch the terminal nodes)
- Restrict Fxb F(xb) where b const
- Restrict Fxb F(xb) where b const
- To restrict variable x to 1, reconnect all
incoming edges to nodes x to their 1-nodes - To restrict variable x to 0, reconnect all
incoming edges to nodes x to their 0-nodes
- To restrict variable x to 1, reconnect all
incoming edges to nodes x to their 1-nodes - To restrict variable x to 0, reconnect all
incoming edges to nodes x to their 0-nodes
17Restrict Operator ( f (c0, d1) )
f (ad)(bc)adbc
fc (ad)b
fcd (a1)b b
fcd b
Set c 0
Set d 1
Restricted BDD
Original BDD
18Useful BDD Operators Apply Operation
- Basic operator for efficient BDD manipulation
(structural) - Based on recursive Shannon expansion
- F ltopgt G x (Fx ltopgt Gx) x(Fx ltopgt
Gx) - where ltopgt binary operations OR, AND, XOR, etc
19APPLY Operator
- Apply F G, any Boolean operation
- (AND, OR, XOR, ?)
- Useful in constructing BDD for arbitrary Boolean
logic - Any logic operation can be expressed using Apply
(ITE) - Efficient algorithms, work directly on BDD graphs
20Apply Operation (contd)
- Apply F G
- where stands for any Boolean operator (AND,
OR, XOR, etc)
- Apply F G
- where stands for any Boolean operator (AND,
OR, XOR, etc)
?
- Any logic operation can be expressed using only
Restrict and Apply - Efficient algorithms, work directly on BDDs
- Apply can be used to construct a BDD bottom-up
- From primary inputs, through internal logic
gates, to output
21Apply Operation - AND
F ? G x (Fx ? Gx) x(Fx ? Gx)
22Apply Operation - OR
F G x (Fx Gx) x(Fx Gx)
23Application to Verification
- Equivalence Checking of combinational circuits
- Canonicity property of BDDs
- if F and G are equivalent, their BDDs are
identical (for the same ordering of variables)
24Application to SAT
- Functional test generation
- SAT, Boolean satisfiability analysis
- to test for H 1 (0), find a path in the BDD to
terminal 1 (0) - the path, expressed in function variables, gives
a satisfying solution (test vector)
25Efficient Implementation of BDDs
- Unique Table key (v,G,H), where F
ITE(v,G,H). - avoids duplication of existing nodes
- Hash-Table hash-function(key) value
- identical to the use of a hash-table in
AND/INVERTER circuits
hash value of key
collision chain
- Computed Table key (F,G,H)
- avoids re-computation of existing results
hash value of key
No collision chain
26Unique Table - Hash Table
hash index of key
collision chain
- Before a node (v, g, h ) is added to BDD data
base, it is looked up in the unique-table. If
it is there, then existing pointer to node is
used to represent the logic function. Otherwise,
a new node is added to the unique-table and the
new pointer returned. - Thus a strong canonical form is maintained. The
node for f (v, g, h ) exists iff(v, g, h ) is
in the unique-table. There is only one pointer
for (v, g, h ) and that is the address to the
unique-table entry. - Unique-table allows single multi-rooted DAG to
represent all users functions
27Computed Table
- Keep a record of (F, G, H ) triplets already
computed by the ITE operator - software cache ( cache table)
- simply hash-table without collision chain (lossy
cache)
28Extension - Complement Edges
- Combine inverted functions by using complemented
edge - similar to circuit case
- reduces memory requirements
- BUT MORE IMPORTANT
- makes some operations more efficient (NOT, ITE)
29Extension - Complement Edges
- To maintain strong canonical form, need to
resolve 4 equivalences
Solution Always choose one on left, i.e. the
then leg must have no complement edge.