Don´t Care Minimization of *BMDs: Complexity and Algorithms

Don´t Care Minimization of *BMDs:
Complexity and Algorithms
Christoph Scholl
Marc Herbstritt
Bernd Becker
Institute of Computer Science
Albert-Ludwigs-University
79110 Freiburg im Breisgau, Germany
1
Overview
•
•
•
•
•
•
•
•
Motivation
Decision Diagrams: BDDs, BMDs and *BMDs
More details on BMDs
Problem Formulation
Complexity Results
Algorithms
Experiments
Conclusions
2
Motivation
• Decision Diagrams (DDs):
– function representation
– used in: logic synthesis, testing, and verification
• Don´t Care conditions:
– can occur between function modules
– by system specification
 Use Don´t Cares to minimize DD-representation
– well-known for bit-level DDs (BDD, FDDs)
– unknown for word-level DDs (BMD, *BMDs, ...)
3
Related Work
• Zilic, Radecka, IWLS, 1998:
„Don´t Care FDD minimization by interpolation“
Problem: FDD represents boolean function,
*BMD represents integer-valued function
• Varma, Trachtenberg, IEE Proceedings, 1991:
„Computation of Reed-Muller expansions of incompletely
specified boolean functions from reduced representations“
Problem: Spectral technique not applicable in case of
integer-valued functions
4
Decision Diagrams: BDDs
• Representation for boolean functions: f : B n  B
• Iterative Shannon-decomposition:
f (, xi ,)  xi  f (,0,)  xi  f (,1,)
• Transformation into
directed, acylic graph:
X
low(v)
• Reduction:
eliminate v iif
low(v)=high(v)
0
f| x 0
v
1 high(v)
f| x 1
5
Decision Diagrams: BMDs (1)
• Representation for integer-valued functions f : B n  Z
• Iterative positive Davio decomposition:
f (, xi ,)  f (,0,)  xi   f (,1,)  f (,0,)
• Transformation into
directed, acyclic graph:
X
low(v)
• Reduction:
eliminate v iif
high(v) = 0
0
f| x 0
v
1 high(v)
f| x 1  f| x 0
6
Decision Diagrams: BMDs (2)
Example:
f  1  4  x2  3  x1  8  x1  x2
x1
0
1
x2
x2
0
1
0
1
1
4
3
8
7
Decision Diagrams: *BMDs
• More compact than BMDs: extract multiplicative
factor of terminals into edge weights
• Example: f  2  4  x2  4  x1  8  x1  x2
BMD
*BMD
x1
0
1
x1
x2
x2
0
1
0
1
2
4
4
8
x2
8
BMD-nodes reached by 1 ,,  l 
• Node v labeled with variable xi
• low(v)=0-successor(v), high(v)=1-successor(v)
• Node reached by 1 ,,  l  Bl , l  n, :
– Follow
 i  successor starting at root node
– Special case:  i  successor (v) not labeled with xi 1
Let w   i  successor (v) , choose xk with:
index ( w) : w is non - terminal
k 
: w is terminal
 n 1
• Go to node
w
if  i 1     k-1  0


0  terminal otherwise
9
Example
Reduced BMD:
Non-reduced BMD:
x1
0
x1
1
0
x2
0
1
1
5
x2
x2
4
• (0,0)-node: terminal 1
• (0,1)-node: terminal 5
• (1,0)-node: terminal 4
• (1,1)-node: terminal 0
11
0
1
0
1
1
5
4
0
10
Function represented by a BMD-node
• Let B be a BMD, f B : 0,1n  Z ,v is a 1 ,,  l -node.
• Funtion represented by v is:
fB
1 ,, l 

 1

  
 
li 1 i  i 
1 ,,
l

f B|x1 1 ,,xl  l
1 ,, l
Modification of  -node,   , changes
function represented by node v
11
Example
x1
0
11
x22
X2
0
1
x3
00
111
xx33
x33
x3
0
1
00
1
0
11
00
11
a
b
c
d
e
f
gg
hh
-k
+k
+k
12
Problem Formulation
Problem: DC*BMD
Given: *BMD B, f B : B n  Z
BDD C, f C : B n  B
Find: *BMD B*, such that B
*
c
B
and B* has minimal number of nodes.
f  f  f  fc
Problem: DCBMD
Like DC*BMD, but BMD instead of *BMD.
13
Complexity
Theorem:
DC*BMD and DCBMD are NP-complete.
Proof:
NP-hardness: Reduction from graph colorability problem.
NP-membership: Using WLCDs.
14
Method min_polynomial (1)
• Idea: Minimize size of polynomial extracted from BMD
• Polynomial contains term



c  x11  xk k

1
0
with xi  xi , xi  1 iif node reached by 1 , , k 
is terminal c  0.
• Size of BMD B, f B : B n  Z , is less or equal to size of
polynomial representing f B .
• Property holds also for *BMDs.
15
Method min_polynomial (2)
• Try to change terminal c reached by 1 , , n  to
have value 0 by using don´t cares.
• If dc1 , , n   1, change f B to f B :
*
f B* 1 , , n   f B 1 , , n   c
• Important: Adjustment of all terminals
 1 ,, n   1 , , n 
16
Method min_polynomial (3)
• dc(0,0)=1
x1
• dc(1,1)=1
0
1
1
x2
x2
0
1
0
1
0
1
5
4
4
3
80
7
-1
+1
+1
-1
-7
17
Method min_polynomial (4)
*BMD min_polynomial( *BMD b, BDD dc)
1. if dc=1 return 0; if dc=0 return b; if b=constant return b
2. if (result,b,dc) in Computed Table return result
3. Let v be top variable of b and dc
4. b*low=min_polynomial(blow, dclow)
5. b*high=min_polynomial(bhigh +(blow- b*low), dchigh)
6. b*= b*low+v* b*high
7. if size(b*) size(b) then b*= b
8. insert (b*,b,dc) into Computed Table
9. return b*
18
Method independent_dfs (1)
• Idea: Use don´t cares to assign high(v) to 0
application of Davio-reduction rule.
• At node v, to check if w=high(v) can be set to 0:
1. check if low(w) can be set to 0,
2. if 1. succeeds, check if high(w) can be set to 0.
19
Method independent_dfs (2)
xx11
• dc(0,0)=1
• dc(1,1)=1
00
1 11
xx22
xx22
00
11
00
11
411
144
033
11
088
+3
-3
-3
-11
+3
20
Method independent_dfs (3)
*BMD independent_dfs( *BMD b, BDD dc)
1. if dc=1 return 0; if dc=0 return b; if b=constant return b
2. if (result,b,dc) in Computed Table return result
3. Let v be top variable of b and dc#
4. (success, blow-diff)=check_zero(bhigh , dclow , dchigh)
5. if success then
b*=independent_dfs(blow+blow-diff ,dclow*dchigh)
else
b* low =independent_dfs(blow,dclow)
b* high =independent_dfs(bhigh +(blow -b* low ),dchigh)
b*= b* low +v* b* high
7. if size(b*) size(b) then b*= b
8. insert (b*,b,dc) into Computed Table
9. return b*
21
Experimental Results (1)
• Experimental setup:
– Generated incompletely specified functions:
• Collapse benchmark to sum-of-products
• Select cubes with probability of 40% to be included in
Don´t Care set
• Compute BDD C for Don´t Care Set
– Build *BMD B for the outputs  f1 , , f n  of the
benchmark, where f B is:
n
f B   2  fi
i
i 1
– Compute min_polynomial(B,C) and independent_dfs(B,C)
22
Experimental Results (2)
• init: initial size
of benchmark
• az: setting all
don´t cares to 0
• mp:
min_polynomial
• dfs:
independent_dfs
Benchmark
5xp1
9symml
alu2
apex7
c8
mux
pcler8
rd73
rd84
sao2
z4ml
init
az
mp dfs
76
19
223 242
401 373
1390 2305
346 336
60
47
44
61
89
87
196 200
128
96
69
87
12
3
183 182
139 147
118 49
17 13
34 34
32 21
43 36
114 81
47 37
30 26
23
Experimental Results (3)
Initial *BMD: * BMD init, minimized *BMD: * BMD min
Ratio: | *BMD
|
min
| *BMD init |
dfs
mp
az
2,00
1,50
ratio 1,00
dc-assign
method
0,50
0,00
1 2 3
4 5 6
7 8 9
10 11
benchmark
dfs
24
Conclusions
• We presented methods do minimize *BMD/BMDs
using Don´t Care conditions
• Two methods: min_polynomial, independent_dfs
– very effective in reducing the size of *BMDs
– time efficient (most benchmarks finish in a few seconds)
25
Future Work
• Modification of independent_dfs to independent_bfs:
Idea: Don´t care assignments which could be made „at the
top in the right half“ of the *BMD can become not
applicable due to assignments made „at the bottom in the
left half“
• Extension of existing methods to K*BMDs:
K*BMDs use several decomposition types: Shannon, positive
and negative Davio
• Application of Don´t Care based minimization
methods for verification of division circuits
26