binary decision diagramscse.iitm.ac.in/~manas/docs/bdds.pdf · a binary decision diagram is a...

49
Binary Decision Diagrams An Introduction and Some Applications Manas Thakur PACE Lab, IIT Madras Manas Thakur (IIT Madras) BDDs 1 / 25

Upload: others

Post on 15-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Binary Decision Diagrams

An Introduction and Some Applications

Manas Thakur

PACE Lab, IIT Madras

Manas Thakur (IIT Madras) BDDs 1 / 25

Page 2: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Motivating Example

Binary decision tree for a truth table

Manas Thakur (IIT Madras) BDDs 2 / 25

Page 3: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Motivating Example

Binary decision tree for a truth table

Manas Thakur (IIT Madras) BDDs 3 / 25

Page 4: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Motivating Example

Collapse redundant nodes

Manas Thakur (IIT Madras) BDDs 4 / 25

Page 5: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Motivating Example

Collapse redundant nodes

Manas Thakur (IIT Madras) BDDs 5 / 25

Page 6: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Motivating Example

Collapse redundant nodes

Manas Thakur (IIT Madras) BDDs 6 / 25

Page 7: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Motivating Example

Collapse redundant nodes

Manas Thakur (IIT Madras) BDDs 7 / 25

Page 8: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Motivating Example

Eliminate unnecessary nodes

Manas Thakur (IIT Madras) BDDs 8 / 25

Page 9: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Motivating Example

We got an ROBDD!!

Manas Thakur (IIT Madras) BDDs 9 / 25

Page 10: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Introduction

Overview

1 Motivating Example

2 Introduction

3 Constructing ROBDDs

4 Applications

5 Conclusion

Manas Thakur (IIT Madras) BDDs 10 / 25

Page 11: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Introduction

Binary Decision Diagrams

Definition

A Binary Decision Diagram is a rooted DAG with

One or two terminal nodes of out-degree zero labeled 0 or 1

A set of variable nodes of out-degree two

Manas Thakur (IIT Madras) BDDs 11 / 25

Page 12: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Introduction

Ordered Binary Decision Diagrams (OBDDs)

A BDD is ordered if on all paths through the graph, the variablesrespect a given linear order.

b1 < b2 < ... < bn

An unordered BDD

Manas Thakur (IIT Madras) BDDs 12 / 25

Page 13: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Introduction

Ordered Binary Decision Diagrams (OBDDs)

A BDD is ordered if on all paths through the graph, the variablesrespect a given linear order.

b1 < b2 < ... < bn

An unordered BDD

Manas Thakur (IIT Madras) BDDs 12 / 25

Page 14: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Introduction

Ordered Binary Decision Diagrams (OBDDs)

The size of a BDD depends on the variable ordering

The problem of finding the best variable ordering in OBDDs isNP-Complete

Manas Thakur (IIT Madras) BDDs 13 / 25

Page 15: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Introduction

Reduced Ordered Binary Decision Diagrams (ROBDDs)

Definition

An OBDD is reduced if it satisfies the following properties:

Uniqueness

low(u) = low(v) and high(u) = high(v) implies u = v

Non-redundant tests

low(u) 6= high(u)

We already saw an example of ROBDDs!! See it again

Manas Thakur (IIT Madras) BDDs 14 / 25

Page 16: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Introduction

Properties of ROBDDs

Size is correlated to amount of redundancy, NOT size of relation

Insight: As the relation gets larger, the number of dont-care bitsincreases, leading to fewer necessary nodes (usually)

Canonicity: For every Boolean function, there is exactly one ROBDDrepresenting it

Hence, satisfiability, tautology-check, and equivalence can be tested indeterministic timeFor Boolean expressions, this problem is NP-Complete

Manas Thakur (IIT Madras) BDDs 15 / 25

Page 17: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Normal forms for Boolean expressions

Disjunctive Normal Form (DNF)

(a1 ∧ a2 ∧ ... ∧ an) ∨ ... ∨ (a1 ∧ a2 ∧ ... ∧ an)Satisfiability: easy; Tautology check: hard

Conjunctive Normal Form (CNF)

(a1 ∨ a2 ∨ ... ∨ an) ∧ ... ∧ (a1 ∨ a2 ∨ ... ∨ an)Tautology check: easy; Satisfiability: hard

Reduction?

No hopes since conversion between CNF and DNF is exponential

Manas Thakur (IIT Madras) BDDs 16 / 25

Page 18: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Normal forms for Boolean expressions

Disjunctive Normal Form (DNF)

(a1 ∧ a2 ∧ ... ∧ an) ∨ ... ∨ (a1 ∧ a2 ∧ ... ∧ an)Satisfiability: easy; Tautology check: hard

Conjunctive Normal Form (CNF)

(a1 ∨ a2 ∨ ... ∨ an) ∧ ... ∧ (a1 ∨ a2 ∨ ... ∨ an)Tautology check: easy; Satisfiability: hard

Reduction?

No hopes since conversion between CNF and DNF is exponential

Manas Thakur (IIT Madras) BDDs 16 / 25

Page 19: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Normal forms for Boolean expressions

Disjunctive Normal Form (DNF)

(a1 ∧ a2 ∧ ... ∧ an) ∨ ... ∨ (a1 ∧ a2 ∧ ... ∧ an)Satisfiability: easy; Tautology check: hard

Conjunctive Normal Form (CNF)

(a1 ∨ a2 ∨ ... ∨ an) ∧ ... ∧ (a1 ∨ a2 ∨ ... ∨ an)Tautology check: easy; Satisfiability: hard

Reduction?

No hopes since conversion between CNF and DNF is exponential

Manas Thakur (IIT Madras) BDDs 16 / 25

Page 20: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Normal forms for Boolean expressions

Disjunctive Normal Form (DNF)

(a1 ∧ a2 ∧ ... ∧ an) ∨ ... ∨ (a1 ∧ a2 ∧ ... ∧ an)Satisfiability: easy; Tautology check: hard

Conjunctive Normal Form (CNF)

(a1 ∨ a2 ∨ ... ∨ an) ∧ ... ∧ (a1 ∨ a2 ∨ ... ∨ an)Tautology check: easy; Satisfiability: hard

Reduction?

No hopes since conversion between CNF and DNF is exponential

Manas Thakur (IIT Madras) BDDs 16 / 25

Page 21: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

If-then-else Normal Form (INF)

An If-then-else Normal Form (INF) is a Boolean expression built fromthe if-then-else operator and the constants 0 and 1, such that all testsare performed only on variables.

x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1)

More examples

x = x → (1, 0)¬x = (x → 0, 1)

x ∨ y = (x → 1, y)x ∧ y = (x → y , 1)

x ⇔ y = x → (y → 1, 0), (y → 0, 1)

Manas Thakur (IIT Madras) BDDs 17 / 25

Page 22: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

If-then-else Normal Form (INF)

An If-then-else Normal Form (INF) is a Boolean expression built fromthe if-then-else operator and the constants 0 and 1, such that all testsare performed only on variables.

x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1)

More examples

x = x → (1, 0)

¬x = (x → 0, 1)x ∨ y = (x → 1, y)x ∧ y = (x → y , 1)

x ⇔ y = x → (y → 1, 0), (y → 0, 1)

Manas Thakur (IIT Madras) BDDs 17 / 25

Page 23: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

If-then-else Normal Form (INF)

An If-then-else Normal Form (INF) is a Boolean expression built fromthe if-then-else operator and the constants 0 and 1, such that all testsare performed only on variables.

x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1)

More examples

x = x → (1, 0)¬x = (x → 0, 1)

x ∨ y = (x → 1, y)x ∧ y = (x → y , 1)

x ⇔ y = x → (y → 1, 0), (y → 0, 1)

Manas Thakur (IIT Madras) BDDs 17 / 25

Page 24: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

If-then-else Normal Form (INF)

An If-then-else Normal Form (INF) is a Boolean expression built fromthe if-then-else operator and the constants 0 and 1, such that all testsare performed only on variables.

x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1)

More examples

x = x → (1, 0)¬x = (x → 0, 1)

x ∨ y = (x → 1, y)

x ∧ y = (x → y , 1)x ⇔ y = x → (y → 1, 0), (y → 0, 1)

Manas Thakur (IIT Madras) BDDs 17 / 25

Page 25: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

If-then-else Normal Form (INF)

An If-then-else Normal Form (INF) is a Boolean expression built fromthe if-then-else operator and the constants 0 and 1, such that all testsare performed only on variables.

x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1)

More examples

x = x → (1, 0)¬x = (x → 0, 1)

x ∨ y = (x → 1, y)x ∧ y = (x → y , 1)

x ⇔ y = x → (y → 1, 0), (y → 0, 1)

Manas Thakur (IIT Madras) BDDs 17 / 25

Page 26: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

If-then-else Normal Form (INF)

An If-then-else Normal Form (INF) is a Boolean expression built fromthe if-then-else operator and the constants 0 and 1, such that all testsare performed only on variables.

x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1)

More examples

x = x → (1, 0)¬x = (x → 0, 1)

x ∨ y = (x → 1, y)x ∧ y = (x → y , 1)

x ⇔ y = x → (y → 1, 0), (y → 0, 1)

Manas Thakur (IIT Madras) BDDs 17 / 25

Page 27: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0

t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 28: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00

t1 = y1 → t11, 0t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 29: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 30: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000

t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 31: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110

t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 32: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1

t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 33: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0

t110 = y2 → 0, 1t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 34: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1

t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 35: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 36: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 18 / 25

Page 37: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t00, 0

t00 = x2 → t001, t000t000 = y2 → 0, 1t001 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 19 / 25

Page 38: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Constructing ROBDDs

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2)

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t11, 0

t00 = x2 → t001, t000t11 = x2 → t111, t110t000 = y2 → 0, 1t001 = y2 → 1, 0t110 = y2 → 0, 1t111 = y2 → 1, 0

t = x1 → t1, t0t0 = y1 → 0, t00t1 = y1 → t00, 0

t00 = x2 → t001, t000t000 = y2 → 0, 1t001 = y2 → 1, 0

Manas Thakur (IIT Madras) BDDs 19 / 25

Page 39: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Applications

Let’s move ahead

1 Motivating Example

2 Introduction

3 Constructing ROBDDs

4 Applications

5 Conclusion

Manas Thakur (IIT Madras) BDDs 20 / 25

Page 40: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Applications

Applications of BDDs

Correctness of Combinational Circuits

Equivalence of Combinational Circuits

Model Checking

And yes, Program Analysis!

Manas Thakur (IIT Madras) BDDs 21 / 25

Page 41: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Applications

BDDs for representing Points-to relation

Points-to analysis using BDDs. Berndl et al. PLDI’03.

Let a,b,c be reference variables and A,B,C be object references.

The points-to relation (a,A),(a,B),(b,A),(b,B),(c,A),(c,B),(c,C) isrepresented as:

On the board.

Manas Thakur (IIT Madras) BDDs 22 / 25

Page 42: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Applications

BDDs for representing Points-to relation

Points-to analysis using BDDs. Berndl et al. PLDI’03.

Let a,b,c be reference variables and A,B,C be object references.

The points-to relation (a,A),(a,B),(b,A),(b,B),(c,A),(c,B),(c,C) isrepresented as:

On the board.

Manas Thakur (IIT Madras) BDDs 22 / 25

Page 43: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Applications

bddbddb

Cloning-Based Context-Sensitive Pointer Alias Analysis Using BinaryDecision Diagrams. John Whaley and Monica S. Lam. PLDI’04.

On the Board

1 Represent program information using relationsExpress relations as BDDs

2 Write program analyses as Datalog queriesExpress queries as BDD operations

3 Get solutions!Perform operations on BDDs

Manas Thakur (IIT Madras) BDDs 23 / 25

Page 44: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Applications

bddbddb

Cloning-Based Context-Sensitive Pointer Alias Analysis Using BinaryDecision Diagrams. John Whaley and Monica S. Lam. PLDI’04.

On the Board

1 Represent program information using relationsExpress relations as BDDs

2 Write program analyses as Datalog queriesExpress queries as BDD operations

3 Get solutions!Perform operations on BDDs

Manas Thakur (IIT Madras) BDDs 23 / 25

Page 45: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Applications

bddbddb

Cloning-Based Context-Sensitive Pointer Alias Analysis Using BinaryDecision Diagrams. John Whaley and Monica S. Lam. PLDI’04.

On the Board

1 Represent program information using relationsExpress relations as BDDs

2 Write program analyses as Datalog queriesExpress queries as BDD operations

3 Get solutions!Perform operations on BDDs

Manas Thakur (IIT Madras) BDDs 23 / 25

Page 46: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Applications

bddbddb

Cloning-Based Context-Sensitive Pointer Alias Analysis Using BinaryDecision Diagrams. John Whaley and Monica S. Lam. PLDI’04.

On the Board

1 Represent program information using relationsExpress relations as BDDs

2 Write program analyses as Datalog queriesExpress queries as BDD operations

3 Get solutions!Perform operations on BDDs

Manas Thakur (IIT Madras) BDDs 23 / 25

Page 47: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Applications

Pointers for the enthusiast

An Introduction to Binary Decision Diagrams. Tutorial by Henrik ReifAndersen.

Program Analysis using Binary Decision Diagrams. Ondrej Lhotak’sPhD Thesis (2006).

Context-Sensitive Pointer Analysis using Binary Decision Diagrams.John Whaley’s PhD Thesis (2007).

Fun with Binary Decision Diagrams. Video lecture by Donald Knuth.

Manas Thakur (IIT Madras) BDDs 24 / 25

Page 48: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Conclusion

Conclusion

BDDs are very interesting anduseful!

Manas Thakur (IIT Madras) BDDs 25 / 25

Page 49: Binary Decision Diagramscse.iitm.ac.in/~manas/docs/BDDs.pdf · A Binary Decision Diagram is a rooted DAG with One or two terminal nodes of out-degree zero labeled 0 or 1 A set of

Conclusion

Conclusion

BDDs are very interesting anduseful!

Manas Thakur (IIT Madras) BDDs 25 / 25