Presentation is loading. Please wait.

Presentation is loading. Please wait.

Binary Decision Diagrams

Similar presentations


Presentation on theme: "Binary Decision Diagrams"— Presentation transcript:

1 Binary Decision Diagrams
Sungho Kang Yonsei University

2 Representing Logic Function Design Considerations for a BDD package
Outline Representing Logic Function Design Considerations for a BDD package Algorithms

3 So two functions are identical if and only if their BDDs are identical
Why BDDs Representing Logic Function BDDs are Canonical (each Boolean function has its own unique BDD, modulo ordering of variables) So two functions are identical if and only if their BDDs are identical BDDs are compact in many cases, compared to SOP Parity trees, adders, control logic (linear vs exponential) However multipliers are bad, and a few others

4 Passing from SOP to POS and vice versa is difficult
Why not SOP and POS Representing Logic Function The two-level representations of some functions are too large to be practical (e.g. XOR) Passing from SOP to POS and vice versa is difficult Taking the complement is difficult Taking the AND/OR of two sums of products is difficult Since SOP and POS are not canonical forms, answering the equivalence question for two functions is difficult Furthermore, deciding whether a product of sums is satisfiable is NP-complete

5 BDDs as MUX Circuits Representing Logic Function

6 BDD Examples Representing Logic Function

7 Effect of Variable Ordering
Representing Logic Function f = abc + b’d + c’d 6 nodes vs. 4 nodes optimal abcd bcad

8 A decision tree is just the result of recursive Boolean expansion
BDDs vs Decision Tree Representing Logic Function A decision tree is just the result of recursive Boolean expansion 2 decision tree nodes merge into 1 if they are isomorphic A decision tree node is redundant if its two children are identical

9 The function of the terminal node is the constant function 1
Formal Definition Representing Logic Function A BDD is a directed acyclic graph representing a multiple output switching function F The function of the terminal node is the constant function 1 The function of an edge is the function of the head node, unless the edge has the complement attribute, in which case the function of the edge is the complement of the function of the node The function of a node v in V is given by l(v)fT+l(v)’fE where l(v) is label of v and fT(fE) is the function of the T(E) edge The function of  is the function of its outgoing edge

10 All internal nodes are descendents of some node in 
Formal Definition Representing Logic Function An edge with (without) the attribute is called a complement (regular) edge BDDs are canonical if All internal nodes are descendents of some node in  There are no isomorphic subgraphs For every node, fT  FE

11 ROBDD Reduced Ordered BDD
Representing Logic Function Reduced Ordered BDD Iteration of applying identification of isomorphic subgraphs and removal of redundant nodes Two functions are equivalent if they have the same BDD The size of the BDD is exponential in the number of variables in the worst case(e.g. multiplier) However BDDs are well-behaved for many functions that are not amenable to two-level representations The logical AND and OR of BDDs have the same complexity (polynomial in the size of the operands) Complementation is inexpensive Both satisfiability and tautology can be solved in constant time Indeed f is a tautology iff its BDD consists of the terminal node 1

12 ROBDD Representing Logic Function Covering problems can be solved in time linear in the size of BDD representing the constraints BDD sizes depend on the ordering Finding a good ordering is not always simple There are functions for which SOP or POS representations are mode compact than BDDs Unfortunately, many constraint functions of covering problems fall into this category In some cases SOP/POS forms are closer to the final implementation of a circuit For instance, if we want to implement a PLA, we need to generate at some point a SOP or POS form

13 2 Recursively cofactor the given SOP, in the
Building (RO)BDDs Representing Logic Function 1 Order variables 2 Recursively cofactor the given SOP, in the specified order, until the cofactors become constants or single variables; 3 Merge any pair of equivalent nodes; 4 Delete any node which has identical child nodes; 5 Repeat the merge and delete steps, until neither applies to any node

14 fab = 1, fa’b’ = 0 fab’ = 1, fa’b’ = 0
Building (RO)BDDs Representing Logic Function f = ab f = a+b fa = b, fa’ = 0 fa = 1, fa’ = b fab = 1, fa’b’ = 0 fab’ = 1, fa’b’ = 0

15 fbc =a, fb’c =d, fbc’ =d, fb’c’ =d
Building (RO)BDDs Representing Logic Function f = abc + b’d + c’d fb = ac+c’d, fb’ = d+c’d fbc =a, fb’c =d, fbc’ =d, fb’c’ =d Each node of the BDD corresponds to one of the cofactors of the given function Each path corresponds to a minimum satisfying assignment:

16 f=g? (hard with SOP or POS) f=g’? (hard with SOP or POS)
BDDs are Efficient Representing Logic Function If the BDDs of functions f and g are available, then the following may be checked in constant time: f=0? (hard with SOP) f=1? (hard with SOP) f=g? (hard with SOP or POS) f=g’? (hard with SOP or POS)

17 BDD for Linear Inequality
Representing Logic Function F = abc Fa = bc Fa’ = 0 Fab =c Fab’ = 0 Fa’b = 0 Fa’b’ = 0 F = abcd

18 BDD for Linear Inequality
Representing Logic Function ... Linear growth: n variable BDD requires 2n nodes, whereas SOP grows quadratically

19 BDDs can compactly represent huge sets
BDDs for FSMs Representing Logic Function BDDs can compactly represent huge sets Widely used to represent the set of reachable states of a Finite State Machine Used in every phase of synthesis and verification of sequential circuits

20 represented by a boolean function of n=log2(m) variables
BDDs for Large Sets Representing Logic Function A set of m objects can be represented by a boolean function of n=log2(m) variables This function has a unique BDD For n=5, S(x1, … , xn) represents 20 objects, but, ... For n=6, S(x1, … , xn) represents 40 objects Every added variable doubles the number of minterms

21 Every added variable doubles the number of minterms
BDDs for Large Sets Representing Logic Function Every added variable doubles the number of minterms S = x1’(x2+x2’x3’) + x1x2’ = x1’x2x3 + x1’x2x3’ + x1’x2’x3’ + x1x2’x3 + x1x2’x3’ 5 minterms When n = 4, 10 minterms

22 Design Consideration of BDD Package
Shared BDD Two equivalent functions can be represented by the same BDD Unique Table Dictionary of functions represented in the DAG Best implemented as a hash table Strong Canonicity Checking for equivalence just requires checking that the pointers in the DAG associated with the functions are identical Attributed Edges Regular edge and complement edge Computed Table As a speed improvement, keep a table of recently computed functions Memory Management and Dynamic Re-Ordering Garbage collection

23 BDD Graph Data Structure
BDD Package BDD data structures are compact: ~22 bytes/node 106 nodes gives about 22MB However storage is still the main issue Spaceout on 1GB machines common Dynamic reordering necessary

24 ITE Operator ITE(F,G,H) = FG + F’H ITE(0,0,0) = 0 0
Algorithms ITE(F,G,H) = FG + F’H ITE(0,0,0) = 0 0 ITE(F,G,0) = FG AND(F,G) ITE(F,G’,0) = 0 F>G ITE(F,1,0) = F F ITE(F,0,G) = F’G F<G ITE(1,G,0) = G G ITE(F,G’,G) = FG XOR(F,G) ITE(F,1,G) = F+G OR(F,G) ITE(F,0,G’) = (F+G)’ NOR(F,G) ITE(F,G,G’) = (FG)’ XNOR(F,G) ITE(G,0,1) = G’ NOT(G) ITE(F,1,G’) = F+G’ FG ITE(F,0,1) = F’ NOT(F) ITE(F,G,0) = F’+G FG ITE(F,G’,1) = (FG)’ NAND(F,G) ITE(1,1,1) = 1 0

25 ITE can represent all 16 functions of 2 variables
The ITE Operator Algorithms ITE can represent all 16 functions of 2 variables ITE(F,G,H) = FG + F’H ITE(F,G,0) = FG AND(F,G) ITE(F,1,G) = F+G OR(F,G) ITE(F,G’,0) = 0 F>G ITE(F,0,G) = F’G F<G ITE(F,G’,G) = FG XOR(F,G) ITE(F,G,G’) = (FG)’ XNOR(F,G)

26 ITE(1,F,G) = ITE(0,G,F) = ITE(F,1,0) = ITE(G,F,F) = F
ITE Operator Algorithms ITE(F,G,H) = FG + F’H = v (FG + F’H)v + v’ (FG + F’H)v’ = v (Fv Gv + F’v Hv) + v’ (Fv’ Gv’ + F’v’ Hv’) = (v, ITE (Fv, Gv, Hv), ITE(Fv’, Gv’, Hv’) ) positive cofactor negative cofactor Terminal cases ITE(1,F,G) = ITE(0,G,F) = ITE(F,1,0) = ITE(G,F,F) = F

27 ITE Application I = ITE(F,G,H)
Algorithms I = ITE(F,G,H) = (a, ITE(Fa,Ga,Ha), ITE(Fa’,Ga’,Ha’ ) ) = (a, ITE(1,C,H), ITE(B,0,H) ) = (a, C, (b, ITE(Bb,0b,Hb), ITE(Bb’,0b’,Hb’ ) ) ) = (a, C, (b, ITE(1,0,1), ITE(0,0,D) ) ) = (a, C, (b,0,D) )

28 In BDDs (ROBDDs) no two distinct nodes represent the same function
ROCBDDs Algorithms In BDDs (ROBDDs) no two distinct nodes represent the same function In ROCBDDs (reduced, ordered, complemented) no two nodes have the same or complementary functions This magic is worked with a “complement dot” edge attribute and a transformation of some sub-BDDs to a standard form 2X (best case) reduction possible

29 Example of Complement Dots
Algorithms (a  b  c)’ (a  b)’ Can appear only on 0-edges (E-edges) or outputs Function evaluates to 1 on paths with even # of

30 Complementation Rules
Algorithms Complementation rules (for canonicity): 1-edge (T-edge, +cofactor) must be regular If complemented function needed on 1-edge, replace appropriate right subgraph with corresponding left subgraph

31 Conditioning of ITE Cells
Algorithms If we could identify all triple that give the same result, we could map all of them into the same entry of the computed table In general, finding all such triples is too expensive, but there are special cases that can be identified with very little effort Two arguments are the same function ITE(F,F,G) Two arguments are one of the complement of the other ITE(F,G,F’) One or more arguments are constants ITE(F,G,0) These checks can be performed in constant time


Download ppt "Binary Decision Diagrams"

Similar presentations


Ads by Google