Você está na página 1de 36

Fast Spectral Transforms and

Logic Synthesis
DoRon Motter
August 2, 2001
Introduction
Truth Table Representation
Value provides complete information for one
combination of input variables
Provides no information about other combinations
Spectral Representation
Value provides some information about the behavior of
the function at multiple points
Does not contain complete information about any single
point

Spectral Transformation
Synthesis
Many algorithms proposed leveraging fast
transformation
Verification
Correctness may be checked more efficiently
using a spectral representation.

Review Linear Algebra
Let M be a real-valued square matrix.
The transposed matrix M
t
is found by interchanging
rows and columns
M is orthogonal if
MM
t
= M
t
M = I
M is orthogonal up to the constant k if
MM
t
= M
t
M = kI
M
-1
is the inverse of M if
MM
-1
= M
-1
M = I
M has its inverse iff the column vectors of M are
linearly independent
Review Linear Algebra
Let A and B be (n n) square matrices
Define the Kronecker product of A and B as

(
(
(
(

=
B B B
B B B
B B B
B A
nn n n
n
n
a a a
a a a
a a a

2 1
2 22 21
1 12 11
Spectral Transform
General Transform Idea
Consider the 2
n
output values of f as a column
vector F
Find some transformation matrix T(n) and
possibly its inverse T
-1
(n)

Produce R
F,
the spectrum of F, as a column
vector by
R
F
= T(n)F
F = T
-1
(n)R
F

Walsh-Hadamard Transform
The Walsh-Hadamard Transform is defined:
1 ) 0 ( + T
(



=
) 1 ( ) 1 (
) 1 ( ) 1 (
) (
n n
n n
n
T T
T T
T
Walsh-Hadamard Matrices
(
(
(
(




=
(

=
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
(2)
1 1
1 1
) 1 (
T

(
(
(
(
(
(
(
(
(
(
(








=
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 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
(3) T
Walsh-Hadamard Example
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(
(
(








1
0
0
0
0
1
1
0
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 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
3 2 1 3 2 1 3 2 1 3 2 1
) , , ( x x x x x x x x x x x x f + + =
Walsh-Hadamard Example
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(
(
(








1
0
0
0
0
1
1
0
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 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
3 2 1 3 2 1 3 2 1 3 2 1
) , , ( x x x x x x x x x x x x f + + =
3
Walsh-Hadamard Example
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(
(
(








3
1
1
1
1
1
1
3
1
0
0
0
0
1
1
0
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 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
3 2 1 3 2 1 3 2 1 3 2 1
) , , ( x x x x x x x x x x x x f + + =
Walsh-Hadamard Example
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(
(
(








6
1
1
1
2
2
2
2
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 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 1 1 1 1
3 2 1 3 2 1 3 2 1 3 2 1
) , , ( x x x x x x x x x x x x f + + =
Walsh-Hadamard Transform
Why is it useful?
Each row vector of T(n) has a meaning

1

x
1
x
2
x
1
x
2

Since we take the dot product of the row vector
with F we find the correlation between the two
(
(
(
(




=
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
(2) T
Walsh-Hadamard Transform

Constant, call it x
0
x
1
x
2
x
1
x
2
x
3
x
1
x
3
x
2
x
3
x
1
x
2
x
3
(
(
(
(
(
(
(
(
(
(
(








=
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 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
(3) T
Walsh-Hadamard Transform
Alternate Definition



Recursive Kronecker Structure gives rise to
DD/Graph Algorithm
(

=
=
1 1
1 1
) (
1
n
i
n T
Walsh-Hadamard Transform
Alternate Definition



Note, T is orthogonal up to the constant 2:
| |
i
n
i
x n 2 1 1 ) (
1
=
=
T
I 2
2 0
0 2
1 1
1 1
1 1
1 1
) 1 ( ) 1 ( =
(

=
(

=
t
Decision Diagrams
A Decision Diagram has an implicit
transformation in its function expansion
Suppose

This mapping defines an expansion of f

) 1 ( ) (
1
T T
n
i
n
=
=
(

=

1
0 1
) 1 ( ) 1 (
f
f
f T T
Binary Decision Diagrams
To understand this expansion better,
consider the identity transformation
Symbolically,
| |
1 0
1
0
1
0
1
) 1 ( ) 1 (
f x f x
f
f
x x f
f
f
f
i i i i
+ =
(

=
(

=

I I
| |
i i
x x n =
(

=
1 0
0 1
) ( T
Binary Decision Diagrams
The expansion of f defines the node
semantics
By using the identity transform, we get
standard BDDs
What happens if we use the Walsh
Transform?
Walsh Transform DDs
| |
i
n
i
x n 2 1 1 ) (
1
=
=
T
| |
( ) ( )( ) | |
1 0 1 0
1
0
1
0 1
2 1
2
1
1 1
1 1
2 1 1
2
1
) 1 ( ) 1 (
f f x f f f
f
f
x f
f
f
f
i
i
+ + =
(

=
(

=

T T
Walsh Transform DDs
( ) ( )( ) | |
1 0 1 0
2 1
2
1
f f x f f f
i
+ + =

( )
1 0
2
1
f f +
( )
1 0
2
1
f f
1
( )
i
x 2 1
Walsh Transform DDs
It is possible to convert a BDD into a
WTDD via a graph traversal.
The algorithm essentially does a DFS

Applications: Synthesis
Several different approaches (all very
promising) use spectral techniques
SPECTRE Spectral Translation
Using Spectral Information as a heuristic
Iterative Synthesis based on Spectral
Transforms
Thorntons Method
M. Thornton developed an iterative
technique for combination logic synthesis
Technique is based on finding correlation
with constituent functions
Needs a more arbitrary transformation than
Walsh-Hadamard
This is still possible quickly with DDs

Thorntons Method
Constituent Functions
Boolean functions whose output vectors are the
rows of the transformation matrix
If we use XOR as the primitive, we get the
rows for the Walsh-Hadamard matrix
Other functions are also permissible
Thorntons Method
1. Convert the truth table F from {0, 1} to {1, -1}
2. Compute transformation matrix T using
constituent functions {F
c
(x)}
Constituent functions are implied via gate library
3. Compute spectral coefficients
4. Choose largest magnitude coefficient
5. Realize constituent function F
c
(x) corresponding
to this coefficient

Thorntons Method
6. Compute the error e(x) = F
c
(x) - F with
respect to some operator, -
7. If e(x) indicates w or fewer errors,
continue to 8. Otherwise iterate by
synthesizing e(x)
8. Combine intermediate realizations of
chosen {F
c
(x)} using - and directly realize
e(x) for the remaining w or fewer errors

Thorntons Method
Guaranteed to converge
Creates completely fan-out free circuits
Essentially a repeated correlation analysis
Extends easily to multiple gate libraries


Thorntons Method: Example

Step 1: Create the truth table using {-1, 1}

3 2 2 1 3 2 1 3 1
) ( x x x x x x x x x x f + + + =
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
3 2 1






F x x x
Thorntons Method: Example
Step 2: Compute transformation matrix T
using constituent functions.
In this case, well use AND, OR, XOR
Thorntons Method: Example
1
x
1
x
2
x
3
x
1
x
2
x
1
x
3
x
2
x
3
x
1
x
2
x
3
x
1
+ x
2
x
1
+ x
3
x
2
+ x
3
x
1
+ x
2
+ x
3
x
1
x
2
x
1
x
3
x
2
x
3
x
1
x
2
x
3
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(















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 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 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 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
Thorntons Method: Example
Step 3: Compute spectral coefficients
S[F
c
(x)]= [-2, -2, 2, -2, 2, -2, 2, -6, 2,
-2, 2, 2, -2, -2, -2, -4]
Step 4: Choose largest magnitude
coefficient.
In this case, it corresponds to x
1
x
2
x
3


Thorntons Method: Example
Step 5: Realize the constituent function F
c
In this case we use XNOR since the coefficient
is negative
Thorntons Method: Example
Step 6: Compute the error function e(x)
Use XOR as a robust error operator
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 1 1
1 1 1 1 1 1
1 1 1 1 1 1
3 2 1






e F x x x
c
F
Thorntons Method: Example
Step 7: Since there is only a single error, we
can stop, and realize the final term directly

Conclusion
The combination of spectral transforms and
implicit representation has many
applications
Many ways to leverage the spectral
information for synthesis