0% found this document useful (0 votes)
30 views27 pages

Formal Equivalence Checking - II: Virendra Singh

This document summarizes a lecture on formal equivalence checking and Boolean satisfiability (SAT) solving. It introduces binary decision diagrams (BDDs) as a canonical representation for Boolean functions, and describes how operations like restriction, conjunction, and disjunction can be performed on BDDs efficiently. It then discusses SAT solving techniques like the Davis–Putnam–Logemann–Loveland (DPLL) algorithm and conflict-driven clause learning, and how modern SAT solvers implement efficient Boolean constraint propagation and dynamic variable ordering heuristics.

Uploaded by

Darwin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views27 pages

Formal Equivalence Checking - II: Virendra Singh

This document summarizes a lecture on formal equivalence checking and Boolean satisfiability (SAT) solving. It introduces binary decision diagrams (BDDs) as a canonical representation for Boolean functions, and describes how operations like restriction, conjunction, and disjunction can be performed on BDDs efficiently. It then discusses SAT solving techniques like the Davis–Putnam–Logemann–Loveland (DPLL) algorithm and conflict-driven clause learning, and how modern SAT solvers implement efficient Boolean constraint propagation and dynamic variable ordering heuristics.

Uploaded by

Darwin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Formal Equivalence

Checking - II
Virendra Singh

Associate Professor
Computer Architecture and Dependable Systems Lab
Dept. of Electrical Engineering
Indian Institute of Technology Bombay, Mumbai
[email protected]

EE 709: Testing & Verification of VLSI Circuits


Lecture 7 (Jan 18, 2012)

Formal Equivalence Checking


BDD is canonical form of representation
Shannons expansion theorem
f(x1, x2, .xi, xn) =
xi.f(x1, x2, ,xi=1, xn) +

xi. f(x1, x2, ,xi=0, xn)


xi
f(x1, x2, ,xi=0, xn)
Jan 18, 2012

f(x1, x2, ,xi=1, xn)


EE-709@IITB

Example OBDD
Initial Graph

Reduced Graph
x1

x1
x2
x3
0

x2

x2
x3

x3
1

x3

x3
1

(x1+x2) x3

Canonical representation of Boolean function


For given variable ordering
Two functions equivalent if and only if graphs isomorphic
o Can be tested in linear time
Desirable property: simplest form is canonical.
Jan 18, 2012

EE-709@IITB

Effect of Variable Ordering


(a b ) (a b ) (a b )
1 1
2 2
3 3
Good Ordering
Bad Ordering
a1

a1
b1

a2

a2

a3

a2
a3

a3

b2

b1 b1 b1 b1

a3

b2 b2
b3

b3
1

Linear Growth
Jan 18, 2012

a3

Exponential Growth
EE-709@IITB

Sample Function Classes


Function Class

Best

Worst

Ordering Sensitivity

ALU (Add/Sub)

linear

exponential

High

Symmetric

linear

quadratic

None

Multiplication

exponential

exponential

Low

General Experience
Many tasks have reasonable OBDD
representations
Algorithms remain practical for up to 500,000
node OBDDs
Heuristic ordering methods generally satisfactory
Jan 18, 2012

EE-709@IITB

ROBDD sizes & variable ordering


Bad News
Finding optimal variable ordering NP-Hard
Some functions have exponential BDD size for all orders
e.g. multiplier

Good News
Many functions/tasks have reasonable size ROBDDs
Algorithms remain practical up to 500,000 node OBDDs
Heuristic ordering methods generally satisfactory

What works in Practice


Application-specific heuristics e.g. DFS-based ordering for
combinational circuits
Dynamic ordering based on variable sifting (R. Rudell)
Jan 18, 2012

EE-709@IITB

Operations with BDD (1/5)


Restriction: A restriction to a function to x=d,
denoted f|x=d, where x var (f), and d {0,1},
is equal to f after assigning x = d.
Given BDD of f, deriving BDD of f|x=d is simple

Jan 18, 2012

EE-709@IITB

Operations with BDD (2/5)


Let v1, v2 denote root nodes of f1, f2 respectively
, with var(v1) = x1 and var(v2) = x2
If v1 and v2 are leafs, f1 OP f2 is a leaf node with
value val(v1) OP val(v2)

Jan 18, 2012

EE-709@IITB

Operations with BDD (3/5)


If x1 = x2 = x, apply shanons expansion
f1 OP f2 = x . (f1|x=0 OP f2|x=0) + x . (f1|x=1 OP f2|x=1)

OP

X
BDD for
f1|x=0

Jan 18, 2012

BDD for
f1|x=1

X
BDD for
f2|x=0

EE-709@IITB

BDD for
f2|x=1

Operations with BDD (4/5)


X

OP
BDD for
f1|x=0

BDD for
f1|x=1

BDD for
f2|x=0

BDD for
f2|x=1

X
BDD for
f1|x=0 OP f2|x=0
Jan 18, 2012

BDD for
f1|x=1 OP f2|x=1
EE-709@IITB

10

Operations with BDD (5/5)


Else suppose x1 < x2 = x, in variable order
f1 OP f2 = x1 (f1|x1=0 OP f2) + x1 (f1|x1=1 OP f2)

X1

BDD for
f1|x1=0 OP f2
Jan 18, 2012

BDD for
f1|x1=1 OP f2
EE-709@IITB

11

Operations with BDD: Example


X1
+
f1=X1XOR X2

BDD for
f2|x1=0 OP f2

Jan 18, 2012

BDD for
f2|x1=0 OP f2

BDD for

f1|x1=1 OP f2

f2=X2

EE-709@IITB

12

Operations with BDD: Example


X1

=
OP
f1=X1XOR X2

Jan 18, 2012

BDD for
f2|x1=0 OP f2

BDD for

f1|x1=1 OP f2

f2=X2

EE-709@IITB

13

Operations with BDD: Example

Jan 18, 2012

EE-709@IITB

14

From circuits to BDD


X1

G2
G4

G1

X2

G3

X1
0

X2
0

X1

X1

Jan 18, 2012

X2

X2

EE-709@IITB

X1
0

X2

X1

X2

1
1 1

X2

15

Variants of decision diagrams


Multiterminal BDDs (MTBDD) Pseudo Boolean functions Bn N,
terminal nodes are integers
Ordered Kronecker FunctionalDecision Diagrams (OKFDD) uses
XOR in OBDDs
Binary Moment Diagrams (BMD) good for arithmetic operations
and word-level representation
Zero-suppressed BDD (ZDD) good for representing sparse sets
Partitioned OBDDs (POBDD) highly compact representation
which retains most of the features of ROBDDs
BDD packages
CUDD from Univ. of Colorado, Boulder,
CMU BDD package from Carnegie Mellon Univ.
In addition, companies like Intel, Fujitsu, Motorola etc. have
their own internal BDD packages
Jan 18, 2012

EE-709@IITB

16

Formal Equivalence Checking


Satisfiability Formulation
Search for input assignment
giving different outputs
Branch & Bound
Assign input(s)
Propagate forced values
Backtrack when cannot succeed

A
B
C
A

C
B

0
1
1
0

1 T3
1

Diff
0

T1

1
1

O2
0

O1

T2

Challenge
Must prove all assignments fail
Co-NP complete problem
Typically explore significant
fraction of inputs
Exponential time complexity
Jan 18, 2012

EE-709@IITB

17

SAT Problem definition


Given a CNF formula, f :

A set of variables, V
(a,b,c)
Conjunction of clauses
(C1,C2,C3)
Each clause: disjunction of literals over V
Does there exist an assignment of Boolean values to the
variables, V which sets at least one literal in each clause
to 1 ?
Example : ( a b c )( a c )( a b c )

C1
Jan 18, 2012

C2
EE-709@IITB

a=b=c=1

C3
18

DPLL algorithm for SAT


[Davis, Putnam, Logemann, Loveland 1960,62]

Given : CNF formula f(v1,v2,..,vk) , and an


ordering function Next_Variable
Example :

( a b )( a c )( a b )
C1

C2

C3
CONFLICT!

Jan 18, 2012

EE-709@IITB

1 0

1
c


SAT!

C1

C3 C2

19

DPLL algorithm: Unit clause rule


Rule: Assign to true any single literal clauses.

(a b c)
=
=

c=1

0 0

Apply Iteratively: Boolean Constraint Propagation (BCP)

a ( a c )( b c )( a b c )( c e )( d e )( c d e )
c ( b c )( c e )( d e )( c d e )

e( d e )
Jan 18, 2012

EE-709@IITB

20

Anatomy of a modern SAT solver


DPLL Algorithm
Clause database
management
Discard

useless
clauses (e.g. inactive or
large clauses)

Efficient BCP
Search Restarts

SAT
Solver

To

correct for bad


choices in variable
ordering
Restart

algorithm
periodically

Efficient garbage
collection

Retain

some/all
recorded clauses

Conflict-driven
learning
Jan 18, 2012

EE-709@IITB

21

Conflict driven search pruning (GRASP)


Silva & Sakallah 95

x1

Non-chronological backtracking
Conflict-clause recording

x2

xj

SAT
xk-1

xk

Jan 18, 2012

EE-709@IITB

22

Variable ordering
Significantly impacts size of search tree
Ordering schemes can be static or
dymamic
Conventional wisdom (pre-chaff):
Satisfy most number of clauses OR
Maximize BCP
e.g. DLIS, MOMs, BOHMs etc.
Jan 18, 2012

EE-709@IITB

23

Variable ordering: New ideas


New wisdom: Recorded clauses key in guiding
search
Conflict-driven variable ordering:
Chaff (DAC01): Pick var. appearing in most number
of recent conflict clauses
BerkMin (DATE02): Pick var. involved in most
number of recent conflicts

Semi-static in nature, for efficiency


Statistics updated on each conflict

Side-effect: Better cache behavior


Jan 18, 2012

EE-709@IITB

24

Efficient Boolean Constraint Propagation


Observation: BCP almost 80% of compute time, under
clause recording
Traditional implementation:
Each clause: Counter for #literals set to false
Assgn. to variable x: Update all clauses having x, x

New Idea: Only need to monitor event when # free


literals in a clause goes from 2 to 1
Need to watch only 2 literals per clause : SATO (Zhang97),Chaff
(DAC01)

x1 w1
Jan 18, 2012

EE-709@IITB

w2 xk
25

SAT solvers today


Capacity:
Formulas upto a million variables and 3-4 million
clauses can be solved in few hours
Only for structured instances e.g. derived from realworld circuits & systems

Tool offerings:

Public domain

GRASP : Univ. of Michigan


SATO: Univ. of Iowa
zChaff: Princeton University
BerkMin: Cadence Berkeley Labs.

Commercial
PROVER: Prover Technologies

Jan 18, 2012

EE-709@IITB

26

Thank you

Jan 18, 2012

EE-709@IITB

27

You might also like