L4: Binary Decision Diagrams. Reading material

Similar documents
Binary Decision Diagrams (BDDs) Pingqiang Zhou ShanghaiTech University

Unit 4: Formal Verification

Binary Decision Diagrams (BDD)

Behavior models and verification Lecture 6

Model Checking I Binary Decision Diagrams

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

Solution 3: (a) True. Proof.

1 Model checking and equivalence checking

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

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

Boolean Representations and Combinatorial Equivalence

Binary Decision Diagrams

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

Binary Decision Diagrams

Binary Decision Diagrams and Symbolic Model Checking

CUDD Colorado University Decision Diagram Package

CS357 Lecture: BDD basics. David Dill

A Firewall Application Using Binary Decision Diagram

A Relational View of Subgraph Isomorphism

An Introduction to Zero-Suppressed Binary Decision Diagrams

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

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

An Introduction to Zero-Suppressed Binary Decision Diagrams

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

Graph-Based Algorithms for Boolean Function Manipulation

ABC basics (compilation from different articles)

Graph-Based Algorithms for Boolean Function Manipulation 12. Abstract

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

A New Optimal Approach for evaluating the size of BDD for calculating the Reliability of a CCN

Network Reliability Computation by using Different Binary Decision Diagrams

Chapter 8: Data Abstractions

Metodologie di progetto HW La verifica di circuiti digitali. Versione del 28/04/08

Name Class Date. Quadratic Functions and Transformations

Chapter 6: Multilevel Combinational Circuits. Name: Lương Văn Minh No. :

K-terminal Network Reliability Evaluation Using Binary Decision Diagram

L3: Representations of functions

What graphs can be efficiently represented by BDDs?

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

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

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

Binary Decision Diagrams

y ax bx c y a x h 2 Math 11 Pre-Cal Quadratics Review

Indexing and Searching

The 17th International Conference on Safety, Reliability and Security (SAFECOMP 98) LNCS, Heidelberg, 1998

SDD Advanced-User Manual Version 1.1

Formal Verification Methods 2: Symbolic Simulation

Implementing a Multiple-Valued Decision Diagram Package

Disclaimer. CS130A Winter 2008 Final Review. Information on the final exam. Suggestions

VLSI System Testing. Introduction

Logic Synthesis and Verification

Symbolic Model Checking

Binary Decision Diagram with Minimum Expected Path Length

Lecture Notes on Binary Decision Diagrams

CSE 373 Autumn 2012: Midterm #2 (closed book, closed notes, NO calculators allowed)

2009 Haskell January Test Binary Decision Diagrams

Symbolic Representations and Analysis of Large Probabilistic Systems

Symbolic Boolean Manipulation with Ordered Binary Decision Diagrams

Symbolic Representation with Ordered Function Templates

DFA: Automata where the next state is uniquely given by the current state and the current input character.

SOLUTION TO FINAL EXAM PROBLEMS

Metodologie di progetto HW La verifica di circuiti digitali

CS301 - Data Structures Glossary By

Hot X: Algebra Exposed

Graphs & Digraphs Tuesday, November 06, 2007

4.1.2 Merge Sort Sorting Lower Bound Counting Sort Sorting in Practice Solving Problems by Sorting...

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

A Novel Approach of Area-Efficient FIR Filter Design Using Distributed Arithmetic with Decomposed LUT

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

Recent Results from Analyzing the Performance of Heuristic Search

ON AN OPTIMIZATION TECHNIQUE USING BINARY DECISION DIAGRAM

Symbol Tables. ASU Textbook Chapter 7.6, 6.5 and 6.3. Tsan-sheng Hsu.

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

- Introduction P. Danziger. Linear Algebra. Algebra Manipulation, Solution or Transformation

Solving Boolean Equations with BDDs and Clause Forms. Gert Smolka

MAT 7003 : Mathematical Foundations. (for Software Engineering) J Paul Gibson, A207.

Minimization of Multiple-Valued Functions in Post Algebra

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science. EECS150, Spring 2010

Disjoint Support Decompositions

DISCRETE FUNCTION REPRESENTATIONS UTILIZING DECISION DIAGRAMS AND SPECTRAL TECHNIQUES

On the Relation between SAT and BDDs for Equivalence Checking

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

Lecture Notes on Dynamic Programming

Australian Journal of Basic and Applied Sciences. Timing Analysis on Min-term Based Tabular Method for BDD Manipulations

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

Dualization of Boolean functions Using Ternary Decision Diagrams

Biconditional Binary Decision Diagrams: A Novel Canonical Logic Representation Form

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

SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY

Binary Decision Diagrams and Beyond: Enabling Technologies for Formal Verification

BDDC v2 A basic bdd-based logical calculator

Binary decision diagram to design balanced secure logic styles

Solutions to Exam Data structures (X and NV)

Sorting in Space and Network Distance Browsing

Algorithm Design (8) Graph Algorithms 1/2

Representations of Terms Representations of Boolean Networks

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Generating All Solutions of Minesweeper Problem Using Degree Constrained Subgraph Model

Computer Science Foundation Exam

BDDC v2 A basic bdd-based logical calculator

Giovanni De Micheli. Integrated Systems Centre EPF Lausanne

Transcription:

L4: Binary Decision Diagrams de Micheli pp. 75-85 Reading material R. Bryant, Graph-ased algorithms for Boolean function manipulation, IEEE Transactions on computers, C-35, No 8, August 1986; can e downloaded from http://www.cs.cmu.edu/~ryant/ CUDD-package manual http://vlsi.colorado.edu/~faio/ p. 2 - Advanced Logic Design L4 - Elena Durova

Binary Decision Diagram Graph-ased representation for Boolean functions f: B n B m directed acyclic graph one root node, terminal nodes 0, 1 each non-terminal node has two children and is laeled y a variale a f 0 0 0 1 1 1 1 0 p. 3 - Advanced Logic Design L4 - Elena Durova a 1 0 Binary Decision Diagram Mathematical foundation for BDDs is the Shannon decomposition theorem: where f(x 1,x 2,...,x n ) = x' 1 f x1 =0 + x 1 f x 1 =1 f x1 =0 := f(0,x 2,...,x n ), f x 1 =1 := f(1,x 2,...,x n ) are sufunctions of f, called co-factors p. 4 - Advanced Logic Design L4 - Elena Durova

Binary Decision Diagram Let v e a node of a ROBDD laeled y some variale x i, then low(v) is the sughraph pointed y the edge corresponding to x i = 0 this sugraph represents f x1 =0 high(v) is the sughraph pointed y the edge corresponding to x i = 1 this sugraph represents f x1 =1 index(v) = i p. 5 - Advanced Logic Design L4 - Elena Durova Binary Decision Diagram p. 6 - Advanced Logic Design L4 - Elena Durova

Ordering rules no variale appears more than once along a path in all paths variales appear in the same order a ordered order = a,c, a not ordered c c c c p. 7 - Advanced Logic Design L4 - Elena Durova Reduction rules 1) no vertex v with low(v) = high(v) 2) no distinct vertices v and u such that the sugraphs rooted y v and u are isomorphic these two rules guarantee that each node represents a distinct logic function p. 8 - Advanced Logic Design L4 - Elena Durova

Reduced Ordered Binary Decision Diagram (ROBDD) a f 0 0 0 1 1 1 1 0 a canonical representation (fixed ordering) easy manipulation algorithms compact for many practical functions p. 9 - Advanced Logic Design L4 - Elena Durova Properties of ROBDD function is given y tracing all the paths to 1 terminal node: f = +a c = a +a c +a c f a = c +c a f 0 1 c 1 0 0 1 f a = cues given y paths are pair-wise disjoint p. 10 - Advanced Logic Design L4 - Elena Durova

Advantages of ROBDDs The numer of cues we represent might e exponential But the size of a ROBDD is measured y its nodes, not y its paths a ROBDD can represent an exponential numer of paths with a linear numer of nodes p. 11 - Advanced Logic Design L4 - Elena Durova Prolems with ROBDDs Some functions have exponential-size ROBDDs multipliers, HWB size of a ROBDD depends critically on variale ordering adders - exponential for ad orderings, linear for good orderings finding a est variale ordering requires exponential time p. 12 - Advanced Logic Design L4 - Elena Durova

Example root node a f = a+a c+c d a c+d c+d c c c c+d c d+ d d d Two different orderings, same function p. 13 - Advanced Logic Design L4 - Elena Durova Algorithms for BDD manipulation Basic algorithms for BDD manipulation: Reduce : BDD G reduced to canonical form, complexity O( G log G ) Apply : performes f 1 f 2 for some operation, complexity O( G 1 G 2 ) Compose : sustitues f 2 in a variale x of f 1, complexity O( G 1 2 G 2 ) Satisfy-one: checkes whether f(x 1,.., x n )=1 for some assignment x 1,.., x n, O(n) p. 14 - Advanced Logic Design L4 - Elena Durova

A simple reduction algorithm: 1) Merge all identical terminal nodes and appropriately redirect their incoming edges 2) Proceeding from ottom to top: if a node v is found such that low(v) = high(v), remove v and redirect its incoming edges to low(v) (reduction rule 1) if two nodes v and u with index(v) = index(u) are found such that low(v) = low(u) and high(v) = high(u), remove v and redirect its incoming edges to u (reduction rule 2) p. 15 - Advanced Logic Design L4 - Elena Durova Apply The procedure Apply provides the asic method for creating the BDD representation of a function given y a Boolean expression It takes BDDs for functions f 1, f 2 and a inary operation, and produces a BDD for the function f 1 f 2 defined as [f 1 f 2 ] (x 1,...,x n )= f 1 (x 1,...,x n ) f 2 (x 1,...,x n ) p. 16 - Advanced Logic Design L4 - Elena Durova

Apply Apply can e used to complement a function (compute f 1) to compute intersection ( = ) to compute union ( = +) Note: in cue representations we needed 3 different procedures for that p. 17 - Advanced Logic Design L4 - Elena Durova ITE operator If-then-else: ite(f,g,h) equals to g when f is 1 and equals to h otherwise: ite(f,g,h) = f g + f' h Each node is written as a triple: f = (v,g,h) where g = f v and h = f v, where v is the root node of f We read this triple as: f = if v then g else h = ite (v,g,h) = vg+v h v f 1 0 mux v f g h h g p. 18 - Advanced Logic Design L4 - Elena Durova

ITE operator Ite can e used to implement any inary operation, like AND, OR f g = ite(f,g,0) f + g = ite(f,1,g) Ite can e implemented y extending Apply procedure to ternary operations p. 19 - Advanced Logic Design L4 - Elena Durova ITE operator Tale Suset Expression Equivalent Form 0000 0 0 0 0001 AND(f, g) fg ite(f, g, 0) 0010 f > g f g ite(f, g, 0) 0011 f f f 0100 f < g fg ite(f, 0, g) 0101 g g g 0110 XOR(f, g) f g ite(f, g, g) 0111 OR(f, g) f + g ite(f, 1, g) 1000 NOR(f, g) f + g ite(f, 0, g) 1001 XNOR(f, g) f g ite(f, g, g) 1010 NOT(g) g ite(g, 0, 1) 1011 f g f + g ite(f, 1, g) 1100 NOT(f) f ite(f, 0, 1) 1101 f g f + g ite(f, g, 1) 1110 NAND(f, g) fg ite(f, g, 1) 1111 1 1 1 p. 20 - Advanced Logic Design L4 - Elena Durova

Variale ordering prolem Exact algorithms are intractale Heuristics are used: static: use properties to group the variales together (e.g. keep symmetric variale together) dynamic sifting: use the property that exchanging adjacent variales has only a local effect on the BDD; the variales are sifted from top to ottom one y one and the est position is rememered p. 21 - Advanced Logic Design L4 - Elena Durova Static variale ordering variale ordering is computed up-front ased on the prolem structure works very well for many cominational functions that come from circuits we actually uild general scheme: control variales first works ad for unstructured prolems e.g. using BDDs to represent aritrary sets lots of research in ordering algorithms simulated annealing, genetic algorithms give etter results ut extremely costly p. 22 - Advanced Logic Design L4 - Elena Durova

Dynamic variale ordering Theorem (Friedman): Permuting any top part of the variale order has no effect on the nodes laeled y variales in the ottom part. Permuting any ottom part of the variale order has no effect on the nodes laeled y variales in the top part. mem 1 f f 0 f 1 mem 1 f 0 f f 1 mem 2 mem 3 a c c c c mem 2 mem 3 a a c c c c Two adjacent variale layers can e exchanged y without changing the rest of BDD f 00 f 01 f 10 f 11 f 00 f 01 f 10 f 11 p. 23 - Advanced Logic Design L4 - Elena Durova Dynamic variale ordering Dynamic variale ordering is done as follows: shift a BDD variale to the top and then to the ottom and see which position had minimal numer of BDD nodes fix the variale to this position repeat for all variales p. 24 - Advanced Logic Design L4 - Elena Durova

BDD package (CUDD) A BDD package is a software program that can manipulate ROBDDs: It can store multiple Boolean functions, sharing all vertices that can e shared. It can create new functions y comining existing ones (e.g. f = g h) It can convert the internal representation ack to an external one p. 25 - Advanced Logic Design L4 - Elena Durova Basic data structures The asic component is DdNode, which is a structure with several fields typedef struct DdNode { struct DdNode *low, *high; /* pt to low, high child */ int index; /* index of the variale that */ /* laels the node, in 0...n */ char value; /* range in {0,1} of terminal nodes */ /* x for non-terminal nodes */ int id; /* reference count - identifier */... /* unique to that node */ } p. 26 - Advanced Logic Design L4 - Elena Durova

Efficient Implementation Unique Tale: avoids duplication of existing nodes Implemented y a hash-tale hash value of key collision chain Computed Tale: avoids re-computation of existing results Implemented y a software cache p. 27 - Advanced Logic Design L4 - Elena Durova Building a BDD It is normally more efficient to uild BDDs ottom-up ITE-procedure Cudd_ddIteVar can e used Other procedures for inary operations, like Cudd_ddAnd or Cudd_ddOr can also e used p. 28 - Advanced Logic Design L4 - Elena Durova

Example of uilding a BDD using CUDD package Building BDD for f = x' 0 x' 1 x' 2 x' 3 : DdManager *manager; DdNode *f, *var, *tmp; int i; f = Cudd_readOne(manager); /* start from const 1*/ Cudd_ref(f); /* referencing f */ for(i=3; i >= 0; i--) { /* uilding ottom-up */ var = Cudd_ddIthVar(manager,i); tmp = Cudd_ddAnd(manager, Cudd_Not(var),f); /*assigning to a tmp variale, old f should e kept to free its nodes */ Cudd_ref(tmp); Cudd_recursiveDeref(manager,f); f = tmp; } p. 29 - Advanced Logic Design L4 - Elena Durova Garage Collection It is very important to free and reuse memory of unused BDD nodes. This is done y garage collection. Timing is very crucial ecause garage collection is expensive. There are two approaches: 1. do immediately when a node gets freed ad ecause dead nodes get often reincarnated in next operation 2. regular garage collections ased on statistics collected during BDD operations etter p. 30 - Advanced Logic Design L4 - Elena Durova

Extension - complemented edges Complemented edge indicates that the function associated with it is the complement of the function eing pointed y the edge reduces memory requirements BUT MORE IMPORTANT: makes some operations more efficient (NOT, ITE) two different BDDs G G G G only one BDD using complement pointer p. 31 - Advanced Logic Design L4 - Elena Durova Extension - complement edges To maintain strong canonical form, need to resolve 4 equivalences: Solution: Always choose one on left, i.e. the then edge must have no complement edge. p. 32 - Advanced Logic Design L4 - Elena Durova

Other extensions Many different extentions of BDDs are possile algeraic DDs: for B n M functions multi-terminal BDDs decision tree is inary multiple leafs, including real numers, sets or aritrary ojects efficient for matrix computations and other non-integer applications MDDs: for M n M functions can e implemented using a regular BDD package with inary encoding advantage that inary BDD variales for one MV variale do not have to stay together -> potentially etter ordering FDDs: Free Bdds variale ordering differs; not canonical anymore p. 33 - Advanced Logic Design L4 - Elena Durova Zero Suppressed BDD s - ZBDD s ZBDD s were invented y Minato to efficiently represent sparse sets. They have turned out to e useful in implicit methods for representing primes (which usually are a sparse suset of all cues). Different reduction rules: BDD: eliminate all nodes where dotted edge and solid edge point to the same node. ZBDD: eliminate all nodes where the solid edge points to 0. Connect incoming edges to node pointed y dotted edge. For oth: share equivalent nodes. BDD: 0 ZBDD: 1 0 p. 34 - Advanced Logic Design L4 - Elena Durova

Summary of BDDs BDDs give a compact representation for many practical functions as well as fast manipulation algorithms widely used in CAD-tools nowadays They are very convenient for formal verification (equivalence checking) comparing of two functions is done y comparing two pointers to the root nodes (constant-time operation) p. 35 - Advanced Logic Design L4 - Elena Durova