Title: Exploiting Vanishing Polynomials for Equivalence Verification of Fixed-Size Arithmetic Datapaths
1Exploiting Vanishing Polynomials for Equivalence
Verification of Fixed-Size Arithmetic Datapaths
- Namrata Shekhar1, Priyank Kalla1, Florian
Enescu2, Sivaram Gopalakrishnan1 - 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
2Outline
- Overall Verification Problem
- Our Focus Equivalence Verification of Fixed-size
Arithmetic Datapaths - Applications Polynomial Signal Processing, etc.
- Problem Modeling and Approach
- Polynomials over Finite Integer Rings
- Limitations of Previous Work
- Our Contributions
- Exploiting Vanishing Polynomials for Equivalence
Test - Related to Ideal Membership Testing
- Algorithm Design and Experimental Verification
Runs - Results
- Conclusions Future Work
3The Equivalence Verification Problem
4Fixed-Size (m) Data-path Modeling
- Control the datapath size Fixed size bit-vectors
(m)
- Bit-vector of size m integer values in 0,, 2m-1
5Fixed-Size Data-path Implementation
- Signal Truncation
- Keep lower order m-bits, ignore higher bits
- f 2m g 2m
- Fractional Arithmetic with rounding
- Keep higher order m-bits, round lower order bits
- f - f 2m g - g2m
- 2m 2m
- Saturation Arithmetic
- Saturate at overflow
- Used in image-processing applications
6Example Anti-Aliasing Function
- F 1 1
- 2va2 b2 2vx
- Peymandoust et al, TCAD03
- 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
coefficients
coefficients
a
b
x a2 b2
x
MAC
F
7Example Anti-Aliasing Function
- F1150, F2150, x150
- F1 156x6 62724x5 17968x4 18661x3 43593
x2 - 40244x 13281
- F2 156x6 5380x5 1584x4 10469x3 27209
x2 7456x - 13281
- F1 ? F2 F1150 F2150
- Transform the problem
- F1 - F2 57344x5 16384x4 8192x3 16384x2
32768x - 0 216
- F1 - F2 Vanishing polynomial
8Previous Work Function Representations
- Boolean Representations (f B ? B)
- BDDs, MTBDDs, ADDs etc.
- Moment Diagrams (f B ? Z)
- BMDs, KBMDs, HDDs etc.
- Canonical DAGs for Polynomials (f Z ? Z)
- Taylor Expansion Diagrams (TEDs)
- Required Representation for f Z2m ? Z2m
9Previous Work Others
- SAT and MILP-based techniques
- Suitable for linear/multi-linear forms
- Word-level ATPG, congruence closure based
techniques, co-operative decision procedures - Solve linear congruences under modulo arithmetic
- Theorem-Proving (HOL), term-rewriting
- Works when datapath size can be abstracted using
data dependence, symmetry, and other abstractions
- Here, datapath size (m) defines ring cardinality
(Z2m)
10Previous Work Symbolic Algebra
- MODDs Based on finite fields Pradhan et al,
DATE 04 - Literal based decomposition
- Symbolic Algebra Tools Singular, Macaulay,
Maple, - Mathematica, Zen, etc.
- Polynomial equivalence over R, Q, C, Zp
- Unique Factorization Domains (UFDs) Uniquely
factorize into irreducibles - Match corresponding coefficients to prove
equivalence
11Why is the Problem Difficult?
- Z2m is a non-UFD
- f x2 x in Z6 can be factorized as
f
f
x
x1
x3
x4
- Atypical approach required to prove equivalence
12Proposed Solution
- Equivalence can be proved by
- f (x) - g(x) 0 2m Zero Equivalence
- Exploit Vanishing polynomials
- An instance of Ideal Membership Testing
- Proposed solution based on
- Niven Warrens work Proc. Amer. Math.Soc,
1957 - Singmasters work J. Num. Th, 1974
13Ideal Membership Testing
Q
P
- hP ?Q defined by 2m
- x in P maps to x 2m in Q
- Ideal members map to 0
- Derive Ideal of Vanishing Polynomials in Z2m
- Grobner's basis? Buchberger's algorithm?
- Known for UFDs, but for Z2m ?
14Ideal Membership Testing in Zp
- Fermats Little Theorem
- x p x (mod p) or
- x p x 0 (mod p)
- x p x generates the vanishing ideal in Zpx
- f(x) 0 p iff f(x) (xp-x)g(x)
- Zp Principal Ideal Domain
- This does not follow in Z2m
15Ideal Membership Testing
0
Q
P
- Generate the ideal of vanishing polynomials 2m
? - Vanishing Ideal is finitely generated
- Niven et al, Am. Math. Soc., 57
- Need an algorithm for membership testing
- Representative expression for members of this
ideal - Singmaster, J. Num. Th 74
16Results From Number Theory
- n! divides a product of n consecutive numbers.
- 4! divides 99 X 100 X 101 X 102
- Find least n such that 2mn!
- Smarandache Function (SF).
- SF(23) 4, since 234!
- 2m divides the product of n SF(2m) consecutive
numbers
17Results From Number Theory
- f g in Z23 or (f - g) 0 23
- 23(f - g) in Z23
- 234!
- 4! divides the product of 4 consecutive numbers
Write (f-g) as a product of SF(23) 4
consecutive numbers
- A polynomial as a product of 4 consecutive
numbers? - (x1)
18Results From Number Theory
- f g in Z23 or (f - g) 0 23
- 23(f - g) in Z23
- 234!
- 4! divides the product of 4 consecutive numbers
Write (f-g) as a product of SF(23) 4
consecutive numbers
- A polynomial as a product of 4 consecutive
numbers? - (x1)(x2)
19Results From Number Theory
- f g in Z23 or (f - g) 0 23
- 23(f - g) in Z23
- 234!
- 4! divides the product of 4 consecutive numbers
Write (f-g) as a product of SF(23) 4
consecutive numbers
- A polynomial as a product of 4 consecutive
numbers? - (x1)(x2)(x3)
20Results From Number Theory
- f g in Z23 or (f - g) 0 23
- 23(f - g) in Z23
- 234!
- 4! divides the product of 4 consecutive numbers
Write (f-g) as a product of SF(23) 4
consecutive numbers
- A polynomial as a product of 4 consecutive
numbers? - (x1)(x2)(x3)(x4)
21Basis for factorization
- S0(x) 1
- S1(x) (x 1)
- S2(x) (x 1)(x 2) Product of 2
consecutive numbers - S3(x) (x 1)(x 2)(x 3) Product of 3
consecutive numbers
-
-
- Sn(x) (x n) Sn-1(x) Product of n
consecutive numbers
Rule 1 Factorize into atleast Sn(x) to vanish,
where n SF(2m).
22Example 1 Vanishing polynomial
- 4th degree polynomial p in Z23 SF(23) 4
- p x4 2x3 3x2 2x
- p can be written as a product of 4 consecutive
numbers. - or p (x1)(x2)(x3)(x4) S4(x) in Z23.
- p is a vanishing polynomial.
23Example 2 Vanishing polynomial
- module fixed_bit_width (x, f, g)
- input 20 x
- output 20 f, g
- assign f20 x2 6x 3
- assign g20 5x2 2x 5
- h(x) f(x) g(x) 4x2 4x
- h(x) 0 for all values of x in 0,,7
- 4x24x not equal to (x1)(x2)(x3)(x4)
- Required To show that h(x) is a vanishing
polynomial in Z23
24Constraints on the Coefficient
- h(x) 4x2 4x 4(x1)(x2)
- In Z23 , SF(23) 4. Product of 4 consecutive
numbers - S4(x) (x1) (x2) (x3) (x4)
-
Rule 2 Coefficient has to be a multiple of bk
2m/gcd(k!, 2m)
- Here, Coefficient of h(x) 4, Degree of h(x)
2 - b2 23/gcd(2!, 23) 4 is a multiple of the
coefficient
25Constraints on the Coefficient
- h(x) 4x2 4x 4(x1)(x2)
- compensated by constant
- In Z23 , SF(23) 4. Product of 4 consecutive
numbers - S4(x) (x1) (x2) (x3) (x4)
- missing factors
Rule 2 Coefficient has to be a multiple of bk
2m/gcd(k!, 2m)
- Here, Coefficient of h(x) 4, Degree of h(x)
k 2 - b2 23/gcd(2!, 23) 4 is a multiple of the
coefficient
26Deciding Vanishing Polynomials
- Polynomial F in Z2m vanishes if
F FnSn S n-1ak bk Sk
k0 Rule 1
Rule 2
- n SF(2m), i.e. the least n such that 2mn!
- Fn is an arbitrary polynomial in Z2mx
- ak is an arbitrary integer
- bk 2m/gcd(k!,2m)
27Algorithm
Example 1
F FnSn S n-1ak bk Sk k0
- Input poly, 2m
- Calculate n SF(2m)
- k n Reduce according to Rule 1
- Divide by Sn
- If remainder is zero, F FnSn, else Continue
- poly 4x2 4x in Z23
- n SF(23) 4
- k 4 Divide by S4
- Degree (poly) 2
- lt degree(S4) 4
- quo 0, rem 4x2 4x
- F4 0 Continue
28Algorithm
Example 1
F FnSn S n-1ak bk Sk k0
- Input poly, 2m
- Calculate n SF(2m)
- k n Reduce according to Rule 1
- Divide by Sn
- If remainder is zero, F FnSn, else Continue
- poly 4x2 4x in Z23
- n SF(23) 4
- k 4 Divide by S4
- Degree (poly) 2
- lt degree(S4) 4
- quo 0, rem 4x2 4x
- F4 0 Continue
29Algorithm
Example 1
F FnSn S n-1ak bk Sk k0
- Reduce according to Rule 2. Divide by Sn-1 to S0
- Check if quotient is a multiple of
- bk 2m/gcd(k!,2m)
- If remainder is zero, stop. Else, continue
- k 3 Divide by S3
- degree (poly) 2 lt degree(S3) 3
- quo 0, rem 4x2 4x continue
- k 2 Divide by S2
- quo 4 rem 0
- b2 23/gcd(2!,23) 4
- a2 quo/ b2 1 ? Z
poly a2.b2.S2 1.4.(x1)(x2) 0 in Z23
30Algorithm
Example 1
F FnSn S n-1ak bk Sk k0
- Reduce according to Rule 2. Divide by Sn-1 to S0
- Check if quotient is a multiple of
- bk 2m/gcd(k!,2m)
- If remainder is zero, stop. Else, continue
- k 3 Divide by S3
- degree (poly) 2 lt degree(S3) 3
- quo 0, rem 4x2 4x continue
- k 2 Divide by S2
- quo 4 rem 0
- b2 23/gcd(2!,23) 4
- a2 quo/ b2 1 ? Z
poly a2.b2.S2 1.4.(x1)(x2) 0 in Z23
31Example 2
- poly 5x2 3x 7 in Z23
- n SF(23) 4
- degree (poly) 2 lt n. Skip Rule 1 and goto Rule
2 - Divide by S2
- quo 5 rem 5 4x
- b2 23/gcd(2!,23) 4
- a2 quo/ b2 is not in Z
- poly does not satisfy Rule 2
- poly is not a vanishing polynomial in Z23
32Experimental 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 size
- Find the difference (f-g) and invoke the
algorithm - Algorithm implemented in MAPLE
- Compare with BMD, SAT and MILP
- Complexity O(n1), n SF(Z2m)
33Results
34Applications to Synthesis
- Datapath size (m) 8 bits
- SF(28) 10
- Polynomial can be
- factorized into S10(x)
35Conclusions
- Technique to verify equivalence of univariate
polynomial RTL computations - Fixed-size bit-vector arithmetic is polynomial
algebra over finite integer rings - f(x) 2m g(x) 2m is transformed into f(x) -
g(x) 0 2m - Efficient algorithm to determine vanishing
polynomials
36Future Work
- Future Work involves extensions for -
- Multivariate datapaths with fixed bit-widths
- To Appear, ICCAD 05
- Multiple Word-length Implementations
- In Review, DATE 06
- Verification of Rounding and Saturation
Arithmetic - Formal Error Analysis
- Applications to Synthesis
- Need cost models for low power, area, delay
37Questions?