Download presentation
Presentation is loading. Please wait.
Published byEarl Dawson Modified over 9 years ago
1
Exploiting Vanishing Polynomials for Equivalence Verification of Fixed-Size Arithmetic Datapaths Namrata Shekhar, Priyank Kalla, Florian Enescu, Sivaram Gopalakrishnan Namrata Shekhar 1, Priyank Kalla 1, Florian Enescu 2, Sivaram Gopalakrishnan 1 1 Department of Electrical and Computer Engineering, University of Utah, Salt Lake City, UT-84112. 2 Department of Mathematics and Statistics, Georgia State University, Atlanta, GA-30303
2
Outline Overall Verification Problem Our Focus: Equivalence Verification of Fixed-size Arithmetic DatapathsOur Focus: Equivalence Verification of Fixed-size Arithmetic Datapaths Applications: Polynomial Signal Processing, etc.Applications: Polynomial Signal Processing, etc. Problem Modeling and Approach Polynomials over Finite Integer RingsPolynomials over Finite Integer Rings Limitations of Previous Work Our Contributions Exploiting Vanishing Polynomials for Equivalence TestExploiting Vanishing Polynomials for Equivalence Test Related to Ideal Membership TestingRelated to Ideal Membership Testing Algorithm Design and Experimental Verification Runs Results Conclusions & Future Work
3
The Equivalence Verification Problem
4
Fixed-Size (m) Data-path: Modeling Control the datapath size: Fixed size bit-vectors ( m ) * * 8-bit 16-bit 32-bit * * 8-bit Bit-vector of size m : integer values in 0,…, 2 m -1 Fixed-size (m) bit-vector arithmetic Polynomials reduced %2 m Algebra over the ring Z 2 m
5
Fixed-Size Data-path: Implementation Signal Truncation Keep lower order m-bits, ignore higher bits f % 2 m ≡ g % 2 m Fractional Arithmetic with rounding Keep higher order m-bits, round lower order bits f - f %2 m ≡ g - g%2 m 2 m 2 m Saturation Arithmetic Saturate at overflow Used in image-processing applications
6
Example: Anti-Aliasing Function F = 1 = 1 = 2√a 2 + b 2 2√x [ Peymandoust et al, TCAD‘03 ] Expand into Taylor series F ≈ 1 x 6 – 9 x 5 + 115 x 4 64 32 64 – 75 x 3 + 279 x 2 – 81 x 16 64 32 + 85 64 Scale coefficients; Implement as bit-vectors MAC x = a 2 + b 2 coefficients ab x F DFF
7
Example: Anti-Aliasing Function F 1 [15:0], F 2 [15:0], x[15:0] F 1 = 156x 6 + 62724x 5 + 17968x 4 + 18661x 3 + 43593 x 2 + 40244x +13281 F 2 = 156x 6 + 5380x 5 + 1584x 4 + 10469x 3 + 27209 x 2 + 7456x + 13281 F 1 ≠ F 2 ; F 1 [15:0] = F 2 [15:0] Transform the problem F 1 - F 2 = 57344x 5 + 16384x 4 + 8192x 3 + 16384x 2 + 32768x ≡ 0 % 2 16 F 1 - F 2 : Vanishing polynomial
8
Previous Work: Function Representations Boolean Representations ( f: B → B ) BDDs, MTBDDs, ADDs etc. Moment Diagrams ( f: B → Z ) BMDs, K*BMDs, HDDs etc. Canonical DAGs for Polynomials ( f: Z → Z ) Taylor Expansion Diagrams (TEDs) Required: Representation for f: Z 2 m → Z 2 m
9
Previous 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 ( Z 2 m )
10
Previous 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, Z p Unique Factorization Domains (UFDs) : Uniquely factorize into irreducibles Match corresponding coefficients to prove equivalence
11
Why is the Problem Difficult? Z 2 m is a non-UFD f = x 2 + x in Z 6 can be factorized as Atypical approach required to prove equivalence f xx+1 f x+3x+4
12
Proposed Solution Equivalence can be proved by f (x) - g(x) ≡ 0 % 2 m : Zero Equivalence Exploit Vanishing polynomials An instance of Ideal Membership Testing Proposed solution based on: Niven & Warren’s work [Proc. Amer. Math.Soc, 1957] Singmaster’s work [J. Num. Th, 1974]
13
Ideal Membership Testing h:P →Q defined by % 2 m x in P maps to x %2 m in Q Ideal members map to 0 Derive Ideal of Vanishing Polynomials in Z 2 m Grobner's basis? Buchberger's algorithm? Known for UFDs, but for Z 2 m ? P Q Ideal x x % 2 m h: % 2 m 0 f g f – g ?
14
Ideal Membership Testing in Z p Fermat’s Little Theorem: x p ≡ x (mod p) or x p – x ≡ 0 (mod p) x p –x generates the vanishing ideal in Z p [x] f(x) = 0 % p iff f(x) = (x p -x)g(x) Z p : Principal Ideal Domain This does not follow in Z 2 m
15
Ideal Membership Testing Generate the ideal of vanishing polynomials % 2 m ? 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] P Q Ideal x x % 2 m h: % 2 m 0 f g f – g ?
16
Results 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 2 m |n! Smarandache Function (SF). SF(2 3 ) = 4, since 2 3 |4! 2 m divides the product of n = SF(2 m ) consecutive numbers
17
Results From Number Theory f ≡ g in Z 2 3 or (f - g) ≡ 0 % 2 3 2 3 |(f - g) in Z 2 3 2 3 |4! 4! divides the product of 4 consecutive numbers A polynomial as a product of 4 consecutive numbers? (x+1) Write (f-g) as a product of SF(2 3 ) = 4 consecutive numbers
18
Results From Number Theory f ≡ g in Z 2 3 or (f - g) ≡ 0 % 2 3 2 3 |(f - g) in Z 2 3 2 3 |4! 4! divides the product of 4 consecutive numbers A polynomial as a product of 4 consecutive numbers? (x+1)(x+2) Write (f-g) as a product of SF(2 3 ) = 4 consecutive numbers
19
Results From Number Theory f ≡ g in Z 2 3 or (f - g) ≡ 0 % 2 3 2 3 |(f - g) in Z 2 3 2 3 |4! 4! divides the product of 4 consecutive numbers A polynomial as a product of 4 consecutive numbers? (x+1)(x+2)(x+3) Write (f-g) as a product of SF(2 3 ) = 4 consecutive numbers
20
Results From Number Theory f ≡ g in Z 2 3 or (f - g) ≡ 0 % 2 3 2 3 |(f - g) in Z 2 3 2 3 |4! 4! divides the product of 4 consecutive numbers A polynomial as a product of 4 consecutive numbers? (x+1)(x+2)(x+3)(x+4) Write (f-g) as a product of SF(2 3 ) = 4 consecutive numbers
21
Basis for factorization S 0 (x) = 1 S 1 (x) = (x + 1) S 2 (x) = (x + 1)(x + 2) = Product of 2 consecutive numbers S 3 (x) = (x + 1)(x + 2)(x + 3) = Product of 3 consecutive numbers … S n (x) = (x + n) S n-1 (x) = Product of n consecutive numbers Rule 1: Factorize into atleast S n (x) to vanish, where n = SF(2 m ).
22
Example 1: Vanishing polynomial 4 th degree polynomial p in Z 2 3 ; SF(2 3 ) = 4 p = x 4 +2x 3 + 3x 2 + 2x p can be written as a product of 4 consecutive numbers. or p = (x+1)(x+2)(x+3)(x+4) = S 4 (x) in Z 2 3. p is a vanishing polynomial.
23
Example 2: Vanishing polynomial module fixed_bit_width (x, f, g); input [2:0] x; output [2:0] f, g; assign f[2:0] = x 2 + 6x – 3; assign g[2:0] = 5x 2 + 2x + 5; h(x) = f(x) – g(x) = 4x 2 + 4x h(x) ≡ 0 for all values of x in {0,…,7} 4x 2 +4x not equal to (x+1)(x+2)(x+3)(x+4) Required: To show that h(x) is a vanishing polynomial in Z 2 3
24
Constraints on the Coefficient h(x) = 4x 2 + 4x = 4(x+1)(x+2) In Z 2 3, SF(2 3 ) = 4. Product of 4 consecutive numbers: S 4 (x) = (x+1) (x+2) (x+3) (x+4) Rule 2: Coefficient has to be a multiple of b k = 2 m /gcd(k!, 2 m ) Here, Coefficient of h(x) = 4, Degree of h(x) = 2 b 2 = 2 3 /gcd(2!, 2 3 ) = 4 is a multiple of the coefficient
25
Constraints on the Coefficient h(x) = 4x 2 + 4x = 4(x+1)(x+2) compensated by constant In Z 2 3, SF(2 3 ) = 4. Product of 4 consecutive numbers: S 4 (x) = (x+1) (x+2) (x+3) (x+4) missing factors Rule 2: Coefficient has to be a multiple of b k = 2 m /gcd(k!, 2 m ) Here, Coefficient of h(x) = 4, Degree of h(x) = k = 2 b 2 = 2 3 /gcd(2!, 2 3 ) = 4 is a multiple of the coefficient
26
Deciding Vanishing Polynomials n = SF(2 m ), i.e. the least n such that 2 m |n! F n is an arbitrary polynomial in Z 2 m [x] a k is an arbitrary integer b k = 2 m /gcd(k!,2 m ) Polynomial F in Z 2 m vanishes if F = F n S n + Σ n-1 a k b k S k k=0 Rule 1 Rule 2
27
Algorithm Input: poly, 2 m 1. 1. Calculate n = SF(2 m ) 2. 2. k = n: Reduce according to Rule 1 Divide by S n If remainder is zero, F = F n S n, else Continue poly = 4x 2 + 4x in Z 2 3 1. 1. n = SF(2 3 ) = 4 2. 2. k = 4: Divide by S 4 Degree (poly) = 2 < degree(S 4 ) = 4 quo = 0, rem = 4x 2 + 4x F 4 = 0; Continue Example 1 F = F n S n + Σ n-1 a k b k S k k=0
28
Algorithm Input: poly, 2 m 1. 1. Calculate n = SF(2 m ) 2. 2. k = n: Reduce according to Rule 1 Divide by S n If remainder is zero, F = F n S n, else Continue poly = 4x 2 + 4x in Z 2 3 1. 1. n = SF(2 3 ) = 4 2. 2. k = 4: Divide by S 4 Degree (poly) = 2 < degree(S 4 ) = 4 quo = 0, rem = 4x 2 + 4x F 4 = 0; Continue Example 1 F = F n S n + Σ n-1 a k b k S k k=0
29
Algorithm 3. 3. Reduce according to Rule 2. Divide by S n-1 to S 0 Check if quotient is a multiple of b k = 2 m /gcd(k!,2 m ) If remainder is zero, stop. Else, continue 3. 3. k = 3: Divide by S 3 degree (poly) = 2 < degree(S 3 ) = 3 quo= 0, rem = 4x 2 + 4x continue 4. 4. k = 2: Divide by S 2 quo = 4; rem = 0 b 2 = 2 3 /gcd(2!,2 3 ) = 4 a 2 = quo/ b 2 = 1 Є Z Example 1 poly = a 2.b 2.S 2 = 1.4.(x+1)(x+2) ≡ 0 in Z 2 3 F = F n S n + Σ n-1 a k b k S k k=0
30
Algorithm 3. 3. Reduce according to Rule 2. Divide by S n-1 to S 0 Check if quotient is a multiple of b k = 2 m /gcd(k!,2 m ) If remainder is zero, stop. Else, continue 3. 3. k = 3: Divide by S 3 degree (poly) = 2 < degree(S 3 ) = 3 quo= 0, rem = 4x 2 + 4x continue 4. 4. k = 2: Divide by S 2 quo = 4; rem = 0 b 2 = 2 3 /gcd(2!,2 3 ) = 4 a 2 = quo/ b 2 = 1 Є Z Example 1 poly = a 2.b 2.S 2 = 1.4.(x+1)(x+2) ≡ 0 in Z 2 3 F = F n S n + Σ n-1 a k b k S k k=0
31
Example 2 poly = 5x 2 + 3x + 7 in Z 2 3 n = SF(2 3 ) = 4 degree (poly) = 2 < n. Skip Rule 1 and goto Rule 2 Divide by S 2 quo = 5; rem = 5 + 4x b 2 = 2 3 /gcd(2!,2 3 ) = 4 a 2 = quo/ b 2 is not in Z poly does not satisfy Rule 2 poly is not a vanishing polynomial in Z 2 3
32
Experimental 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(n+1), n = SF(Z 2 m )
33
Results
34
Applications to Synthesis Datapath size ( m ): 8 bits SF(2 8 ) = 10 Polynomial can be factorized into S 10 (x)
35
Conclusions Technique to verify equivalence of univariate polynomial RTL computations Fixed-size bit-vector arithmetic is polynomial algebra over finite integer rings f(x) % 2 m ≡ g(x) % 2 m is transformed into f(x) - g(x) ≡ 0 % 2 m Efficient algorithm to determine vanishing polynomials
36
Future 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
37
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.