Binary Decision Diagrams (BDD)

Similar documents
Binary Decision Diagrams and Symbolic Model Checking

Motivation. CS389L: Automated Logical Reasoning. Lecture 5: Binary Decision Diagrams. Historical Context. Binary Decision Trees

Unit 4: Formal Verification

Symbolic Boolean Manipulation with Ordered Binary Decision Diagrams

EECS 219C: Formal Methods Binary Decision Diagrams (BDDs) Sanjit A. Seshia EECS, UC Berkeley

Model Checking I Binary Decision Diagrams

Behavior models and verification Lecture 6

1/28/2013. Synthesis. The Y-diagram Revisited. Structural Behavioral. More abstract designs Physical. CAD for VLSI 2

Binary Decision Diagrams (BDDs) Pingqiang Zhou ShanghaiTech University

Boolean Representations and Combinatorial Equivalence

L4: Binary Decision Diagrams. Reading material

ECE 5775 (Fall 17) High-Level Digital Design Automation. Binary Decision Diagrams Static Timing Analysis

Binary Decision Diagrams

CS357 Lecture: BDD basics. David Dill

Synthesis 1. 1 Figures in this chapter taken from S. H. Gerez, Algorithms for VLSI Design Automation, Wiley, Typeset by FoilTEX 1

Formal Verification. Lecture 7: Introduction to Binary Decision Diagrams (BDDs)

Symbolic Manipulation of Boolean Functions Using a Graphical Representation. Abstract

Symbolic Model Checking

Binary Decision Diagrams

Binary Decision Diagrams and Beyond: Enabling Technologies for Formal Verification

Lecture Notes on Binary Decision Diagrams

ABC basics (compilation from different articles)

LOGIC SYNTHESIS AND VERIFICATION ALGORITHMS. Gary D. Hachtel University of Colorado. Fabio Somenzi University of Colorado.

Logic Synthesis & Optimization Lectures 4, 5 Boolean Algebra - Basics

Advanced VLSI Design Prof. Virendra K. Singh Department of Electrical Engineering Indian Institute of Technology Bombay

A Relational View of Subgraph Isomorphism

Binary Decision Diagram with Minimum Expected Path Length

VLSI Logic Test, Validation and Verification Lecture 7 Properties & Applications of Binary Decision Diagrams

DISCRETE FUNCTION REPRESENTATIONS UTILIZING DECISION DIAGRAMS AND SPECTRAL TECHNIQUES

Research Collection. Formal background and algorithms. Other Conference Item. ETH Library. Author(s): Biere, Armin. Publication Date: 2001

Lecture1: Symbolic Model Checking with BDDs. Edmund M. Clarke, Jr. Computer Science Department Carnegie Mellon University Pittsburgh, PA 15213

Logic Synthesis and Verification

On the Relation between SAT and BDDs for Equivalence Checking

VLSI System Design Part II : Logic Synthesis (1) Oct Feb.2007

Int. J. Advanced Networking and Applications 1430 Volume:03 Issue:06 Pages: (2012) ISSN :

An Introduction to Zero-Suppressed Binary Decision Diagrams

Graph-Based Algorithms for Boolean Function Manipulation 12. Abstract

Chapter 8: Data Abstractions

Novel Applications of a Compact Binary Decision Diagram Library to Important Industrial Problems

ON AN OPTIMIZATION TECHNIQUE USING BINARY DECISION DIAGRAM

2009 Haskell January Test Binary Decision Diagrams

ACKNOWLEDGEMENTS. my thesis committee and for their input on this document. effort. This research was funded under NSF contract MIP

Chain Reduction for Binary and Zero-Suppressed Decision Diagrams arxiv: v1 [cs.ds] 17 Oct 2017

Binary Decision Diagrams

An Introduction to Zero-Suppressed Binary Decision Diagrams

Binary decision diagram to design balanced secure logic styles

Giovanni De Micheli. Integrated Systems Centre EPF Lausanne

Normal Forms for Boolean Expressions

Synthesis of 2-level Logic Heuristic Method. Two Approaches

A purely functional implementation of ROBDDs in Haskell

Implementing a Multiple-Valued Decision Diagram Package

Compiling Bayesian Networks by Symbolic Probability Calculation Based on Zero-suppressed BDDs

Network Reliability Computation by using Different Binary Decision Diagrams

Combinatorial Algorithms. Unate Covering Binate Covering Graph Coloring Maximum Clique

IMPLEMENTATION OF HYBRID EVOLUTIONARY ALGORITHM FOR BDD OPTIMIZATION BY FINDING OPTIMUM VARIABLE ORDERING

Set Manipulation with Boolean Functional Vectors for Symbolic Reachability Analysis

A Firewall Application Using Binary Decision Diagram

Algorithm Design (8) Graph Algorithms 1/2

1 Model checking and equivalence checking

K-terminal Network Reliability Evaluation Using Binary Decision Diagram

On Proof Systems Behind Efficient SAT Solvers. DoRon B. Motter and Igor L. Markov University of Michigan, Ann Arbor

ECE260B CSE241A Winter Logic Synthesis

Symbolic Boolean Manipulation with Ordered Binary-Decision Kliagrams

Advanced Digital Logic Design EECS 303

Graph-Based Algorithms for Boolean Function Manipulation

Binary recursion. Unate functions. If a cover C(f) is unate in xj, x, then f is unate in xj. x

CUDD Colorado University Decision Diagram Package

Beyond the Combinatorial Limit in Depth Minimization for LUT-Based FPGA Designs

COMP3121/3821/9101/ s1 Assignment 1

Cofactoring-Based Upper Bound Computation for Covering Problems

TitleArithmetic Boolean Expression Manip. Citation Formal Methods in System Design, 10

Discrete Optimization with Decision Diagrams

Symbolic Representations and Analysis of Large Probabilistic Systems

BoolTool: A Tool for Manipulation of Boolean Functions

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

Clustering Using Graph Connectivity

Multi-valued Logic Synthesis. Robert K Brayton Sunil P Khatri University of California Berkeley, CA brayton,

A Logically Complete Reasoning Maintenance System Based on a Logical Constraint Solver

Graphs & Digraphs Tuesday, November 06, 2007

Retiming Arithmetic Datapaths using Timed Taylor Expansion Diagrams

Reference Sheet for CO142.2 Discrete Mathematics II

OBDD-Based Evaluation of k-terminal Network Reliability

Subset sum problem and dynamic programming

Biconditional Binary Decision Diagrams: A Novel Canonical Logic Representation Form

A Satisfiability Procedure for Quantified Boolean Formulae

What graphs can be efficiently represented by BDDs?

Tagged BDDs: Combining Reduction Rules from Different Decision Diagram Types

CS 267: Automated Verification. Lecture 6: Binary Decision Diagrams. Instructor: Tevfik Bultan

A New Algorithm to Create Prime Irredundant Boolean Expressions

Symbolic Representation with Ordered Function Templates

Practice Problems for the Final

Solving 3-SAT. Radboud University Nijmegen. Bachelor Thesis. Supervisors: Henk Barendregt Alexandra Silva. Author: Peter Maandag s

On the Verification of Sequential Equivalence

Application of Binary Decision Diagram in digital circuit analysis.

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

Chapter 9 Graph Algorithms

L3: Representations of functions

An Algorithm for the Construction of Decision Diagram by Eliminating, Merging and Rearranging the Input Cube Set

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Overview. Discrete Event Systems - Verification of Finite Automata. What can finite automata be used for? What can finite automata be used for?

Transcription:

Binary Decision Diagrams (BDD)

Contents Motivation for Decision diagrams Binary Decision Diagrams ROBDD Effect of Variable Ordering on BDD size BDD operations Encoding state machines Reachability Analysis using OBDDs Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 2

Decision Structure Truth Table Decision Tree x f x Vertex represents decision Follow green (dashed) line for value Follow red (solid) line for value Function value determined by leaf value. Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 3

Binary Decision Diagram DAG representation of Boolean functions Operations on Boolean functions can be implemented as graph algorithms on BDDs Tasks in many problem domains can be expressed entirely in terms of BDDs BDDs have been useful in solving problems that would not be possible by more traditional techniques. Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 4

Binary Decision Diagram (BDD) Each non-terminal vertex v is labeled by a variable var(v) and has arcs directed toward two children lo(v) (dotted line) corresponding to the case where the variable is assigned hi(v) (solid line) where the variable is assigned Each terminal vertex is labeled as or For a given assignment to the variables, the value of the function is determined by tracing the path form root to a terminal vertex, following the branches appropriately Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 5

BDDs and Shannon s Expansion Shannon s Expansion: f = xf x + x f x BDD represents recursive application of Shannon s expansion f x f x f x Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 6

Ordered Binary Decision Diagram (OBDD) Assign arbitrary total ordering to variables e.g. x < < Variables must appear in ascending order along all paths OK x x x Not OK x Properties No conflicting variable assignments along path Simplifies manipulation Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 7

Reduction Rule # Eliminate all but one terminal vertex with a given label and redirect all arcs into the eliminated vertices to the remaining Merge equivalent leaves x x Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 8

Reduction Rule #2 Merge isomorphic nodes If non-terminal vertices u and v have var(u) = var(v), lo(u) = lo(v) and hi(u) = hi(v), eliminate one of them and redirect all incoming arcs to the other x x x x x x y z y z y z x x Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 9

Reduction Rule #3 If non-terminal vertex v has lo(v) = hi(v), eliminate v and redirect all incoming arcs to lo(v) Eliminate Redundant Tests x y y x x Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur

Reduced OBDD (ROBDD) Initial Graph Reduced Graph x x (x + ) Canonical representation of Boolean function For the same variable ordering, two functions equivalent if and only if graphs isomorphic Can be tested in linear time Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur

Some Example Functions Constants Unique unsatisfiable function Unique tautology Typical Function Variable x Odd Parity Treat variable as function x (x ) x 4 x No vertex labeled independent of Linear representation Many subgraphs shared x 4 x 4 x 4 Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 2

Circuit Functions Functions All outputs of 4-bit adder S 3 Cout Functions of data inputs a 3 a 3 S 2 b 3 b 3 b 3 b 3 A B A D D Cout S S a 2 b 2 b 2 a 2 b 2 b 2 a 2 b 2 b 2 a a a Shared Representation Graph with multiple roots 3 nodes for 4-bit adder 57 nodes for 64-bit adder S b b b b b b a a a b b Linear Growth Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 3

Effect of Variable Ordering on ROBDD Size Good Ordering ( a b ) ( a2 b2 ) ( a3 b3 ) Bad Ordering (a < b < a 2 < b 2 < a 3 < b 3 ) (a < a 2 < a 3 < b < b 2 < b 3 ) a a b a 2 a 2 a 2 a 3 a 3 a 3 a 3 b 2 b b b b a 3 b 2 b 2 b 3 b 3 Linear Growth Exponential Growth Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 4

Analysis of Ordering Example ( a b ) ( a2 b2 ) ( a3 b3 ) a a b a 2 a 2 a 2 K = 2 a 3 a 3 a 3 a 3 K = n b 2 b b b b a 3 b 2 b 2 b 3 b 3 Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 5

Selecting a good Variable Ordering Intractable Problem Even when problem represented as OBDD A good variable ordering should use Local computability Ordering based on power to control output Application-Based Heuristics Exploit characteristics of application Ordering for functions of combinational circuit Traverse circuit graph depth-first from outputs to inputs Assign variables to primary inputs in order encountered Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 6

Dynamic Variable Ordering Rudell, ICCAD 93 Concept Variable ordering changes as computation progresses Typical application involves long series of BDD operations Proceeds in background, invisible to user Implementation When approach memory limit, attempt to reduce Garbage collect unneeded nodes Attempt to find better order for variables Simple, greedy reordering heuristics Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 7

Dynamic Reordering By Sifting Choose candidate variable Try all positions in ordering Repeatedly swap with adjacent variable Move to best position found Best Choices a a a a b a 2 a 2 a 2 a 2 a 2 a 2 b a a 3 a 3 a 3 a 3 a 3 a 3 a 3 a 3 b b a 2 a 2 b 2 b 2 b 2 b 2 b 2 b 2 b 2 b 2 a 3 a 3 a 3 a 3 a 3 a 3 b b b 3 b 3 b 2 b 2 b 2 b 2 b 2 b 2 b 3 b b 3 b 3 b 3 Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 8

Sample Function Classes Function Class Best Worst Ordering Sensitivity ALU (Add/Sub) linear exponential High Symmetric linear quadratic None Multiplication exponential exponential Low General Experience Many tasks have reasonable OBDD representations Algorithms remain practical for up to, node OBDDs Heuristic ordering methods generally satisfactory Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 9

BDD Operations Strategy Represent data as set of OBDDs Identical variable orderings Express solution method as sequence of symbolic operations Implement each operation by OBDD manipulation Algorithmic Properties Arguments are OBDDs with identical variable orderings. Result is OBDD with same ordering. Closure Property Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 2

The APPLY Operation Given argument functions f and g, and a binary operator <op>, APPLY returns the function f <op> g Works by traversing the argument graphs depth first Algebraic operations commute with the Shannon expansion for any variable x f <op> g = x (f x= <op> g x= ) + x ((f x= <op> g x= ) Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 2

The Apply Algorithm Consider a function f represented by a BDD with root vertex r f The restriction of f with respect to a variable x such that x var(r f ) can be computed as : f x = b = r f, x < var(r f ) = lo(r f ), x = var (r f ) and b = = hi(r f ), x = var (r f ) and b = The algorithm for APPLY utilizes the above restriction definition. Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 22

The Apply Algorithm Each evaluation step is identified by a vertex from each of the argument graphs Suppose functions f and g are represented by root vertices r f and r g If r f and r g are both terminal vertices, terminate and return an appropriately labeled terminal vertex e.g. (A 4, B 3 ) and (A 5, B 4 ) Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 23

The Apply algorithm Let x be the splitting variable ( x= min(var(r f ), var(r g )) BDDs for (f x= <op> g x= ) and (f x= <op> g x= ) are computed by recursively evaluating the restrictions of f and g for value and for value Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 24

Example A 2 A 3 A a b c d A 6 A 4 A 5 B 2 a B c d B 5 B 3 B 4 Recursive Calls A,B A 2,B 2 A 6,B 2 A 6,B 5 A 3,B 2 A 5,B 2 A 3,B 4 A 4,B 3 A 5,B 4 Initial evaluation with vertices A, B causes recursive evaluations with vertices A 2, B 2 and A 6, B 5 Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 25

Apply operation Reaching a terminal with a dominant value (e.g for OR, for AND) terminates recursion and returns an appropriately labeled terminal (A 5, B 2 and A 3, B 4 ) Avoid multiple recursive calls on the same pair of arguments by a hash table (A 3, B 2 and A 5, B 2 ) Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 26

Apply operation Each evaluation step returns a vertex in the generated graph Apply reduction before merging the result Complexity of operation : O(m f * m g ) where m f and m g represent the number of vertices in the BDDs for f and g respectively Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 27

Example Recursive Calls Without Reduction With Reduction A,B a a C 6 A 2,B 2 A 6,B 2 A 6,B 5 b c c C 5 b C 4 c A 3,B 2 A 5,B 2 A 3,B 4 d C 3 d A 4,B 3 A 5,B 4 C C 2 Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 28

Restrict Operation Concept Effect of setting function argument x i to constant k ( or ). Also called Cofactor operation x F x equivalent to F [x = ] F x equivalent to F [x = ] k x i x i + F F [x i =k] x n Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 29

Restriction Algorithm Implementation Depth-first traversal Redirect any arc into vertex v having var(v) = x to point to hi(v) for x = and lo(v) for x = Complexity linear in argument graph size Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 3

Restriction Execution Example Argument F a b c d Restriction F[b=] a c d Reduced Result d c Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 3

Derived Operations Express as combination of Apply and Restrict Preserve closure property Result is an OBDD with the right variable ordering Polynomial complexity Although can sometimes improve with special implementations Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 32

Variable Quantification x x x i x i + F x i F x i F x i + x n x n x x i F x i + x n Eliminate dependency on some argument through quantification Combine with AND for universal quantification. Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 33

Digital Applications of BDDs Verification Combinational equivalence (UCB, Fujitsu, Synopsys, ) FSM equivalence (Bull, UCB, MCC,Colorado, Torino, ) Symbolic Simulation (CMU, Utah) Symbolic Model Checking (CMU, Bull, Motorola, ) Synthesis Don t care set representation (UCB, Fujitsu, ) State minimization (UCB) Sum-of-Products minimization (UCB, Synopsys, NTT) Test False path identification (TI) Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 34

Some Popular BDD packages CUDD (Colorado University Decision Diagram) TUD BDD package (TUDD) BUDDY CMU BDD Informations about the above BDD packages and some more details can be found at http://www.bdd-portal.org/ Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 35

What s good about OBDDs? Powerful Operations Creating, manipulating, testing Each step polynomial complexity Graceful degradation Maintain closure property Each operation produces form suitable for further operations Generally Stay Small Enough Especially for digital circuit applications Given good choice of variable ordering Weak Competition Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 36

What s not good about OBDDs? Doesn t Solve All Problems Can t do much with multipliers Some problems just too big Weak for search problems Must be Careful Choose good variable ordering Some operations too hard Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 37

Zero Suppressed BDD s - ZBDD s ZBDD s were invented by Minato to efficiently represent sparse sets. They have turned out to be extremely useful in implicit methods for representing primes (which usually are a sparse subset of all cubes). Different reduction rules. Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 38

Zero Suppressed BDD s - ZBDD s ZBDD Reduction Rule:: eliminate all nodes where the then node points to. Connect incoming edges to else node For ZBDD, equivalent nodes can be shared as in case of BDDs. ZBDD: Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 39

MTBDD- Multiterminal BDD x + 2x + 4 x x x x x x 2 3 4 5 6 7 Evaluating a MTBDD for a given variable assignment is similar to that in case of BDD Very inefficient for representing functions yielding values over a large range Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 4

EVBDD Edge value BDD EVBDDs can be used when the number of possible function values are too high for MTBDDs. g Evaluating a EVBDD involves tracing a path determined by the variable assignment, summing the weights and the terminal node value x 4 2 x Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 4

*BMD( Binary Moment Diagrams ) Features Used for Word level simulation/verification Canonical Based on linear decomposition of a function Functional Decomposition : f = (-x) f ~x + (x) f x = f ~x + x ( f x - f ~x ) = f ~x + x ( f. x ) where f. x is the linear moment w.r.t. x Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 42

Representing *BMDs Graph : Example f = (-x)(-x2)(8)+(-x)(x2)(-2) +(x)(-x2)() + (x)(x2)(-6) = 8-2(x2) + 2(x) + 4(x*x2) x x2 f 8-2 -6 Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 43

Edge Weights ( *BMDs ) Weights combine multiplicatively along path from root to leaf Rules : weights of 2 branches relatively prime weight allowed only for terminal vertices if one edge has weight, the other has weight 2 y x y 2 x y y 2 4 8-2 BMD -5 2 * BMD Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 44

References Graph Based Algorithms for Boolean Fucntion Manipulation, Randal E. Bryant, IEEE Transactions on Computers, Vol C-35, August 986, pp. 677-69. Symbolic Boolean Manipulation with Ordered Binary Decision Diagrams, Randal E. Bryant, ACM Computing Surveys, 24(3), 992, pp. 293-38 Pallab Dasgupta, Dept. of Computer Sc & Engg, IIT Kharagpur 45