Title: Symmetry Detection for Large Boolean Functions Using Circuit Representation, Simulation and Satisfia
1Symmetry Detection for Large Boolean Functions
Using Circuit Representation, Simulation and
Satisfiability
- Jin S. Zhang, Portland State University
- Alan Mishchenko, UC Berkeley
- Robert Brayton, UC Berkeley
- Malgorzata Chrzanowska-Jeske, Portland State
University
Supported by Maseeh Fellowship from PSU, NSF
grant CCR-9988402 and CCR 0312676, SRC contract
1361.001, and by the California Micro program
with our industrial sponsors, Altera, Intel,
Magma, and Synplicity.
2Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- Transitivity analysis
- SAT
- Experimental results
- Conclusions
3Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- Transitivity analysis
- SAT
- Experimental results
- Conclusions
4Importance of Classical Symmetries
- Widely used in logic synthesis and verification
- BDD minimization
- Decomposition
- Boolean matching
- Constructive logic synthesis
- Placement routing
- Formal verification
5Prior Work on Symmetry Computation
- BDD-based methods Möller ICCAD93, Panda ICCAD94,
Tsai TCAD96, Mishchenko TCAD03 - BDD construction takes majority of run time
- Cannot be applied to large designs
- Incomplete circuit-based methods performing
structural analysis Wang, ICCD03 - Detect classical and higher-order symmetry
- Complete circuit-based method using simulation
and ATPG Pomeranz, TCAD94 - Does not rely on recent improvements in SAT
6Our Contributions
- Compute all classical two-variable symmetries for
large Boolean functions
7Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- Transitivity analysis
- SAT
- Experimental results
- Conclusions
8Definitions
- Completely specified Boolean function
- F (x1, ,xn) where x1, xn, F range over 0, 1.
- Support of F all the variables that F depends
on. - Cofactors
- Cofactors w.r.t. variables xi and xj
- F00 F xi ? 0, xj ? 0,
- F01, F10, F11 are defined similarly.
9Representations of Boolean Functions
- Binary Decision Diagram (BDD)
10Classical Symmetries
For a pair of variables
F (,x, y,) F (,y, x,)
F 01 ? F 10 0
Non-skew non-equivalent
11Classical Symmetries
For a pair of variables
F (,x, y,) F (,y, x,)
F 01 ? F 10 0
Non-skew non-equivalent
12Transitivity of Symmetry
Variables a, b, c
a
b
c
Form larger symmetry group
13Simulation
- Computes the values of the internal signals and
POs from the value of the PIs - Random / Guided
- Control of simulation rounds
- Static / Dynamic
14Boolean Satisfiability (SAT)
- Proves that a given Boolean formula has a
satisfying assignment - F (xy)(y ?z ?), satisfying assignments x
1, y 0 - SAT vs. BDDs
- SAT involves search, heuristics can improve
performance - BDDs preprocess the search space
- By building canonical form of Boolean functions
- Hard or impossible for large functions
15Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- Transitivity analysis
- SAT
- Experimental results
- Conclusions
16Overview of the Algorithm
Derive network AIG
Call SAT for a remaining pair
17Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- Transitivity analysis
- SAT
- Experimental results
- Conclusions
18Structural Analysis Detect Symmetric Variable
Pairs
- Convert AIGs to Implication Supergates (ISs)
- Introduced in Chang DAC00
- Compute local symmetries for each Implication
Supergates - Propagate global symmetries from primary inputs
to primary outputs
19AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
20AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
21AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
22AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
AIG
e
a
d
b
c
Represents 2-input AND gate
23AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
AIG
e
a
d
b
c
Represents 2-input AND gate
24AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
AIG
e
a
d
b
c
Represents 2-input AND gate
25AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
AIG
e
a
d
b
c
Represents 2-input AND gate
26AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
AIG
e
a
d
b
c
Represents 2-input AND gate
27AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
AIG
e
a
d
b
c
Represents 2-input AND gate
28AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
Implication supergate
AIG
s1
e
a
b
c
e
s2
a
d
b
c
Represents 2-input AND gate
Represents multi-input AND gate
29AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached
Implication supergate
AIG
s1
e
a
b
c
e
s2
d
a
d
b
c
Represents 2-input AND gate
Represents multi-input AND gate
30AIG ? Implication Supergates
- Expand the AND gate until a PI or complemented
edge is reached - Recover lost structural symmetry in AIG
Implication supergate
AIG
s1
e
a
b
c
e
s2
d
s3
a
d
b
c
b
c
Represents 2-input AND gate
Represents multi-input AND gate
31Structural Symmetry Detection
IS
- Divide the fanins of each IS into three
categories - - Positive PIs
- - Negated PIs
- - Other ISs
s1
e
a
b
c
s2
d
s3
b
c
32Structural Symmetry Detection
IS
2. Identify initial candidate symmetric pairs
for each IS - Pair up variables in positive and
negative PIs separately
s1
e
a
b
c
s2
d
s3
b
c
33Structural Symmetry Detection
IS
3. Keep a symmetric pair if the variables -
not in the support of other IS or - symmetric
for each fanin in other IS
s1
e
a
b
c
s2
d
s3
b
c
34Structural Symmetry Detection
IS
4. Propagate the symmetric pairs to its parent
IS if - the symmetry holds for at least one
fanin of the other IS, and - the variables are
not in the support for other fanins
s1
e
a
b
c
s2
d
s3
b
c
35Summary Structural Analysis
- Detect symmetry in one sweep over the circuit
- Discover most easy structural symmetries
- Simpler, faster and more scalable than Wang
ICCD03 - We only compute classical symmetries
36Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- Transitivity analysis
- SAT
- Experimental results
- Conclusions
37Simulation Detect Non-symmetric Variable Pairs
- Random guided simulation
- Performance random simulation until saturation
- Guided simulation uses SAT counter examples and
their distance-1 patterns - E.g. Distance-1 patterns of 011 are 111,
001, 010
38Why Distance-1 Patterns?
- For a realistic and sparse function
- Realistic appear in practical circuit
- Sparse many 0s and fewer 1s or vice versa
39Why Distance-1 Patterns?
- For a realistic and sparse function
- Random simulation often fails
40Why Distance-1 Patterns?
- For a realistic and sparse function
- Random simulation often fails
- SAT counterexamples reach unlikely values
41Why Distance-1 Patterns?
- For a realistic and sparse function
- Random simulation often fails
- SAT counterexamples reach unlikely values
- Distance-1 patterns represent its neighborhood,
contain other unlikely values
42SimulationDetect Non-symmetric Variable Pairs
- Random guided simulation
- Bit-Parallel computation
- Simulating one AIG node involves bit-wise
operations - Simulate 32 or 64 bits simultaneously
1010
43SimulationDetect Non-symmetric Variable Pairs
- Random guided simulation
- Bit-Parallel computation
- One vector targets all variable pairs
simultaneously
44Simulation Example
F(a, b, c, d) ab d (ac bc)
(3) Flip the bits on the diagonal
0011 1111 1001
1010
ab
cd
00
01
11
10
00
0
0
0
1
01
0
0
1
1
(4) Simulate the above patterns
11
0
0
1
1
10
0
0
0
1
- Suppose the vector P is 1011.
(2) Create the bit matrix a b c d
1 0 1 1 1 0 1 1 1 0
1 1 1 0 1 1
45Simulation Example
F(a, b, c, d) ab d (ac bc)
(3) Flip the bits on the diagonal
0011 1111 1001
1010
0
ab
cd
00
01
11
10
00
0
0
0
1
01
0
0
1
1
(4) Simulate the above patterns
11
0
0
1
1
10
0
0
0
1
- Suppose the vector P is 1011.
(2) Create the bit matrix a b c d
1 0 1 1 1 0 1 1 1 0
1 1 1 0 1 1
46Simulation Example
F(a, b, c, d) ab d (ac bc)
(3) Flip the bits on the diagonal
0011 1111 1001
1010
0
ab
1
cd
00
01
11
10
00
0
0
0
1
01
0
0
1
1
(4) Simulate the above patterns
11
0
0
1
1
10
0
0
0
1
- Suppose the vector P is 1011.
(2) Create the bit matrix a b c d
1 0 1 1 1 0 1 1 1 0
1 1 1 0 1 1
47Simulation Example
F(a, b, c, d) ab d (ac bc)
(3) Flip the bits on the diagonal
0011 1111 1001
1010
0
ab
1
cd
00
01
11
10
1
00
0
0
0
1
01
0
0
1
1
(4) Simulate the above patterns
11
0
0
1
1
10
0
0
0
1
- Suppose the vector P is 1011.
(2) Create the bit matrix a b c d
1 0 1 1 1 0 1 1 1 0
1 1 1 0 1 1
48Simulation Example
F(a, b, c, d) ab d (ac bc)
(3) Flip the bits on the diagonal
0011 1111 1001
1010
0
ab
1
cd
00
01
11
10
1
00
0
0
0
1
0
01
0
0
1
1
(4) Simulate the above patterns R 0110
11
0
0
1
1
10
0
0
0
1
- Suppose the vector P is 1011.
(2) Create the bit matrix a b c d
1 0 1 1 1 0 1 1 1 0
1 1 1 0 1 1
49Simulation Example
F(a, b, c, d) ab d (ac bc)
(3) Flip the bits on the diagonal
0011 1111 1001
1010
0
ab
1
cd
00
01
11
10
1
00
0
0
0
1
0
01
0
0
1
1
(4) Simulate the above patterns R 0110
11
0
0
1
1
10
0
0
0
1
(5) Check variable pairs with the same polarity
in P a, c, a, d, c, d
- Suppose the vector P is 1011.
(2) Create the bit matrix a b c d
1 0 1 1 1 0 1 1 1 0
1 1 1 0 1 1
50Simulation Example
F(a, b, c, d) ab d (ac bc)
(3) Flip the bits on the diagonal
0011 1111 1001
1010
0
ab
1
cd
00
01
11
10
1
00
0
0
0
1
0
01
0
0
1
1
(4) Simulate the above patterns R 0110
11
0
0
1
1
10
0
0
0
1
(5) Check variable pairs with the same polarity
in P a, c, a, d, c, d
- Suppose the vector P is 1011.
(2) Create the bit matrix a b c d
1 0 1 1 1 0 1 1 1 0
1 1 1 0 1 1
(6) non-symmetric pairs a, c, c, d
51Summary Simulation
- Employ both random and guided simulation
- More effective than earlier approaches
- Random simulation detects easy non-symmetric
pairs - Guided simulation detects hard-to-find
non-symmetric pairs - Target all variable pairs simultaneously and use
bit-parallel computation - More efficient than earlier approaches
52Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- Transitivity analysis
- SAT
- Experimental results
- Conclusions
53Transitivity AnalysisDetect Symmetry/Non-symmetr
y
- Infer new symmetric/non-symmetric status based on
existing symmetry information - Bit-wise operations on the rows and columns of
the bit-matrix representing symmetry information
54Transitivity Analysis Rule 1
- Infer new symmetric pairs
x1, x2 variables A, B sets of variables
55Transitivity Analysis Rule 2
- Infer new non-symmetric pairs
x1, x2 variables A, B sets of variables
56Transitivity Analysis Rule 3
- Infer new non-symmetric pairs
x1, x2 variables A, B sets of variables
57Summary Transitivity Analysis
- Performed each time a symmetry/non-symmetry
status is obtained - Infer additional symmetric and non-symmetric
pairs
58Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- Transitivity analysis
- SAT
- Experimental results
- Conclusions
59Boolean Satisfiability (SAT)Detect
Symmetry/Non-symmetry
- Check if F01 F10
- Equivalent, variables are symmetric
- Not equivalent, not symmetric, return
counter-examples - The combinational equivalence checker (CEC) is
based on Improvements to combinational
equivalence checking - Mishchenko, IWLS06/ICCAD06
- Significant performance improvement over other
SAT solvers
60Reducing SAT Calls
- SAT is expensive, even with improvements
Structural Analysis
Random Guide Simulation
61Summary SAT
- The underlying CEC is very efficient
- Many techniques used to reduce the number of
needed SAT calls
62Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- SAT
- Transitivity analysis
- Experimental results
- Conclusions
63Experiments Setup
- Implemented in ABC A system for sequential
synthesis and verification - Brayton, Mishchenko, et al.
- Ran on a Pentium 4 computer
- 1.6Ghz CPU, 1Gb Ram
64Goals for Experiments
- Analyze the effectiveness of different techniques
- Demonstrate the benefit of simulation and SAT
integration - Illustrate the performance improvement
65Exp 1 Contribution of Different Techniques
66Exp 1 Contribution of Different Techniques
- Of all symmetric variable pairs in MCNC suite
- Structural analysis 70
- Transitivity analysis 21
- SAT 9
- Of all non-symmetric variable pairs in MCNC suite
- Simulation Transitivity analysis 99.7
- SAT 0.3
67Exp 2 Effectiveness of tight integration
Call SAT for a remaining pair
Derive network AIG
Perform guided Simulation
Y
Our Algorithm
68Exp 2 Effectiveness of tight integration
Call SAT for a remaining pair
Derive network AIG
All variable pairs processed?
N
Vanilla flow
69Experimental Results Effectiveness of SIM/SAT
integration
70Experimental Results Effectiveness of SIM/SAT
integration
71Exp 3 Performance Comparison Proposed vs. BDDs
- Out of 24 large benchmarks
- BDDs could not be constructed for 5 benchmarks
- Proposed method was faster than BDDs Mishchenko,
TCAD03 in 10 benchmarks - 3.6x faster
- Proposed method was slower in 9 benchmarks
- 1.6x slower
72Outline
- Motivations
- Background
- Our approach to symmetry computation
- Structural analysis
- Simulation
- Transitivity analysis
- SAT
- Experimental results
- Conclusions
73Conclusions
- Enabled complete symmetry computation onlarge
designs - Structural analysis and simulation were keyto
its performance - Simulation and SAT integration improved
performance an order of magnitude - Lay the foundation for computing other functional
properties using similar approach - Linear cofactor relationships
- Higher-order symmetries
74Future Work
- Extend the current hybrid approach to other
functional properties - Detect functional properties of sequential
circuits - Develop efficient methods for NPN-equivalence
checking of large Boolean functions without BDDs
75Thank you!