Upload
ciqala
View
15
Download
0
Embed Size (px)
DESCRIPTION
SIMULATION BOUNDS FOR EQUIVALENCE VERIFICATION OF ARITHMETIC DATAPATHS WITH FINITE WORD-LENGTH OPERANDS. Namrata Shekhar 1 , Priyank Kalla 1 , M. Brandon Meredith 2 , Florian Enescu 2 1 Department of Electrical and Computer Engineering, University of Utah, Salt Lake City, UT-84112. - PowerPoint PPT Presentation
Citation preview
SIMULATION BOUNDS FOR EQUIVALENCE VERIFICATION OF ARITHMETIC DATAPATHS WITH FINITE WORD-LENGTH
OPERANDS
Namrata ShekharNamrata Shekhar1, Priyank Kalla, Priyank Kalla1, M. Brandon Meredith, M. Brandon Meredith22, Florian Enescu, Florian Enescu2
1Department of Electrical and Computer Engineering,
University of Utah, Salt Lake City, UT-84112.
2Department of Mathematics and Statistics,
Georgia State University, Atlanta, GA-30303
OutlineOutline
Problem Overview
Application: Arithmetic datapaths in DSP designs
Problem modeling
Polynomial functions over finite integer rings
Limitations of previous work
Theory and Applications
Results and Conclusions
Future work
The Equivalence Verification ProblemThe Equivalence Verification Problem
Fixed Bit-width OperandsFixed Bit-width Operands
Control the datapath size: Fixed size bit-vectors (m)
* *
8-bit
8-bit
16-bit32-bit
* *
8-bit
8-bit
8-bit8-bit
Bit-vector of size m: Integer values in 0,…, 2m-1
Fixed-size (m) bit-vector
arithmetic
Polynomials reduced %2m
Algebra over the ring Z2m
General Datapath ModelGeneral Datapath Model
Bit-vector operands with different word-lengths
Input variables : {x1,…, xd} Output variables : f
Input bit-widths: {n1,…, nd} Output width : m
.
.
Model f as polynomial function
* *
8-bit
12-bit
20-bit32-bit
n n n m1 2 d 22 2 2Z × Z × × Z Z
1 21 2 22 2n n mx Z ,x Z f Z
1n m
1 {0, ..., 2 -1} {0, ..., 2 -1}x , f
Arithmetic Data-path: ImplementationArithmetic Data-path: Implementation
Signal Truncation
Keep lower-order bits, ignore higher bits
.
Fractional Arithmetic with rounding
Keep higher-order m-bits, round lower order bits
.
Saturation Arithmetic
Saturate at overflow
Used in image-processing applications
m m
1 d 1 d( ,.., ) % 2 ( ,.., ) % 2f x x g x x
m m
m m
- % 2 - % 2
2 2
f f g g
Motivation: Motivation: Convolution of A and B
Datapath size is fixed
How many simulation vectors required to prove C = C’ ?
FFT(A)
invFFT(FAB)
FFT(B)
a0a1a2
a3
b0b1b2
b3
FAB0
FAB1
FAB2
FAB3
c’0c’1c’2
c’3
j i j0
3
ij
c a b
0 3 iC = (c0, c1, c2, c3) where
C′ = (c′0, c′1, c′2, c′3) = DFT-1 (DFT(A)·DFT(B))
Example: Anti-Aliasing FunctionExample: Anti-Aliasing Function
F = 1 = 1 = 2√a2 + b2 2√x [Peymandoust et al, TCAD‘03]
Expand into Taylor series
F ≈ 1 x6 – 9 x5 + 115 x4
64 32 64
– 75 x3 + 279 x2 – 81 x 16 64 32
+ 85 64
Scale coefficients;
Implement as bit-vectors
MAC
x = a2 + b2
coefficients
a b
x
F
DFF
coefficients
Example: Anti-Aliasing FunctionExample: Anti-Aliasing Function
Implemented as a fixed size datapath in x F1[15:0], F2[15:0], x[15:0]
F1 = 156x6 + 62724x5 + 17968x4 + 18661x3 + 43593 x2
+ 40244x + 13281
F2 = 156x6 + 5380x5 + 1584x4 + 10469x3 + 27209 x2
+ 7456x + 13281
F1 ≠ F2 ; F1[15:0] = F2[15:0]
How many vectors required to prove: F1 % 216 ≡ F2 % 216
Contributions Contributions
Abstract the design as a polynomial function
Exhaustive simulation is not necessary to prove
equivalence
Upper bound on the number of vectors
To prove equivalence
Sufficient to catch errors
Bound corresponds to a function in number theory
Previous WorkPrevious Work
Bit/Word level canonical diagrams
BDDs, ZBDDs, BMDs, TEDs
SAT and MILP-based techniques
Bit-vector decision procedures, Word-level ATPG, SMT
Theorem-Proving, term-rewriting
Problem model is algebraic
Previous Work: SimulationPrevious Work: Simulation
Reduction in simulation complexity
Three-valued logic simulation [Bryant, ACM ’91]
Utilizing structural information [Brand, ICCAD ’92]
Automated approach using BDDs [Yuan , ICCAD ‘99]
Polynomial methods using the fundamental theorem of
algebra
Generate simulation vectors [Sanchez, HLDVT ‘99]
Reduce the complexity of model checking
[ Raudvere, ICCAD ‘05]
Fundamental Theorem of AlgebraFundamental Theorem of Algebra
A degree-k polynomial F(x) has exactly k roots
F(x) = x2 + 6x = x ( x + 6 )
If F(x) = 0 for k + 1 values, then F(x) is a zero polynomial
Can also be extended for multi-variate polynomials
Limitations:
Results applicable only over unique factorization domains
(UFD): Z, Zp, C
Z2m is a non-UFD
Why is the Problem Difficult?Why is the Problem Difficult?
Consider F(x) = x2 + 6x in Z8
Degree-2 polynomial has 4 unique roots
F(x) = 0 for 4 vectors, but F(x) ≠ 0 in Z8
Not applicable to bit-vector arithmetic
F
x+6
F
x+4 x+2x
Previous Work: Finite Ring AlgebraPrevious Work: Finite Ring Algebra
f (x1, …, xd) % n ≡ g(x1, …, xd) % n
Proving equivalence is NP-hard [Ibarra et al, ACM ‘83]
Previous approaches
f (x1, x2, …, xd) – g (x1, x2, …, xd) ≡ 0 % 2m : Zero Equivalence
[ICCD ’05]
Reduction to canonical forms [ICCAD ’05]
Limitations:
Intermediate expression swell
No error trace is provided
Simulation vector generation: Based on zero equivalence
Zero EquivalenceZero Equivalence
module fixed_bit_width (x, f, g);
input [2:0] x;
output [2:0] f, g;
assign f[2:0] = x2 + 6x – 3;
assign g[2:0] = 5x2 + 2x + 5;
h(x) = f (x) – g(x) = 4x2 + 4x
h(x) ≡ 0 for all values of x in {0,…,7}: Vanishing polynomial
Required: To find if any given expression vanishes
Use concepts from ideal membership testing
Ideal Membership TestingIdeal Membership Testing
h:Z2m[x] → Z2m defined by % 2m
Ideal members map to 0
Test for membership in
Representative expression for members of this ideal [Chen,
Disc. Math ‘96]
Use concepts from Number theory and polynomial algebra
Idealxi
xi % 2m
h: % 2m
0f
gf – g ?Z2m[x]
Ideal of Vanishing Polynomials
Z2m
Results From Number TheoryResults From Number Theory
Find least n such that 2m|n!
Smarandache Function: λ = SF (2m)
λ = SF(23) = 4, since 23|4!
n! divides a product of n consecutive numbers
4! divides 99 X 100 X 101 X 102
2m divides the product of n consecutive numbers
23 divides the product of 4 consecutive numbers
Results From Number TheoryResults From Number Theory
F ≡ G in Z23 or (F - G) ≡ 0 % 23
23|(F - G) in Z23
23 divides the product of 4 consecutive numbers
If (F-G) is a product of 4 consecutive numbers then 23|(F - G)
A polynomial as a product of 4 consecutive numbers?
. (x-1) (x-2) (x-3)(x)
Basis for FactorizationBasis for Factorization
Y0(x) = 1
Y1(x) = (x)
Y2(x) = (x)(x - 1) = Product of 2 consecutive numbers
Y3(x) = (x)(x - 1)(x - 2) = Product of 3 consecutive numbers
…
…
Yk(x) = (x – k + 1) Yk-1(x) = Product of k consecutive numbersRule 1: Factorize into at least Yλ (x) to vanish, where
λ = SF(2m)
Example 1: Vanishing PolynomialExample 1: Vanishing Polynomial
4th degree polynomial F over Z23
λ = 4
.
Degree (x) = k = 4 = λ
F can be written as a product of 4 consecutive numbers
in x
.
F is a vanishing polynomial
4 3 2F x 2x 3x 2x
3
4F = (x) (x-1) (x-2) (x-3) = Y ( ) % 2x
Constraints on the CoefficientConstraints on the Coefficient
F(x) = 4x2 + 4x = (x)(x-1) % 23
Y4(x) = (x)(x-1)
Rule 2: Coefficient has to be a multiple of bk = 2m/gcd(k!, 2m)
Here, Coefficient of F(x) = 4, Degree of F(x) = 2
b2 = 23/gcd(2!, 23) = 4 is a multiple of the coefficient
Use Rule 1 and Rule 2 to determine if any F(x) = 0 % 2m
compensated by constant
missing factor (x-2)(x-3)
4
Deciding Vanishing PolynomialsDeciding Vanishing Polynomials
Fλ is an arbitrary polynomial over
Yλ = Yk is as defined earlier: λ = SF(2m)
ak is an arbitrary integer
.
Polynomial F in vanishes if
Rule 1 Rule 2
F = F Y + a b k k kk Y
m2Z
m2Z
m
k m
2b =
gcd(k!,2 )
Polynomial RepresentationsPolynomial Representations
: Forward difference operator
p is the degree of F(x)
Newton’s interpolation formula: Any polynomial F(x) can be written as
0
F( ) ( F)(0)
pk
k
xx
k
( F)( ) F( 1) F( )x x x
Polynomial RepresentationsPolynomial Representations
: Forward difference operator
p is the degree of F(x)
Newton’s interpolation formula: Any polynomial F(x) can be written as
0
F( ) ( F)(0)
p
k
k
x
kx
( F)( ) F( 1) F( )x x x
Reinterpret Vanishing idealReinterpret Vanishing ideal
: Forward difference operator
Yk(x) is as defined earlier
p is the degree of F(x)
Newton’s interpolation formula: Any polynomial F(x) can be written as
F( ) x
( F)( ) F( 1) F( )x x x
0
( F)(0)Y ( )
!
kp
kk
xk
Reinterpret Vanishing idealReinterpret Vanishing ideal
: Forward difference operator
Yk(x) is as defined earlier
p is the degree of F(x)
Newton’s interpolation formula: Any polynomial F(x) can be written as
F( ) x
( F)( ) F( 1) F( )x x x
0
Y (( F)(0)
!)
p
kk
k
kx
Polynomial RepresentationsPolynomial Representations
is any arbitrary integer
Yk(x) is as defined earlier
p is the degree of F(x)
Newton’s interpolation formula: Any polynomial F(x) can be written as
kk 0
F( ) cp
kx Y (x)
k
k
( F)(0)c
k!
Polynomial RepresentationsPolynomial Representations
Fλ is an arbitrary polynomial over
Yλ = Yk is as defined earlier: λ = SF(2m)
is an arbitrary integer
Any polynomial F(x) in can be written as
m2Z
m2Z
F(x) =
Rule 1
c+ k kk YF Y 0 0 k
k
k
( F)(0)c
k!
Polynomial RepresentationsPolynomial Representations
Fλ is an arbitrary polynomial over
Yλ = Yk is as defined earlier: λ = SF(2m)
is an arbitrary integer
Any polynomial F(x) in can now be reduced to
m2Z
m2Z
F = c k kk Y 0 k
k
k
( F)(0)c
k!
Polynomial RepresentationsPolynomial Representations
Apply Rule 2
F(x) vanishes iff ck is a multiple of
Check for all ck, where
ck evaluated no more than λ times
F(x) evaluated no more than λ times
Any polynomial F(x) in can now be reduced to
m2Z
F = c k kk Y 0 k
m
k m
2b =
gcd(k!,2 )0 k
ResultsResults
By extension,
If F(x) ≡ 0 for any λ consecutive values of x in
.
Further,
F(x) – G(x) = 0 → F(x) = G(x)
Any λ consecutive values of x are sufficient to prove
equivalence
m2Z
2F( ) 0 Z mx x
ExampleExample
f = x4 + x2
Simulating,
x=0, f=0
x=1, f=2
x=2, f=4
x=3, f=2
x=4, f=0
x=5, f=2
x=6, f=4
x=7, f=2
Consider f, g over Z23
λ = SF(23) = 4
g = 2x2
Simulating,
x=0, g=0
x=1, g=2
x=2, g=0
x=3, g=2
x=4, g=0
x=5, g=2
x=6, g=0
x=7, g=2
Extension to Multiple VariablesExtension to Multiple Variables
Given d variables x = <x1, …, xd> with degrees
k = < k1, …, kd> over Z2m
Basis for d variables:
.
d
k i i 0 0 1 1 d di=1
Y = Y ( ) Y ( ) Y ( ) Y ( )x x x x
Rule 1 (for d variables): Factorize into Yλ (x), such that
ki ≥ λ for any xi ; λ = SF(2m)
Example: Vanishing PolynomialExample: Vanishing Polynomial
4th degree polynomial F(x, y) over Z23
SF(23) = 4
.
Degree (x) = k1 = 4 = SF(23)
Degree (y) = k2 = 1
F can be written as a product of 4 consecutive numbers
in x
.
F is a vanishing polynomial
4 3 2F x y 2x y 3x y 2xy
3
4 1F = (x) (x-1) (x-2) (x-3) y = Y ( ) Y ( ) 2 %x y
Effect of Bit-vectorsEffect of Bit-vectors
4th degree polynomial F(x, y) in Z21 × Z22 → Z23
λ = 4
.
Define
.
F = Y2(x) · Y1(y) ≡ 0 % 23
2F = x y - x y = x (x-1) (y)
1 3 2 3
1 2min{2 ,SF(2 )} 2; min{2 ,SF(2 )} 4
in
i min{2 , } 12
0 1x Z ,x , 220 1 2 3y Z , y , , ,
Rule 1(extended): Factorize into Yk(x), such that ki ≥ μi for any xi
ResultsResults
By extension, for F(x) over
If F(x) ≡ 0 for any μi consecutive values of xi in
.
Total number of vectors:
Further,
F(x) – G(x) = 0 → F(x) = G(x) over
To prove equivalence, we need vectors
i 2F( ) 0 x Z
inx in2
Z
n n m1 d 22 2Z × × Z Z
n n m1 d 22 2Z × × Z Z
i1
d
i
i1
d
i
ExampleExample
f = x4y+ x2y
Simulating,
x=0, y=0, f=0
x=1, y=0, f=0
x=2, y=0, f=0
x=3, y=0, f=0
x=0, y=1, f=0
x=1, y=1, f=2
x=2, y=1, f=4
x=3, y=1, f=2
Consider f, g over Z22 × Z2 → Z23
λ = 4, μ1 = 4 ; μ2 = 2
Required: μ1.μ2 = 8 vectors
g = 2x2y
Simulating,
x=0, y=0, g=0
x=1, y=0, g=0
x=2, y=0, g=0
x=3, y=0, g=0
x=0, y=1, g=0
x=1, y=1, g=2
x=2, y=1, g=0
x=3, y=1, g=2
Experimental SetupExperimental Setup
Distinct RTL designs are input to GAUT [U. de LESTER, 2004]
Extract data-flow graphs for RTL designs
Construct the corresponding polynomial representations (F, G)
Extract bit-vector sizes for inputs and outputs
Determine the maximum number of simulation vectors required
Check for equivalence or determine bugs
Simulation Results for Equivalent DesignsSimulation Results for Equivalent Designs
1.00E+001.00E+051.00E+101.00E+151.00E+201.00E+251.00E+301.00E+351.00E+401.00E+451.00E+501.00E+551.00E+601.00E+651.00E+70
IRR PSK Degree-4Filter 1
Degree-4Filter 2
Savitzky-GolayFilter
4th orderIIR
MIBENCH
Total Test Vectors Required Test Vectors
Simulation Results for Buggy DesignsSimulation Results for Buggy Designs
1
10
100
1000
Anti-alias Function PSK 4th Order IIR VanishingPolynomial
Our approach Random Simulation
LimitationsLimitations
a = 127 b = 1 f1 = 383
c = 255
≠
a = 127 b = 1 f2 = 127c = 255
a[7:0] b[7:0]
t1[7:0]
+
c[7:0]
+
f1[8:0]
a[7:0] b[7:0]
t2[7:0]
+
c[7:0]
+
f2[8:0]
ConclusionsConclusions
Technique to verify equivalence of polynomial RTL
computations
Bit-vector arithmetic is polynomial algebra over the system
of finite integer rings
Exhaustive simulation is not necessary to prove
Results based on concepts from number theory and
polynomial algebra
n n n m1 2 d 22 2 2Z × Z × × Z Z
( ) % 2 ( ) % 2 m m
1 2 d 1 2 df x , x , , x = g x , x , , x
Questions ?Questions ?
Polynomial AbstractionPolynomial Abstraction
If (x > 2b’10)
then y = x * x * x
Else y = x*x
Traditional modeling
.
Proposed modeling: y as a polyfunction from
: Unique representation
Issues with the proposed abstraction:
Scalability
4 32Z Z3 2y 3x 8x 22x
3 2[0,2] y = x and 3 y = x x x =