Title: Equivalence Verification of Polynomial Datapaths with FixedSize BitVectors using Finite Ring Algebra
1Equivalence Verification of Polynomial Datapaths
with Fixed-Size Bit-Vectors using Finite Ring
Algebra
- 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 - Problem Modeling
- Polynomial Functions over Finite Integer Rings
- Limitations of Previous Work
- Approach and Contributions
- Canonical form for Polynomials over Finite Rings
- Algorithm Design and Experimental Verification
Runs - Results, Conclusions Future Work
3The Equivalence Verification Problem
4Motivation
- Quadratic filter design for polynomial signal
processing - y a0 . x12 a1 . x1 b0 . x02 b1 . x0 c
. x0 . x1
5Fixed-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
6Fixed-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
7Example 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
8Example 1 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
- To Prove F1 216 F2 216
- F1 F2 in Z2mx1, , xd
9Previous Work Function Representations
- Boolean Representations (f B ? B) BDDs, ZBDDs
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
- SAT, MILP, Word-level ATPG,
- Theorem-Proving (HOL), term-rewriting
- Works when datapath size can be abstracted away
10Previous Work Symbolic Algebra
- Symbolic Algebra Tools Singular, Macaulay,
Maple, - Mathematica, Zen, Dagwood etc.
- Polynomial representations Sparse, Dense,
Recursive, Straight-line programs, DAGs, etc. - Polynomial equivalence over R, Q, C, Zp
- Unique Factorization Domains (UFDs) Uniquely
factorize into irreducibles - Match corresponding irreducibles to prove
equivalence
11Why is the Problem Difficult?
- Z2m is a non-UFD
- f x2 6x in Z8 can be factorized as
f
f
x6
x4
x2
x
- Atypical approach required to prove equivalence
12Proposed Solution
- f (x1, , xd) n g(x1, , xd) n
- Proving equivalence is NP-hard
- Vanishing polynomials ICCD 05
- f(x) g(x) 0 2m Zero Equivalence
- An instance of Ideal Membership Testing
- Efficient solutions over fields (Groebners
bases) Z2mx1,, xd ? - Canonical forms Current focus
- Unique representations for polyfunctions over Z2m
- Equivalence by coefficient matching
- Concepts from Hungerbuhler et al. To appear J.
Sm. Not., 06
13Polyfunctions over Z2m
f
F2
g
G2
Z2mx1, , xd
Z2m
- Polynomials over Z2mx1, , xd
- Represented by polyfunctions from Z2mx1, , xd
to Z2m - F1 2m F2 2m gt they have the same
underlying polyfunction (f ) - Use equivalence classes of polynomials
- Derive representative for each class Canonical
form
14Motivating our Approach
- module fixed_bit_width (x, f, g)
- input 20 x
- output 20 f, g
- assign f20 5x2 6x - 3
- assign g20 x2 2x 5
- f (x) 5x2 6x - 3 (x2 2x 5) (4x2 4x)
- f (x) g(x) V (x) in Z23
- V (x) 4x2 4x 0 23 for x in 0,,7
- f (x) g (x) 0 in Z23
- Required To identify and eliminate such
redundant sub-expressions
(vanishing)
15Vanishing polynomials Requirement
Set of all Vanishing polynomials
0
f
g
Z2m
Z2mx1, , xd
- Generate vanishing expressions V(x)
- Test if f (x) g (x) V(x)
- f (x) f (x) V(x)
- Challenge Infinite number of vanishing
polynomials - Required To generate V(x) specific to given f
(x)
16Vanishing Polynomials for Reducibility
- In Z23, say f (x) 4x2
- f (x) f (x) - V(x)
- Generate V(x) of degree 2
- V(x) 4x2 4x 0 23
- Reduce by subtraction
- 4x2 f (x)
- 4x2 4x V(x)
- - 4x - 4x 8 4x
- 4x2 can be reduced to 4x
- Degree reduction
17Coefficient Reduction Example
- Degree is not always reducible
- In Z23, f (x) 6x2
- a 6
- k 2
- Divide and subtract
- 6x2 2x2 4x2 23
- 4x2 can be reduced to 4x
- f (x) 2x2 4x Lower Coefficient
18Our Approach
- Say f (x) akxk ak-1xk-1 a0
- In decreasing lexicographic order
- Required f (x) in reduced, minimal, unique form
- Check if degree can be reduced
- Check if coefficient can be reduced
- Perform corresponding reductions
- Repeat for all monomials
19Degree Reduction Requirement
- Generate appropriate vanishing polynomial , V(x)
- f (x) axk a1xk-1
- V(x) axk a2xk-1
- f (x) V(x) bxk-1
- V(x) axk is the leading term
- Identify constraints on
- Degree k
- Coefficient a
- Use concepts from number theory
20Results 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) of 2m n
- SF(23) 4, since 234!
- 2m divides the product of n SF(2m) consecutive
numbers - Use SF(2m) to generate vanishing polynomial V(x)
21Results From Number Theory
- V (x) 0 23
- 23 V (x) in Z23
- 23 4! , since SF(23) 4
- 4! divides the product of 4 consecutive numbers
Write V(x) as a product of SF(23) 4 consecutive
numbers
- A polynomial as a product of 4 consecutive
numbers? - (x1)(x2)(x3)(x4) 4! x 4 0 23
-
4
22Constraints on the Coefficient
- In Z23 , SF(23) 4. Product of 4 consecutive
numbers - (x1) (x2)
- missing factors
- V (x) 4x2 4x (x1)(x2) 0 23
- compensated by constant
- 4(x1)(x2) 42! x 2
- 2
(x3) (x4)
4
Rule 1 If 2mak!, then V(x) ak! x k 0
2m k
axk a1xk-1..
23Example Vanishing Polynomial
- Consider f (x) 4x2 in Z23
- a 4
- k 2
- V (x) ?
- Rule 1 2mak! gt 23 42!
- V (x) ak! x k 4. 2! x 2 4. 2!
(x2) (x1) - k
2 2! - 4x2 4x 0 23
- f (x) 4x2
- V(x) - 4x2 4x
- - 4x - 4x 8 4x
24Coefficient Reduction Requirement
- Define v2(k!) max x ? N 2x k!
- number-of-factors-2 in k!
- v2(4!) v2(4 3 2 1) 3
- Rule 1 2m ak!
- Number-of-factors-2 in ak! m or
- v2(ak!) m
- If 2m does not divide ak!
- v2(ak!) lt m
- v2(k!) lt m and a lt 2m- v2(k!)
Constraint on degree
Constraint on coefficient
Rule 2 Coefficient (a) has to be in the range
0, , 2m- v2(k!)-1
25Notation Multivariate Polynomials
- Given d variables x ltx1, , xdgt
- with degrees k ltk1, , kdgt
- Replace in Rule 1 and Rule 2
- xk ?di1 xiki
- k! ?di1 ki!
- x ?di1 xi
- k ki
- v2(k!) ?d v2(ki!)
- Use lexicographic term ordering for variables
26Uniqueness
- Theorem Any polynomial F in Z2m can be uniquely
written as
F S k?Nd ak xk
- d is the number of variables
- ak ? 0, , 2m- v2(k!)-1 is the coefficient
- v2(k!) lt m
27Reduction Procedure
- Given a monomial f (x) axk
- Degree reduction Determine if 2m ak!
- If yes, generate V(x) of with axk as the leading
term - f (x) f (x) V(x)
- If 2m ak!, check if coefficient (a) is in 0,
, 2m- v2(k!)-1 - If not, perform division according to
- axk q. 2m- v2(k!)xk rxk
Degree reducible
Reduced form r lt 2m- v2(k!)
28Example Reduction
Given poly 6x2y 4xy in Z23
- Reducing 6x2y
- Degree Reduction
- a 6
- k! kx!.ky! 2!1! 2
- 23 does not divide (a k! ) 12
- Degree reduction not possible
- Perform coefficient reduction
29Example Reduction
Given poly 6x2y 4xy in Z23
- Coefficient Reduction
- v2(k!) v2(2!1!) 1
- Range 0, , 2m- v2(k!) 1 0,, 3
- a 6 gt 3 Can reduce coefficient
- 6x2y 4x2y 2x2y
- Degree reduction for 4x2y
- Rule 1 23 (4 2! 1!)
- 4x2y 4 . 2!1! x 2 y 1 4xy
- 2
1 - poly (4xy 2x2y) 4xy 2x2y in Z23
30Experimental Setup
- Distinct RTL designs are input to GAUT U. de
LESTER, 04 - Extract data-flow graphs for RTL designs
- Construct the corresponding polynomial
representations (f, g) - Extract bit-vector size
- Reduce f and g to canonical form
- Equivalence check by coefficient matching
- Algorithm implemented in MAPLE
- Complexity O(kd) where k is the total degree
and d is the number of variables - Compare with BDD, BMD and SAT
31Results
32Conclusions Future Work
- Technique to verify equivalence of multivariate
polynomial RTL computations - Fixed-size bit-vector arithmetic is polynomial
algebra over the finite integer ring, Z2m - f (x1,, xd) 2m g (x1, , xd) 2m is proved
by reduction to canonical form - Efficient algorithm to determine unique
representations - Future Work involves extensions for -
- Multiple Word-length Implementations DATE 06
- Verification of Rounding and Saturation
Arithmetic
33Questions?
34Comparison