2 Binary Decision Diagrams 2. Binary Decision Diagrams Verification - - PowerPoint PPT Presentation

2 binary decision diagrams 2 binary decision diagrams
SMART_READER_LITE
LIVE PREVIEW

2 Binary Decision Diagrams 2. Binary Decision Diagrams Verification - - PowerPoint PPT Presentation

Fachgebiet Rechnersysteme 2. Binary Decision Diagrams 1 2 Binary Decision Diagrams 2. Binary Decision Diagrams Verification Technology Content 2.1 BDD concepts 2 2 Variable orderings 2.2 Variable orderings 2.3 OBDD algorithms 2 4 FDDs


slide-1
SLIDE 1
  • 2. Binary Decision Diagrams

1

2 Binary Decision Diagrams

Fachgebiet Rechnersysteme

  • 2. Binary Decision Diagrams

Verification Technology

Content

2.1 BDD concepts 2 2 Variable orderings 2.2 Variable orderings 2.3 OBDD algorithms 2 4 FDD´s and OKFDD´s 2.4 FDD s and OKFDD s 2.5 Integer valued decision diagrams

slide-2
SLIDE 2
  • 2. Binary Decision Diagrams

2

The problem of logic verification: show that two circuits implement the same boolean function p a g

=1

b

1

a a

&

g a b

&

g

& &

b

&

slide-3
SLIDE 3
  • 2. Binary Decision Diagrams

3

2.1 BDD concepts

Problem: efficient representation of Boolean functions 2.1 BDD concepts

Problem: efficient representation of Boolean functions  DNF: linear for OR of n variables, exponential for XOR XOR  Reed-Muller: linear for XOR of n variables, exponential for OR

Problem: efficient application of Boolean operations  example: p DNF  Negation  DNF, e.g.: ab + cd + ef + gh  (ab + cd + ef + gh)  ? ab + cd + ef + gh  (ab + cd + ef + gh)  ?

Possible solution in many cases: binary decision diagrams (BDD´s) d ag a s ( s)

slide-4
SLIDE 4
  • 2. Binary Decision Diagrams

4 2.1 BDD concepts

Investigated systematically first by R. Bryant (CMU)  Seminal paper by Bryant in ´86  Seminal paper by Bryant in 86

Early work by Shannon ~ 1940 (relais-networks)

Revolutionary impact on logic synthesis logic

Revolutionary impact on logic synthesis, logic verification, etc.

Many modern CAD-tools employ BDD´s

Many modern CAD tools employ BDD s

slide-5
SLIDE 5
  • 2. Binary Decision Diagrams

5 2.1 BDD concepts

0 0 0 0 a b c d f

Idea: decompose a function into two sub- 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 functions which do not depend on a certain variable e g x 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 variable, e.g., x1 0 1 1 0 0 0 1 1 1 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1

slide-6
SLIDE 6
  • 2. Binary Decision Diagrams

6 2.1 BDD concepts

0 0 0 0 a b c d f

Idea: Decompose a function into two sub- 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 functions which do not depend on a certain variable e g x 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 f(0, b, c, d) variable, e.g., x1

Apply Boole´s expansion theorem in a systematic 0 1 1 0 0 0 1 1 1 0 1 0 0 0  theorem in a systematic way to all variables

Represent result 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 graphically 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 f(1, b, c, d) 1 1 1 0 0 1 1 1 1 1

slide-7
SLIDE 7
  • 2. Binary Decision Diagrams

7

f *f( ) *f( )

2.1 BDD concepts

0 0 0 0 a b c d f f f = a*f(0, b, c, d) + a*f(1, b, c, d) 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 a 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 f(0, b, c, d) a 1 0 1 1 0 0 0 1 1 1 0 1 0 0 0  0 0 0 0 0 0 f(0, b, c, d) f(1, b, c, d) 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 f(1, b, c, d) 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 1 0 0 1 1 1 1

slide-8
SLIDE 8
  • 2. Binary Decision Diagrams

8 2.1 BDD concepts

The application of Boole´s expansion theorem to all variables leads to a decision tree. Example: XOR in 3 variables a b c

a b c   a b c  

a 1 0 0 0 0 0 0 1 1 b 1 b 1 0 1 0 1 0 1 1 0 1 0 0 1 c c c c 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 Function values

slide-9
SLIDE 9
  • 2. Binary Decision Diagrams

9 2.1 BDD concepts

The application of Boole´s expansion theorem to all variables leads to a decision tree. a b c

a b c   a b c  

Example: XOR in 3 variables a 1 0 0 0 0 0 0 1 1 b 1 b 1 0 1 0 1 0 1 1 0 1 0 0 1 c 1 c 1 c 1 c 1 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Function values

slide-10
SLIDE 10
  • 2. Binary Decision Diagrams

10 2.1 BDD concepts

Variable ordering: order in which Boole's expansion theorem is applied pp

a b c  

  • rder a b c

a 1

  • rder a, b, c

b 1 b 1 c 1 c 1 c 1 c 1 1 1 1 1 1 1 1 1

slide-11
SLIDE 11
  • 2. Binary Decision Diagrams

11 2.1 BDD concepts

Concepts: Nodes Ed l b lli Edge labellings a 1 b b Directed edges b (Direct) successors of node a

slide-12
SLIDE 12
  • 2. Binary Decision Diagrams

12 2.1 BDD concepts

Concepts: Root node a 1 Paths b 1 b 1 c c c c 1 1 1 1 1 1 1 1 Leafs or Terminal nodes

slide-13
SLIDE 13
  • 2. Binary Decision Diagrams

13 2.1 BDD concepts

Decision trees are ordered (identical variable

  • rdering on all paths) or free

g p ) — Example of a free decision tree: a 1 c 1 b c 1 b 1 b 1 b 1 c 1 c 1 1 1 1 1

slide-14
SLIDE 14
  • 2. Binary Decision Diagrams

14 2.1 BDD concepts

A fully expanded decision tree has 2n leaf nodes

Example of a (free) decision tree which is not fully

Example of a (free) decision tree which is not fully expanded: a 1 c 1 b c 1 b 1 b 1 c 1 1 1 1

slide-15
SLIDE 15
  • 2. Binary Decision Diagrams

15 2.1 BDD concepts

Observation: there are identical sub-trees a 1 b 1 b b 1 b 1 c 1 c 1 c 1 c 1 1 1 1 1

slide-16
SLIDE 16
  • 2. Binary Decision Diagrams

16 2.1 BDD concepts

Observation: there are identical sub-trees a 1 b 1 b b 1 b 1 c 1 c 1 1 1

slide-17
SLIDE 17
  • 2. Binary Decision Diagrams

17 2.1 BDD concepts

Merging identical sub-trees results in a decision- graph a g p 1 a b c

a b c  

b b 1 1 0 0 0 0 0 0 1 1 0 1 0 1 c c 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 1 1

slide-18
SLIDE 18
  • 2. Binary Decision Diagrams

18 2.1 BDD concepts

a 1 a b c

a b c  

b b 1 1 0 0 0 0 0 0 1 1 0 1 0 1 c c 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 1 1 "0-part" "1-part"

slide-19
SLIDE 19
  • 2. Binary Decision Diagrams

19 2.1 BDD concepts

Shannon: A symbolic analysis of relay and switching circuits (1938) circuits (1938)  Size of the networks grows linearly in the number of variables

slide-20
SLIDE 20
  • 2. Binary Decision Diagrams

20 2.1 BDD concepts

Some simple examples of BDD's: a 1 a 1 1 1 1 1 1 a a a b a 1 b 1 b 1 b 1 1 1

slide-21
SLIDE 21
  • 2. Binary Decision Diagrams

21 2.1 BDD concepts

AND-, OR-, XOR-operation in n variables

x x

1

x1 x

1

x1 1 1

x2

1 1

x

2

x2 x2 1 1 ... 1 . ... 1

xn

1

x

n

. . xn xn 1 1 1 1 1

 #nodes grows linearly in #variables

slide-22
SLIDE 22
  • 2. Binary Decision Diagrams

22

&

3 2 1

S S S

2.1 BDD concepts

— Example: SN 74181 ALU:

& 1 & & 1 & & &

1 n+4

D E B G c S

3 3

1 & & & 1 & & =1

3

E A P F

3

D

3

=1 =1 1 & & & 1 & & & & & 1

2

Q A

2 2

E D B

3

& & 1 & & &

2

F A

1

B D

2 2

Q

=1 =1 & & & & & 1 1 & & =1

1 1

A=B F

1

B A E

1

& & 1 & & & 1 =1

F E D B

1 1

Q

1 =1 1 & & &

n

M c A 0 Q

=1 =1

slide-23
SLIDE 23
  • 2. Binary Decision Diagrams

23

— SN 74181 BDD ("shared BDD"):

2.1 BDD concepts

s3 g c4 p f3 f2 aeqb f1 f0 s3 s2 s1 s0 b3 a3 b2 a3 a2 b1 a2 a1 b0 a0 m c

slide-24
SLIDE 24
  • 2. Binary Decision Diagrams

24 2.1 BDD concepts

One path to the 1 leaf-node corresponds to a product – an implicant of the function. Example: p p a 1 a b c

a b c  

b b 1 1 0 0 0 0 0 0 1 1

c b a

0 1 0 1 0 1 1 0 1 0 0 1 c c 1 1 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 1

slide-25
SLIDE 25
  • 2. Binary Decision Diagrams

25 2.1 BDD concepts

2 Problems:  Given a binary decision diagram  Given a binary decision diagram. How to derive the Boolean function represented by the BDD?  Given a Boolean function. How to derive the BDD for it?  First: BDD  Boolean function

slide-26
SLIDE 26
  • 2. Binary Decision Diagrams

26 2.1 BDD concepts

A node v of a BDD is characterized by a triple (x, v0 ,v1), where v0 ,v1 are the successors of v

0 , 1

v x v0 v1

The leaf nodes 0 and 1 represent the Boolean functions 0 and 1

According to Boole's expansion theorem, the Boolean function bf(v) is associated with node v as follows (where var(v) is the variable of node v): var(v) is the variable of node v): bf(v) = var(v)· bf(v0) + var(v)· bf(v1) f f f

1

slide-27
SLIDE 27
  • 2. Binary Decision Diagrams

27 2.1 BDD concepts

— Example: which Boolean function is represented by the following BDD? y g a 1 b 1 1 1

 The function associated with a node can be

1 determined only if the functions associated with the successor nodes are known bf(v) = var(v)· bf(v0) + var(v)· bf(v1)

slide-28
SLIDE 28
  • 2. Binary Decision Diagrams

28 2.1 BDD concepts

 "Bottom-up procedure": 1. Step a 1 b b 1 1 Functions and 1 Functions 0 and 1

slide-29
SLIDE 29
  • 2. Binary Decision Diagrams

29 2.1 BDD concepts

 "Bottom-up procedure": 2. Step a 1 b bf(v) = var(v)· bf(v0) + var(v)· bf(v1) b 1 = b · 0 + b · 1 = b 1 Functions and 1 Functions 0 and 1

slide-30
SLIDE 30
  • 2. Binary Decision Diagrams

30 2.1 BDD concepts

 "Bottom-up procedure": 3. Step bf( ) ( ) bf( ) ( ) bf( ) a 1 bf(v) = var(v)· bf(v0) + var(v)· bf(v1) = a · 0 + a · b = a · b 1 b bf(v) = var(v)· bf(v0) + var(v)· bf(v1) b 1 = b · 0 + b · 1 = b 1 Functions and 1 Functions 0 and 1

slide-31
SLIDE 31
  • 2. Binary Decision Diagrams

31 2.1 BDD concepts

There are many variants of binary decision diagrams

Most useful and common: OBDD's (Ordered Binary

Most useful and common: OBDD s (Ordered Binary Decision Diagrams, Bryant 1986)

OBDD properties: OBDD properties:  Ordered : The variables appear in a fixed ordering on all paths — Technically, an index (a positive integer) is associated with each variable index(var(v)) — For each node v with successors v0 and v1 we have: index(var(v)) < index(var(v0)) und index(var(v)) < index(var(v )) index(var(v)) < index(var(v1))

slide-32
SLIDE 32
  • 2. Binary Decision Diagrams

32 2.1 BDD concepts

a b c  

i bl a

a b c  

variable

  • rder a, b, c

index(a) = 1 1 index(b) = 2 b 1 b 1 index(b) = 2 index(c) = 3 c 1 c 1 c 1 c 1 index(c) 3 1 1 1 1

slide-33
SLIDE 33
  • 2. Binary Decision Diagrams

33 2.1 BDD concepts

OBDD properties (cont'd.):  Reduced:  Reduced: — The function represented by one node is different from the functions of all other nodes — The two successors of each node are distinct

slide-34
SLIDE 34
  • 2. Binary Decision Diagrams

34 2.1 BDD concepts

— Reduction example: a 1 a 1 b 1 b 1 b 1 b 1 1 1 1 1 a 1 Several representations of 1 b 1 Identical 1 1 Identical successors

slide-35
SLIDE 35
  • 2. Binary Decision Diagrams

35 2.1 BDD concepts

Simplified representations exist, e.g.,  1-edges to the right 0-edges to the left  1-edges to the right, 0-edges to the left  Edges to 0 omitted  etc  etc. — Example: (a  b) · (c  d) · (e  f)  or: 0 edges are dashed lines

a b b

 or: 0 edges are dashed lines

1

b b c

all

d d e

  • thers

e f f

1

slide-36
SLIDE 36
  • 2. Binary Decision Diagrams

36 2.1 BDD concepts

Now: Boolean function  OBDD  Example above: (a  b) · (c  d) · (e  f)  Example above: (a  b) · (c  d) · (e  f)  Let

F (a b) (c d) (e f) (a b) r         

 Variable ordering a, b, c, d, e, f  Following Boole's expansion theorem, we have the

( ) ( ) ( ) ( )

 Following Boole s expansion theorem, we have the following cofactors of F w.r.t. a a 1

F (1 b) r b r 

F (0 b) r b r 

1

F (1 b) r b r

a 

   

F (0 b) r b r

a 

   

slide-37
SLIDE 37
  • 2. Binary Decision Diagrams

37 2.1 BDD concepts

 More expansions: a 1

F (1 b) r b r

a 

    F (0 b) r b r

a 

   

a 1 b b 1 b b 1

F F r

ab ab

  F

ab 

F

ab 

etc.

slide-38
SLIDE 38
  • 2. Binary Decision Diagrams

38 2.1 BDD concepts

The problem of reduction:  In the example above it was easy to detect F

F r

 In the example above it was easy to detect and to merge the nodes for and  Redundant nodes have to be removed

F F r

ab ab

  F

ab

F

ab

Redundant nodes have to be removed  Redundant nodes — Either represent the same function Either represent the same function — Or have identical successors (easy to detect)

How to know that two nodes represent the same function?

How to know that two nodes represent the same function?

slide-39
SLIDE 39
  • 2. Binary Decision Diagrams

39 2.1 BDD concepts

Two functions

a a

f a af f  

a a

g a ag g  

are equal iff they have identical cofactors

a a

b b 1 1

fa

 1 1

ga

 a 1 1

fa

 a 1 1

ga

 c f c g a 1 a 1

fa fa ga ga

slide-40
SLIDE 40
  • 2. Binary Decision Diagrams

40 2.1 BDD concepts

If we presume that all successor nodes of two nodes represent distinct functions then the two nodes represent p p identical functions iff the direct successor nodes are pairwise identical a 1 a 1 1 1

f f g g fa fa ga ga

 This results in a simple bottom-up-procedure:

redundant nodes are eliminiated in the redundant nodes are eliminiated in the bottom-level first, the in the second level, etc.

slide-41
SLIDE 41
  • 2. Binary Decision Diagrams

41 2.1 BDD concepts

b 1 a 1 b 1 c 1 c 1 c 1 c 1 1 1 1 1 1 1 1 1

  • 1. Step:
  • 1. Step:

0/1 leafs

a 1 b 1 b 1

all

c c 1 c c 1

all

  • thers

1

slide-42
SLIDE 42
  • 2. Binary Decision Diagrams

42

  • 2. Step:

d

a 1

2.1 BDD concepts

c nodes

b 1 b 1 c c 1 c c 1

all

  • thers

1 1 a b 1 b 1 c c

all

  • thers

1 1

slide-43
SLIDE 43
  • 2. Binary Decision Diagrams

43 2.1 BDD concepts

  • 3. Step

b nodes

1 a

b nodes ll

b 1 b 1

all

  • thers

c c 1 1 1

 We can decide that the two b nodes do not  We can decide that the two b-nodes do not

represent the same function by means of the c- nodes

slide-44
SLIDE 44
  • 2. Binary Decision Diagrams

44 2.1 BDD concepts

Example: derive the OBDD for the following function, variable order r e g variable order r,e,g r e g p p = eg + rg + reg 0 0 0 0 0 1 1 0 1 0 1 pr = eg + g = g 0 1 0 1 0 1 1 1 0 0 1 1 0 1 23 = 8 cases pr = eg + eg 1 0 1 1 1 0 1 1 1 1

Traffic- r Light Checker e g p

slide-45
SLIDE 45
  • 2. Binary Decision Diagrams

45 2.1 BDD concepts

r pr = eg + g = g + p = eg + rg + reg r

1

pr = eg + eg p g g g e g g g 1 1

slide-46
SLIDE 46
  • 2. Binary Decision Diagrams

46 2.1 BDD concepts

Reduction was necessary in the original concept by R. Bryant (1986), but can be avoided completely (s. Sect. 2.3) y ( ), p y ( )

slide-47
SLIDE 47
  • 2. Binary Decision Diagrams

47 2.1 BDD concepts

OBDD´s can be implemented easily by means of 2:1-Multiplexors p

1

x 1 x

1 1

fx fx _

& &

fx fx _ fx _ fx

x

x x

slide-48
SLIDE 48
  • 2. Binary Decision Diagrams

48 2.1 BDD concepts

— Example: a

1

a 1

1

b 1 b

1

c c c 1 c 1

slide-49
SLIDE 49
  • 2. Binary Decision Diagrams

49 2.1 BDD concepts

Given a certain variable ordering, OBDD´s are canonical representations of Boolean functions, i.e., there exists p , , exactly one OBBD-representation for each Boolean function

Two circuits implementing the same function have identical OBDD's a

1

a b b b

1 1

=1

=

1 a a a b b

1 1 1

a b a

& & &

1 b b

&

slide-50
SLIDE 50
  • 2. Binary Decision Diagrams

50

OBDD´ Ci it 1

2.1 BDD concepts

OBDD´s

& 1 & & 1 & & & & &

3 2 1 n+4

D E S B G c S S S

3 3 3

=1

Circuit 1:

& & 1 1 & & & & 1 & & & & & & & 1 =1

2 2 3

Q A P F F A

3 2 2

E D B

3 3 2

=1 1 =1 & & 1 & & & & 1 & & 1 & 1 & & & & & 1 =1

1 1

A=B F

1 1

B A D E E D B

2 1 2 1

Q Q

=1 =1 =1 &

3 2

S S S

Circuit 2:

=

1 & & & &

n

M c F E A 0 Q

=1 =1 & 1 & & & & 1 1 & 1 & & & & & & & =1

1 3 n+4

D E Q B A G c P F S S

3 3 2 3

D

3

=1 =1 & 1 & & & & 1 & 1 & & & 1 & & & 1 1 & & &

2 1 2

Q F A=B A

2

E

1 1

B B A D E

3 2 2

Q

=1 =1 & & 1 1 & & & & 1 & & & 1 & =1

1 n

M c F F A E D B A 0

1 1

Q Q

=1 =1 =1

slide-51
SLIDE 51
  • 2. Binary Decision Diagrams

51

2.2 Variable Orderings 2.2 Variable Orderings

The variable ordering has a critical impact on the size of the OBDD (= #nodes)

There are static and d namic proced res to determine

There are static and dynamic procedures to determine "good" orderings

slide-52
SLIDE 52
  • 2. Binary Decision Diagrams

52 2.2 Variable orderings

The number of nodes of a OBDD depends critically on the variable ordering  Classical example (Bryant 1986): f = x1x2 + x3x4 + x5x6 x1 x1

1

x2

1

x3

1

x3

1 1 1

x3

1

x5 x5 x5 x5 x

1

x

1 1 1 1

x5 x4

1

x2 x2 x2 x2

1 1

x4 x4

1 1 0

x5 x6

1 1

x6

1

x4 x4 1

1 0

1

1

6

1

1

slide-53
SLIDE 53
  • 2. Binary Decision Diagrams

53 2.2 Variable orderings

 Example: n-bit adder: — Order R1: an, bn, an-1, bn-1,..., a0, b0 — Order R2: an, an-1,..., a0, bn, bn-1,..., b0 n= 8 16 32 64 time 0 02 0 03 0 11 0 19 time 0.02 0.03 0.11 0.19 #nodes 35 75 155 315 R1: time 0.39 16.34 #nodes 750 196574 R2:

 

slide-54
SLIDE 54
  • 2. Binary Decision Diagrams

54 2.2 Variable orderings

Calculating the best order may result in exponential run time

For a given circuit, "good" orderings can be heuristically determined — Example: Distribution of a "weight" 1/4 z x 1/2 1/4 1/2 1/ 4

& &

y 1 1/2 1/4 1/2 1/4

& & &

x 1/ 4

&

Sum of weights: x=1/2, y=1/4, z=1/4,  first use x for expansion 4

slide-55
SLIDE 55
  • 2. Binary Decision Diagrams

55 2.2 Variable orderings

— Delete selected variable and distribute weight again weight again z 1/4 z 1 1/2 1/4 3/4

& & &

y 1 1/2 1/2 3/4 3/4

& &

Sum of weights : y=3/4, z=1/4,  next use y for expansion — Order: x, y, z

slide-56
SLIDE 56
  • 2. Binary Decision Diagrams

56 2.2 Variable orderings

Sifting: dynamic ordering procedure (Rudell ICCAD´93)  Basic step: exchange two adjacent variables (Fujita  Basic step: exchange two adjacent variables (Fujita et al. EDAC´91) a 1 b b 1 1 c c 1 1 1

slide-57
SLIDE 57
  • 2. Binary Decision Diagrams

57 2.2 Variable orderings

 Principle: exchange 0-1 and 1-0 path b 1 c c 1 1 g0 g1 g2 g3 c 1 b b 1 1 g0 g2 g1 g3

slide-58
SLIDE 58
  • 2. Binary Decision Diagrams

58 2.2 Variable orderings

a 1 b b 1 1 1 b b 1 1 c c 1 1 1 1

slide-59
SLIDE 59
  • 2. Binary Decision Diagrams

59 2.2 Variable orderings

a 1 c c 1 1 1 c c 1 1 b b 1 1 1 1

slide-60
SLIDE 60
  • 2. Binary Decision Diagrams

60 2.2 Variable orderings

Sifting-procedure:  Calculate variable with max #nodes (the "thickest"  Calculate variable with max. #nodes (the thickest part of the OBDD)  Shift variable over OBDD by pairwise exchange of y p g adjacent variables  Shift variable to a position where #nodes is minimal Minimum Minimum 1

slide-61
SLIDE 61
  • 2. Binary Decision Diagrams

61 2.2 Variable orderings

 Movie "Sifting" by Stefan Höreth:

slide-62
SLIDE 62
  • 2. Binary Decision Diagrams

62 2.2 Variable orderings

slide-63
SLIDE 63
  • 2. Binary Decision Diagrams

63 2.2 Variable orderings

slide-64
SLIDE 64
  • 2. Binary Decision Diagrams

64 2.2 Variable orderings

slide-65
SLIDE 65
  • 2. Binary Decision Diagrams

65 2.2 Variable orderings

slide-66
SLIDE 66
  • 2. Binary Decision Diagrams

66 2.2 Variable orderings

slide-67
SLIDE 67
  • 2. Binary Decision Diagrams

67 2.2 Variable orderings

slide-68
SLIDE 68
  • 2. Binary Decision Diagrams

68 2.2 Variable orderings

slide-69
SLIDE 69
  • 2. Binary Decision Diagrams

69 2.2 Variable orderings

slide-70
SLIDE 70
  • 2. Binary Decision Diagrams

70

 im Detail:

2.2 Variable orderings

V3 V4

1

V4 V4 V3 V3 V5 V5 V5 V5 1 1

slide-71
SLIDE 71
  • 2. Binary Decision Diagrams

71 2.2 Variable orderings

slide-72
SLIDE 72
  • 2. Binary Decision Diagrams

72 2.2 Variable orderings

slide-73
SLIDE 73
  • 2. Binary Decision Diagrams

73 2.2 Variable orderings

slide-74
SLIDE 74
  • 2. Binary Decision Diagrams

74 2.2 Variable orderings

slide-75
SLIDE 75
  • 2. Binary Decision Diagrams

75 2.2 Variable orderings

slide-76
SLIDE 76
  • 2. Binary Decision Diagrams

76 2.2 Variable orderings

slide-77
SLIDE 77
  • 2. Binary Decision Diagrams

77 2.2 Variable orderings

slide-78
SLIDE 78
  • 2. Binary Decision Diagrams

78 2.2 Variable orderings

slide-79
SLIDE 79
  • 2. Binary Decision Diagrams

79 2.2 Variable orderings

slide-80
SLIDE 80
  • 2. Binary Decision Diagrams

80 2.2 Variable orderings

slide-81
SLIDE 81
  • 2. Binary Decision Diagrams

81 2.2 Variable orderings

slide-82
SLIDE 82
  • 2. Binary Decision Diagrams

82 2.2 Variable orderings

slide-83
SLIDE 83
  • 2. Binary Decision Diagrams

83 2.2 Variable orderings

slide-84
SLIDE 84
  • 2. Binary Decision Diagrams

84 2.2 Variable orderings

slide-85
SLIDE 85
  • 2. Binary Decision Diagrams

85 2.2 Variable orderings

slide-86
SLIDE 86
  • 2. Binary Decision Diagrams

86 2.2 Variable orderings

slide-87
SLIDE 87
  • 2. Binary Decision Diagrams

87 2.2 Variable orderings

slide-88
SLIDE 88
  • 2. Binary Decision Diagrams

88 2.2 Variable orderings

slide-89
SLIDE 89
  • 2. Binary Decision Diagrams

89 2.2 Variable orderings

slide-90
SLIDE 90
  • 2. Binary Decision Diagrams

90

2.3 OBDD Construction 2.3 OBDD Construction a 1 b 1 a ? c 1 c & a b 1 1 1 1

slide-91
SLIDE 91
  • 2. Binary Decision Diagrams

91 2.3 OBDD construction

Principle: build OBDD while traversing the circuit from inputs to outputs p p a OBDD-Package C-Program Traverser 1 Traverser a 1 C-Program C-Program 1 c & a b 1 g C-Program & b 1

*

1

slide-92
SLIDE 92
  • 2. Binary Decision Diagrams

92 2.3 OBDD construction

a a OBDD-Package C-Program Traverser 1 1 b 1 Traverser a 1 1 C-Program c & a b 1 C-Programm 1 C-program 1 C-Program 1 b 1 1 c g C-Programm & p g g 1 1

slide-93
SLIDE 93
  • 2. Binary Decision Diagrams

93 2.3 OBDD construction

a a OBDD-Package C-Program Traverser 1 1 b 1 a Traverser a 1 1 1 b C-Program C-Program 1 c & a b 1 b 1 g C-Programm & b 1 1 c c 1 C-Program & 1 1 1

slide-94
SLIDE 94
  • 2. Binary Decision Diagrams

94 2.3 OBDD construction

Orthogonality of Boole's expansion f+g = x*(fx + gx) + x*(fx + gx), f*g = x*(fx * gx) + x*(fx * gx), f = x*fx + x*fx * x g x f x x 1 1 * * fx fx gx gx

slide-95
SLIDE 95
  • 2. Binary Decision Diagrams

95 2.3 OBDD construction

AND-operation of two OBDD´s  Assumption: nodes are represented as triples  Assumption: nodes are represented as triples (x,v0,v1) var low high f ti access-functions

slide-96
SLIDE 96
  • 2. Binary Decision Diagrams

96 2.3 OBDD construction

function AND(bdd1, bdd2): IF bdd1 0 OR bdd2 0 THEN t IF bdd1=0 OR bdd2=0 THEN return 0; ELSEIF bdd1=1 THEN return bdd2; ELSEIF bdd2=1 THEN return bdd1; ELSE var1:=var(bdd1);var2:=var(bdd2); ( ); ( ); IF var1=var2 THEN x:=var1; v0:= AND(low(bdd1), low(bdd2)), v1:= AND(high(bdd1),high(bdd2)); ( g ( ), g ( )); ELSEIF index(var1) < index(var2) THEN x:=var1; v0:= AND(low(bdd1), bdd2), ( ( ), ), v1:= AND(high(bdd1), bdd2); ELSEIF ... IF v0 = v1 THEN return v0 ELSE return (x v0 v1); IF v0 = v1 THEN return v0 ELSE return (x,v0,v1); ...

slide-97
SLIDE 97
  • 2. Binary Decision Diagrams

97 2.3 OBDD construction

3 5 c & a b 1

a

*

4 c

1 b 1

*

c 1 1 3 1 4

bdd1 bdd2 var1=a var2=c => index(var1) < index(var2)

slide-98
SLIDE 98
  • 2. Binary Decision Diagrams

98 2.3 OBDD construction

3 5 & a b 1

a

*

4 c

1 b 1

*

c 1 1 1 3 1 4 3 4

bdd1 bdd2 var1=a var2=c => index(var1) < index(var2) x:=var1 := a x:=var1 := a v0:= and(low(bdd1),bdd2), v1:= and(high(bdd1),bdd2)

slide-99
SLIDE 99
  • 2. Binary Decision Diagrams

99 2.3 OBDD construction

3 5 & a b 1

a

*

4 c

1 b 1

*

c 1 1 3 1 4 3 4

bdd1 bdd2 var1=b var2=c => index(var1) < index(var2)

slide-100
SLIDE 100
  • 2. Binary Decision Diagrams

100 2.3 OBDD construction

a 1

3 5 & a b 1

a

*

1 b 1

4 c

1 b 1

*

c 1 c 1 1 1 3 1 4 1 5 3 4 5

bdd1 bdd2 var1=b var2=c => index(var1) < index(var2) x:=var1 := b x:=var1 := b v0:= and(low(bdd1),bdd2), v1:= and(high(bdd1),bdd2)

slide-101
SLIDE 101
  • 2. Binary Decision Diagrams

101 2.3 OBDD construction

a 1

3 5 & a b 1

*

1 b 1

4 c

a

*

c 1 c 1 1 b 1 3 1 4 1 5 1 1 3 4 5

bdd1 bdd2 var2=c => index(var1) < index(var2) x:=var1 := b var1=b x:=var1 := b v0:= and(low(bdd1),bdd2), v1:= and(high(bdd1),bdd2)

slide-102
SLIDE 102
  • 2. Binary Decision Diagrams

102 2.3 OBDD construction

a 1

3 5 & a b 1

a

*

1 b 1

4 c

1 b 1

*

c 1 c 1 1 1 3 1 4 1 5 3 4

bdd1 bdd2

5

bdd1 bdd2 var2=c => index(var1) < index(var2) x:=var1 := b var2=c var1=b x:=var1 := b v0:= and(low(bdd1),bdd2), v1:= and(high(bdd1),bdd2)  

slide-103
SLIDE 103
  • 2. Binary Decision Diagrams

103 2.3 OBDD construction

a 1

3 5 & a b 1

*

1 b 1

4 c

a

*

c 1 c 1 1 b 1 1 4 1 5 1 1 3 4

bdd1 bdd2

5 3

var1=a var2=c => index(var1) < index(var2) x:=var1 := a x:=var1 := a v0:= and(low(bdd1),bdd2), v1:= and(high(bdd1),bdd2) 

slide-104
SLIDE 104
  • 2. Binary Decision Diagrams

104 2.3 OBDD construction

a 1

3 5 & a b 1

a

*

1 b 1

4 c

1 b 1

*

c 1 c 1 1 1 3 1 4 1 5 3 4

bdd1 bdd2

5

var2=c => index(var1) < index(var2) x:=var1 := a var1=a x:=var1 := a v0:= and(low(bdd1),bdd2), v1:= and(high(bdd1),bdd2)

slide-105
SLIDE 105
  • 2. Binary Decision Diagrams

105 2.3 OBDD construction

a 1

3 5 & a b 1

a

*

1 b 1

4 c

1 b 1

*

c 1 c 1 1 1 3 1 4 1 5 3 4

bdd1 bdd2

5

var2=c => index(var1) < index(var2) x:=var1 := a var1=a x:=var1 := a v0:= and(low(bdd1),bdd2), v1:= and(high(bdd1),bdd2)  

slide-106
SLIDE 106
  • 2. Binary Decision Diagrams

106 2.3 OBDD construction

"OBDD-Packages" manage two tables:  The unique table (ut) with entries:  The unique table (ut) with entries: x v0 v1

 For uniqueness of OBDD's  For uniqueness of OBDD s

slide-107
SLIDE 107
  • 2. Binary Decision Diagrams

107 2.3 OBDD construction

 The computed table (ct) with entries Operation bdd1 bdd2 Result bdd

 Stores previously calculated results  Stores previously calculated results

slide-108
SLIDE 108
  • 2. Binary Decision Diagrams

108 2.3 OBDD construction

Reduction was needed in the original OBDD procedures

OBDD uniquess is guaranteed by

OBDD uniquess is guaranteed by  Checking in the unique-table (ut) if the OBDD was calculated before calculated before  Testing for identical successor nodes

In addition, it is checked in the computed table (ct) if the result was calculated before

 Many steps of recursion may be saved

slide-109
SLIDE 109
  • 2. Binary Decision Diagrams

109 2.3 OBDD construction

function AND(bdd1, bdd2): IF (AND,bdd1,bdd2,x)  ct THEN return x; ( ) IF bdd1=0 OR bdd2=0 THEN return 0; ELSEIF bdd1=1 THEN return bdd2; ELSEIF bdd1=1 THEN return bdd2; ELSEIF bdd2=1 THEN return bdd1; ELSE var1:=var(bdd1);var2:=var(bdd2); IF var1=var2 THEN x:=var1; v0:= AND(low(bdd1), low(bdd2)), v1:= AND(high(bdd1),high(bdd2)); ELSEIF index(var1) < index(var2) THEN x:=var1; v0:= AND(low(bdd1), bdd2), v1:= AND(high(bdd1), bdd2); ELSEIF ELSEIF ... IF v0 = v1 THEN return v0 ELSEIF (x,v0,v1) ut THEN put in ut; ELSE return (x,v0,v1); ...

slide-110
SLIDE 110
  • 2. Binary Decision Diagrams

110 2.3 OBDD construction

The computed table is essential for the efficiency of the algorithms: g  In principle, two additional steps of recursion may result at each step

 the number of steps may grow exponentially

in the number of variables  Using the computed table with entries Operation bdd1 bdd2 Result bdd th b f i i d d t | 1|*| 2| h Operation bdd1 bdd2 Result bdd the number of recursions is reduced to |n1|*|n2| where |n1| and |n2| are the number of nodes of bdd1 and bdd2, respectively , p y

slide-111
SLIDE 111
  • 2. Binary Decision Diagrams

111

*

2.3 OBDD construction

1 1 1 1 1 1 1 1 1 1

a b c d e f g      

1 1 1 1

a b c d e f g      

1 1 1 1

g

1 1 1 1 1 1

1

1 1

1

1 1

slide-112
SLIDE 112
  • 2. Binary Decision Diagrams

112

*

2.3 OBDD construction

1 1 1 1 1 1 1 1 1 1

  • * exponential in

the number of variables?

1 1 1 1

  • O(n1*n2) using the

computed table !

1 1 1 1 1 1 1 1 1 1 1 1

*

1

1 1

1

1 1

* &

slide-113
SLIDE 113
  • 2. Binary Decision Diagrams

113 2.3 OBDD construction

General result:  If two OBDD´s with m and n nodes are logically  If two OBDD s with m and n nodes are logically combined then the resulting OBDD has  m*n nodes

 This is due to the fact that not more than

m*n distinct functions are generated!

slide-114
SLIDE 114
  • 2. Binary Decision Diagrams

114 2.3 OBDD construction

Negated edges:  The OBDD of a function f and the OBDD of the  The OBDD of a function f and the OBDD of the negated function are very similar: exchange the terminal nodes 0 and 1!  Orthogonality of negation: negate a function by negating it's cofactors =

Means ti 1

x

1

x =

negation

 Problem: non-canonical representation!

slide-115
SLIDE 115
  • 2. Binary Decision Diagrams

115 2.3 OBDD construction

 Solution: — Only the 0-edge can be a negated edge — 1 terminal leaf only (or the dual version ...) = =

1

x

1

x

1

x

1

x x x = x x =

1 1 1 1

slide-116
SLIDE 116
  • 2. Binary Decision Diagrams

116 2.3 OBDD construction

 Examples: variable and negated variable 1

1 1

1 1

1

1

1 1 1 1 1 1

1 1 1 1 1 1

slide-117
SLIDE 117
  • 2. Binary Decision Diagrams

117 2.3 OBDD construction

 Example: XOR function

1 1

XOR function

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

1

1 1

1

1

slide-118
SLIDE 118
  • 2. Binary Decision Diagrams

118 2.3 OBDD construction

Cofactor calculation using OBDD's

cof(x pol OBDD): x variable pol polarity 1 or 0

cof(x, pol, OBDD): x variable, pol polarity 1 or 0

Easy if variable = top-variable, e.g., cof(a, 0, OBDD):

a 1 b b c 1 c 1 1 1 1 1 1 1

slide-119
SLIDE 119
  • 2. Binary Decision Diagrams

119 2.3 OBDD construction

Generally: Replace pointers to the variable by the pointer to the 1-(0-)successor: ( ) f = c f = ac +abc f = ac

a a

fb = c f ac +abc

a

fb = ac

1 b 1 1 1 c 1 c 1 c 1 1 1 1 1 1 1 1

slide-120
SLIDE 120
  • 2. Binary Decision Diagrams

120 2.3 OBDD construction

— Example: determine the 0-cofactor for variable d:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

1

1 1

1

1 1

slide-121
SLIDE 121
  • 2. Binary Decision Diagrams

121 2.3 OBDD construction

Functional substitution: substitute function g vor variable x  The paper-and-pencil method is: replace all  The paper-and-pencil method is: replace all

  • ccurrences of x textually by g

 How to do that with a OBDD-representation? How to do that with a OBDD representation? f[x g] = gfx + gfx Rationale: fx f = xfx + xfx fx f = gfx + gfx

1

fx

1

fx x g

slide-122
SLIDE 122
  • 2. Binary Decision Diagrams

122 2.3 OBDD construction

Functional substitution: substitute function g vor variable x f[x g] = gfx + gfx Note:  x : (f(x  g)) = [fx(0  g)] + [fx(1  g)] = fxg + fxg = f[x g] f[x g]

 Functional substitution can be reduced to the

application of the  -operator

slide-123
SLIDE 123
  • 2. Binary Decision Diagrams

123 2.3 OBDD construction

 Using Boolean operations plus cofactor-calculation

more advanced Boolean operations like the - and -quantifier and functional substitutions can be implemented implemented

slide-124
SLIDE 124
  • 2. Binary Decision Diagrams

124 2.3 OBDD construction

OBDD´s are used in many CAD-tools for synthesis, verification and simulation

Many public domain OBDD-packages

Many are based on the ite(p, f, g)-operator (if p then f else g) Many are based on the ite(p, f, g) operator (if p then f else g)

CUDD package (Boulder Univ.)

 OBDD are very efficient decision procedures for

propositional calculus and are integrated into propositional calculus, and are integrated into many theorem provers like PVS and ACL2

slide-125
SLIDE 125
  • 2. Binary Decision Diagrams

125

2.4 FDD's and OKFDD's 2.4 FDD s and OKFDD s

OBDD's are based on Boole's expansion theorem

OBDD's represent the systematic decomposition in all variables variables

Q: Are there other types of "decomposition"? How many?

slide-126
SLIDE 126
  • 2. Binary Decision Diagrams

126 2.4 FDD's and OKFDD's

Boole' expansion:

f x f x f 

There are more types of expansion (exactly two more):

x x

f x f x f    

 Positive Davio-expansion

) f f ( x f f    

 Negative Davio-expansion

) f f ( x f f

x x x

  

 Negative Davio expansion

) f f ( x f f

x x x

   

slide-127
SLIDE 127
  • 2. Binary Decision Diagrams

127 2.4 FDD's and OKFDD's

FDD´s (Functional Decision Diagrams, Kebschull et al. 92)  f = f  x*(f  f )  f = fx  x (fx  fx) — for x = 0  fx for x = 1  f  f  f = f — for x = 1  fx  fx  fx = fx  Same graph structure, but different interpretation: f x Boolean difference

  • f f w.r.t. x

1 fx (fx  fx)

slide-128
SLIDE 128
  • 2. Binary Decision Diagrams

128 2.4 FDD's and OKFDD's

FDD´s (Functional Decision Diagrams, Kebschull et al. 92)  f = f  x*(f  f )  f = fx  x (fx  fx) — for x = 0  fx for x = 1  f  f  f = f — for x = 1  fx  fx  fx = fx  Same graph structure, but different interpretation: f Rule: x Rule: variable = 1  XOR both branches t t th l f f 1 to get the value of f fx (fx  fx)

slide-129
SLIDE 129
  • 2. Binary Decision Diagrams

129 2.4 FDD's and OKFDD's

FDD´s are canonical representations

FDD's obey a different rule of reduction:

FDD s obey a different rule of reduction: f f x 1 1 fx fx (fx  fx) : if the Boolean difference is 0 then f does not depend on x

slide-130
SLIDE 130
  • 2. Binary Decision Diagrams

130 2.4 FDD's and OKFDD's

Orthogonality of XOR and AND for FDD´s:  f  g = f  x*(f  f )  g  x*(g  g ) =  f  g = fx  x (fx  fx)  gx  x (gx  gx) = (fx  gx )  x*[(fx  fx)  (gx  gx)] Yes!  f  g = (fx  x*(fx  fx))  (gx  x*(gx  gx)) = (fx*gx)  x*[fx * (gx  gx)  (fx  fx ) *gx  (f  f )*(g  g )] No! (fx  fx)*(gx  gx)]

 All 4 combinations have to be considered

No!

 All 4 combinations have to be considered

for the AND of 2 FDD's

slide-131
SLIDE 131
  • 2. Binary Decision Diagrams

131 2.4 FDD's and OKFDD's

OBDD and FDD for 4-bit adder

slide-132
SLIDE 132
  • 2. Binary Decision Diagrams

132 2.4 FDD's and OKFDD's

OKFDD´s (Ordered Kronecker FDD´s, Drechsler et al. 94)  Allows any of the three types of decomposition for  Allows any of the three types of decomposition for each variable  The type of decomposition is stored in a decomposition type list (DTL) f = a*[(0c*(01)) b*((0c*(01))1)] + a*[0c*(01)] B l a*[0c*(01)] = a*(cbc) + a*c

f f f

a 1 b Boole p Davio

x x

f x f x f     ) f f ( x f f    

0 b 1 p.Davio 1 c p Davio

) f f ( x f f

x x x

    ) f f ( x f f

x x x

   

1 1 p.Davio

) (

x x x

DTL

slide-133
SLIDE 133
  • 2. Binary Decision Diagrams

133 2.4 FDD's and OKFDD's

OBDD's/FDD's/OKFDD'S in comparison  OKFDD´s have OBDD´s and FDD´s as subclasses  OKFDD s have OBDD s and FDD s as subclasses  OBDD´s: AND OR XOR of two OBDD´s of size n and m — AND, OR, XOR of two OBDD s of size n and m requires max. n*m operations  FDD´s/OKFDD´s:  FDD s/OKFDD s: — XOR requires max. n*m, but AND and OR may need exponentially many operations! y y

 However: #nodes of FDD/OKFDD may be

exponentially smaller than #nodes of the OBDD ( d i ) OBDD (and vice versa)

 Important for logic synthesis

 OKFDD´ d t i i th d iti t li t  OKFDD´s: determining the decomposition-type list (DTL) is an additional problem

slide-134
SLIDE 134
  • 2. Binary Decision Diagrams

134 2.4 FDD's and OKFDD's

The OBDD size grows only linearly in #variables for many circuits (AND, OR, XOR, adders, ALU's, etc.) y ( , , , , , )

Can all circuits be represented with linear (or polynomial) effort?

The theoretical answer is that there will never be any representation with this nice property for all circuits

While the OBDD's are very compact representations for many classes of circuits they fail for others ...

slide-135
SLIDE 135
  • 2. Binary Decision Diagrams

135 2.4 FDD's and OKFDD's

Example: multiplier circuits

A0 A1 A2 A3 B0 B1 B2 B3 P7 P6 P5 P4 P3 P2 P1 P0

Word length : 4 6 8

 Interest in other types of decision diagrams

Word length : 4 6 8 #OBDD nodes : 150 2.183 10.766

slide-136
SLIDE 136
  • 2. Binary Decision Diagrams

136

2.5 Integer-Valued Decision Diagrams

So far type Bn  Bm now: type Bn  Z: 2.5 Integer Valued Decision Diagrams

So far type Bn  Bm, now: type Bn  Z:  MTBDD´s (Multi Terminal Binary Decision Diagrams, Clarke et al. DAC ´93) Clarke et al. DAC 93)  BMD´s (Binary Moment Diagrams, Bryant/Chen DAC ´ 95) a 1 a rule: a 1 a 1 rule: variable = 1  sum both branches b b 1 1 b 1 1 4 5 1 4 4a + b MTBDD 4a + b BMD

slide-137
SLIDE 137
  • 2. Binary Decision Diagrams

137 2.5 Integer-valued decision diagrams

 MTBDD: f = (1 - x)*fx + x*fx h * th dditi bt ti d where +, -, * are the addition, subtraction and multiplication, respectively  BMD:  BMD: f = fx + x*(fx - fx)  HDD´s (Clarke/Zhao): combination of MTBDD/BMD, one decomposition types for each variable ( OKFDD´s) decomposition types for each variable (~ OKFDD s)

slide-138
SLIDE 138
  • 2. Binary Decision Diagrams

138 2.5 Integer-valued decision diagrams

Example of application (Fujita et a. ´96):  Vector matrix operations employing MTBDD´s  Vector-matrix operations employing MTBDD s  Idea: encode rows and columns by means of boolean — encode rows and columns by means of boolean variables — elements ~ leafs elements leafs  Example 2*2 Matrix: fxy fxy x y

1

11 11 fxy fxy y

1

43 3 11 43 3

slide-139
SLIDE 139
  • 2. Binary Decision Diagrams

139 2.5 Integer-valued decision diagrams

Type Bn  Z and attributed edges  EVBDD´s (Edge Valued Binary Decision Diagrams  EVBDD s (Edge Valued Binary Decision Diagrams, Lai et al. ICCAD ´93)  *BMD´s (Multiplicative Binary Moment Diagrams, BMD s (Multiplicative Binary Moment Diagrams, Bryant/ Chen DAC ´95) a a rule: rule: a 1 a 1 rule: variable = 1 => add both branches, lti l b i ht 2 4 rule: add weight b b 1 multiply by weight 1 2 1 4 4a + 2b EVBDD 4a + 2b *BMD

slide-140
SLIDE 140
  • 2. Binary Decision Diagrams

140 2.5 Integer-valued decision diagrams

 EVBDD: f = a + (1 - x)*fx + x*fx h + * th dditi bt ti d where +, -, * are the addition, subtraction and multiplication, respectively  *BMD:  BMD: f = m*(fx + x*(fx - fx))  K*BMD´s (Drechsler EDTC´96): one decomposition type for each variable (~ OKFDD´s HDD´s) additive + type for each variable (~ OKFDD s, HDD s), additive + multiplicative weights  *PHDD (Chen/Bryant ICCAD´97): multiplicative power  PHDD (Chen/Bryant ICCAD 97): multiplicative power hybrid decision diagrams for floating-point circuits

slide-141
SLIDE 141
  • 2. Binary Decision Diagrams

141 2.5 Integer-valued decision diagrams

For *BMD´s we have for an edge without weight: f = fx + x*(fx - fx) = fx + x*fx

. 

*BMD´s are canonical representations provided that:  1. Rule: f f f x

1

w w fx fx fx fx

.

fx

slide-142
SLIDE 142
  • 2. Binary Decision Diagrams

142 2.5 Integer-valued decision diagrams

 2. Rule: the weight on an edge equals the gcd of the weights of the successor edges weights of the successor edges f f f t x

1

x

1 1

w0 w1

1

w0/t w1/t fx

.

fx

.

fx fx

 a leave "n" is a 1 node with weight n

slide-143
SLIDE 143
  • 2. Binary Decision Diagrams

143 2.5 Integer-valued decision diagrams

— Example: *BMD for f = 4*x + 2 f = f + x*(f - f ) f = fx + x (fx - fx) = 2 + x*(6 - 2), gcd(2, 4) = 2 f f 2 x x

1

1 1

1

1 1 2 4 1 2

slide-144
SLIDE 144
  • 2. Binary Decision Diagrams

144 2.5 Integer-valued decision diagrams

— Next example: *BMD for f = 3*y + 4*x + 2 f = fy + y*(fy - fy)

y

y ( y

y)

= (4*x + 2) + y*((4*x + 5) - (4*x + 2)) = (4*x + 2) + y*3 f y 2

1

x

1

1 2 3

slide-145
SLIDE 145
  • 2. Binary Decision Diagrams

145 2.5 Integer-valued decision diagrams

 3. Rule: sign of t is sign of left branch f f f t x

1

x

1 1

w0 w1

1

w0/t w1/t fx

.

fx

.

fx fx

slide-146
SLIDE 146
  • 2. Binary Decision Diagrams

146 2.5 Integer-valued decision diagrams

For *BMD´s with range {0, 1}, the boolean operations can be reduced to integer addition, subtraction and g , multiplication: f 1 f f 1 - f f and g f*g f or g f + g - f*g f xor g f + g - 2*f*g

slide-147
SLIDE 147
  • 2. Binary Decision Diagrams

147 2.5 Integer-valued decision diagrams

Some example *BMD´s:  4 variable AND (a boolean function)  4 variable AND (a boolean function)

1

x1

1

x1

1

x2

1

x2

1

x3

1

x3

3

x

1

3

x

1

x4

1

x4

1

1 OBDD 1 *BMD

slide-148
SLIDE 148
  • 2. Binary Decision Diagrams

148 2.5 Integer-valued decision diagrams

 4 variable OR (a boolean function) x1 x1

1 1

x2 x2 x2

1

  • 1

1 1

x3 x3 x3

1

  • 1

1 1

x4

1

x4 x4

1 1

x4

1 1

1 OBDD *BMD 1

  • 1
slide-149
SLIDE 149
  • 2. Binary Decision Diagrams

149 2.5 Integer-valued decision diagrams

 4 variable OR (a boolean function) x4= 0, x3 = 0, x2 = 1, x1 = 0 1 x1

1

x1

1

x2 x2 x2

1

  • 1

1

1

1

x3 x3 x3

  • 1

1

1

1

x4

1

x4 x4

1

1

1

1

1

x4 x4 x4

1 1

1 1 OBDD *BMD 1

  • 1
slide-150
SLIDE 150
  • 2. Binary Decision Diagrams

150 2.5 Integer-valued decision diagrams

 Example: 2-Bit multiplication x *(y *21 +y *20)+ x x y y

1

x0 2 x0*(y1*21 +y0*20)+ 2*x1*(y1*21 +y0*20) Result: x1 , x0 y1 , y0 x1

1

x *(y *21 +y *20) (x1*21 +x0*20)*(y1*21 +y0*20) = 20*x *(y *21 +y *20)+ y0

1

x1*(y1*21 +y0*20) 2 x0 (y1 2 +y0 2 )+ 21*x1*(y1*21 +y0*20) y

1

2 y1*21 +y0*20 y1

1

1

slide-151
SLIDE 151
  • 2. Binary Decision Diagrams

151 2.5 Integer-valued decision diagrams

Classification schema of decision diagrams (based on Minato ´96): a

1

a

1 1 1

Shannon p Davio decomposition mixed FDD OBDD Shannon

  • p. Davio

Bn  B p type: mixed OKFDD O  O BMD MTBDD Bn  Z HDD Bn  Z, tt ib t d *BMD EVBDD attributed edges K*BMD

slide-152
SLIDE 152
  • 2. Binary Decision Diagrams

152

2.6 Bit-Vector Expressions Bit t 2.6 Bit Vector Expressions

Bit-vectors:  Used for the compact representation of complex digital hardware digital hardware  More adequate than single bits in many cases Examples: data paths arithmetic circuits — Examples: data-paths, arithmetic circuits, register-transfer-level (rtl) descriptions, storage elements, ...  Provided by many hardware description languages (HDL's) as a basic data-type

slide-153
SLIDE 153
  • 2. Binary Decision Diagrams

153 2.6 Bit-vector expressions

— Example: specification of 74181 ALU Generic bit-vector function "A PLUS B"

S3 S2 S1 S0 M = H M = L Cn = H M = L Cn = L L L L L F = not(A) F = A F = A PLUS 1 L L L H L L H L L L H H L H L L L H L H F = not(A+B) F = not(A) B F = 0 F = not(A B) F (B) F = A + B F = A + not(B) F = MINUS 1 F = A PLUS A not(B) F (A B) PLUS A (B) F = (A + B) PLUS 1 F = (A + not(B)) PLUS 1 F = 0 F = A PLUS A not(B) PLUS 1 F (A B) PLUS AB PLUS 1 L H L H L H H L L H H H H L L L H L L H F = not(B) F = A  B F = A not(B) F = not(A)+B F t(AB) F = (A + B) PLUS A not(B) F = A MINUS B MINUS 1 F = A not(B) MINUS 1 F = A PLUS AB F = A PLUS B F = (A + B) PLUS AB PLUS 1 F = A MINUS B F = A not(B) F = A PLUS AB PLUS 1 F = A PLUS B PLUS 1 H L L H H L H L H L H H H H L L H H L H F = not(AB) F = B F = A B F = 1 F = A + not(B) F = A PLUS B F = (A + not(B)) PLUS AB F = A B MINUS 1 F = A PLUS A F = (A + B) PLUS A F = A PLUS B PLUS 1 F = (A + not(B)) PLUS AB PLUS 1 F = AB F = A PLUS A PLUS F = (A + B) PLUS A PLUS 1 H H L H H H H L H H H H F = A + not(B) F = A + B F = A F (A + B) PLUS A F = (A + not(B)) PLUS A F = A MINUS 1 F (A + B) PLUS A PLUS 1 F = (A + not(B)) PLUS A PLUS 1 F = A

slide-154
SLIDE 154
  • 2. Binary Decision Diagrams

154 2.6 Bit-vector expressions

Bit-vector functions are necessary for input/output specifications, i.e., for the abstraction from internal p , , details I/O- Specification Specification

3

S S

& 1 & & & & 1 & & 1 & 1 & & & & & & & & 1 =1

2 1 2 3 n+4

D E Q B A G c P F S S S

3 3 2

E

3

D B

3 3

=1 =1 & 1 & & & & 1 & & & & 1 & 1 & & & 1 & & & & & 1 =1

1 1 2

F A=B F A

2

E

1 1

B A D E D B

2 1 2 1

Q Q

=1 =1 =1 1 & & & &

n

M c F E A 0 Q

=1 =1

slide-155
SLIDE 155
  • 2. Binary Decision Diagrams

155 2.6 Bit-vector expressions

Typical bit-vector functions: Function Meaning Example: Function FAE(A,N) ADC(A B C) Meaning fan-out dditi Example: FAE(1,3)="111" ADC(A,B,C) ADD(A,B) INC(A) addition addition modulo increment ADC("11","01",´1´)="101" ADD("11","01")="00" INC("111")="000" INC(A) DCR(A) RSH(C,V) LSH(V C) decrement rigth-shift left shift INC( 111 ) 000 DCR("111")="110" RSH(´0´,"111")="011" LSH("111" ´0´) "110" LSH(V,C) ROL(A) ROR(A) left-shift rotate left rotate right LSH("111", 0 )="110" ROL("001")="010" ROR("010")="001" ( ) MPX1(A,S) MINT(A,N) multiplexor 1. Dim. minterm ( ) MPX1("0010","10")=´1´ MINT(A(1:2),0)= (not A(1)) and (not A(2)) GT(A,B) LESS(A,B) A greater B A less B (not A(1)) and (not A(2)) GT("100","010")=1 LESS("100","010")=0

slide-156
SLIDE 156
  • 2. Binary Decision Diagrams

156 2.6 Bit-vector expressions

Bit-vectors in VHDL  Type bit vector predefined  Type bit_vector predefined signal X: bit_vector (1 to 16) or: (16 downto 1)  Selection of single elements X(4) or slices Selection of single elements X(4) or slices X(2 to 4)  Constant-denotation (B)"1001"  Assignments X(2 to 4) <= X(8 to 10)  Overloaded boolean primitives, e.g., g "0101" AND "0011" = "0001"  Concatenation &, e.g., X(2 to 4)&X(5 to 7) = X(2 to 7)  ...

slide-157
SLIDE 157
  • 2. Binary Decision Diagrams

157 2.6 Bit-vector expressions

Verification problems:  How to demonstrate the equality of arbitrary bit-  How to demonstrate the equality of arbitrary bit- vector expressions?  Do we have to reason formally about tuples, etc.? Do we have to reason formally about tuples, etc.?

slide-158
SLIDE 158
  • 2. Binary Decision Diagrams

158 2.6 Bit-vector expressions

Decision procedure: procedure to decide the truth of a statement in some domain

For generic expressions (may contain expressions of arbitrary length), inductive reasoning is typically used  Example: prove ADD(A, B) = ADD(B, A) for arbitrary vectors A and B of the same length  Typically a theorem prover is employed — You have to derive the proof in large part by lf yourself — The theorem prover checks if the proof is correct

 N t

t t d d i t ti

 Not automated, needs user interaction

slide-159
SLIDE 159
  • 2. Binary Decision Diagrams

159 2.6 Bit-vector expressions

For fixed-length expressions, the problem becomes much simpler p  Example: prove ADD(A, B) = ADD(B, A) for 32-bit vectors A and B

Several decision procedures exist:  The problem can be reduced to OBDD's  The problem can be reduced to an integer-linear programming (ILP) problem  A specific decision procedure was given by Cyrluk et

  • al. (CAV´97) for a restricted repertoire of bit-vector

functions functions

slide-160
SLIDE 160
  • 2. Binary Decision Diagrams

160 2.6 Bit-vector expressions

Reduction to OBDD's ("bit-blasting"):  Translate expression using bit-vector-functions into  Translate expression using bit-vector-functions into multi-level gate-networks — e.g., A PLUS B, where A and B are two 4-bit e.g., A PLUS B, where A and B are two 4 bit vectors, is transformed into the gate-network of a four-bit adder  Then as before ! vector expression 1 gate network 1 OBDD 1 ? vector expression 2 gate network 2 OBDD 2 = ? expression 2 network 2

slide-161
SLIDE 161
  • 2. Binary Decision Diagrams

161 2.6 Bit-vector expressions

Technique offers the general possibility to carry out proofs involving complex bit-vector expressions p g p p  Examples: ADD(A, B) = ADD(B, A) (ADD(A, B) > ADD(B, C))  (A>C) (A>B) = NOT(ADD(0&A, 1&NOT(B))(1)) where A B C have fixed length by declaration where A, B, C have fixed length by declaration  Typically takes < 1 sec. for 64-bit vectors

slide-162
SLIDE 162
  • 2. Binary Decision Diagrams

162 2.6 Bit-vector expressions

A > B = NOT (ADD(0&A, 1&NOT(B)))(1) B N N A N ´0´ ´1´ N N A B N > N+1 ADD 1 N+1 1 N 8 16 32 64 128 CPU-time N 0.5 8 0.6 16 0.7 32 1.1 64 1.8 128

slide-163
SLIDE 163
  • 2. Binary Decision Diagrams

163 2.6 Bit-vector expressions

Example: verification of ALU´s  Verification of VHDL-specification using bit-  Verification of VHDL-specification using bit- vector-operations vs. network of standard-cells CPU-time Wordlength 1.0 4 1.5 8 2.8 16 6.6 32  32-Bit ALU: 2 * 32 boolean functions in up to 77 CPU time 1.0 1.5 2.8 6.6 variables

slide-164
SLIDE 164
  • 2. Binary Decision Diagrams

164 2.6 Bit-vector expressions

Some references:  Hassoun/Sasao (Eds ): Logic Synthesis and  Hassoun/Sasao (Eds.): Logic Synthesis and Verification, Springer — Book-Chapters on BDD's, SAT, Equivalence Book Chapters on BDD s, SAT, Equivalence checking  Hachtel/Somenzi: Logic Synthesis and Verification Algorithms, Springer

slide-165
SLIDE 165
  • 2. Binary Decision Diagrams

165 2.6 Bit-vector expressions

Written exam in the summer  between 18 Juli and 7 October 2011  between 18. Juli and 7. October 2011  please follow Doodle link http://www.doodle.com/y4igrfy6wcrmx24h http://www.doodle.com/y4igrfy6wcrmx24h