Download presentation
Presentation is loading. Please wait.
1
Equivalence Verification of Polynomial Datapaths with Fixed-Size Bit-Vectors using Finite Ring Algebra 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 Problem Modeling Polynomial Functions over Finite Integer RingsPolynomial Functions over Finite Integer Rings Limitations of Previous Work Approach and Contributions Canonical form for Polynomials over Finite RingsCanonical form for Polynomials over Finite Rings Algorithm Design and Experimental Verification Runs Results, Conclusions & Future Work
3
The Equivalence Verification Problem
4
Motivation Quadratic filter design for polynomial signal processing y = a 0. x 1 2 + a 1. x 1 + b 0. x 0 2 + b 1. x 0 + c. x 0. x 1
5
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
6
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
7
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
8
Example 1: 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] To Prove: F 1 % 2 16 ≡ F 2 % 2 16 F 1 ≡ F 2 in Z 2 m [x 1, …, x d ]
9
Previous Work: Function Representations Boolean Representations ( f: B → B ): BDDs, ZBDDs 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 SAT, MILP, Word-level ATPG, … Theorem-Proving (HOL), term-rewriting Works when datapath size can be abstracted away
10
Previous 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, Z p Unique Factorization Domains (UFDs) : Uniquely factorize into irreducibles Match corresponding irreducibles to prove equivalence
11
Why is the Problem Difficult? Z 2 m is a non-UFD f = x 2 + 6x in Z 8 can be factorized as Atypical approach required to prove equivalence f x+6 f x+4x+2x
12
Proposed Solution f (x 1, …, x d ) % n ≡ g(x 1, …, x d ) % n Proving equivalence is NP-hard Vanishing polynomials [ICCD ‘05] f(x) – g(x) ≡ 0 % 2 m : Zero Equivalence An instance of Ideal Membership Testing Efficient solutions over fields (Groebner’s bases): Z 2 m [x 1,…, x d ] ? Canonical forms: Current focus Unique representations for polyfunctions over Z 2 m Equivalence by coefficient matching Concepts from Hungerbuhler et al. [To appear J. Sm. Not., ‘06 ]
13
Polyfunctions over Z 2 m Polynomials over Z 2 m [x 1, …, x d ] Represented by polyfunctions from Z 2 m [x 1, …, x d ] to Z 2 m F 1 % 2 m ≡ F 2 % 2 m => they have the same underlying polyfunction ( f ) Use equivalence classes of polynomials Derive representative for each class: Canonical form f g Equivalence classes Z 2 m [x 1, …, x d ] Z2mZ2m F2F2 F1F1 G2G2 G1G1
14
Motivating our Approach module fixed_bit_width (x, f, g); input [2:0] x; output [2:0] f, g; assign f[2:0] = 5x 2 + 6x - 3; assign g[2:0] = x 2 + 2x + 5; f (x) = 5x 2 + 6x - 3 = (x 2 + 2x + 5) + (4x 2 + 4x) f (x) = g(x) + V (x) in Z 2 3 V (x) = 4x 2 + 4x ≡ 0 % 2 3 ; for x in {0,…,7} f (x) = g (x) + 0 in Z 2 3 Required: To identify and eliminate such redundant sub-expressions (vanishing)
15
Vanishing polynomials: Requirement 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) Z2mZ2m Set of all Vanishing polynomials f g Z 2 m [x 1, …, x d ] 0 h: % 2 m
16
Vanishing Polynomials for Reducibility In Z 2 3, say f (x) = 4x 2 f (x) = f (x) - V(x) Generate V(x) of degree 2 V(x) = 4x 2 + 4x ≡ 0 % 2 3 Reduce by subtraction: 4x 2 f (x) – 4x 2 + 4x V(x) = - 4x = - 4x % 8 = 4x 4x 2 can be reduced to 4x Degree reduction
17
Coefficient Reduction: Example Degree is not always reducible In Z 2 3, f (x) = 6x 2 a = 6 k = 2 Divide and subtract 6x 2 = 2x 2 + 4x 2 % 2 3 4x 2 can be reduced to 4x f (x) = 2x 2 + 4x : Lower Coefficient
18
Our Approach Say f (x) = a k x k + a k-1 x k-1 + …+ a 0 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 …
19
Degree Reduction: Requirement Generate appropriate vanishing polynomial, V(x) f (x) = ax k + a 1 x k-1 + … V(x) = ax k + a 2 x k-1 + … f (x) – V(x) = bx k-1 + … V(x): ax k is the leading term Identify constraints on Degree : k Coefficient : a Use concepts from number theory
20
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) of 2 m = n SF(2 3 ) = 4, since 2 3 |4! 2 m divides the product of n = SF(2 m ) consecutive numbers Use SF(2 m ) to generate vanishing polynomial V(x)
21
Results From Number Theory V (x) ≡ 0 % 2 3 2 3 | V (x) in Z 2 3 2 3 | 4!, since SF(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) = 4! x + 4 ≡ 0 % 2 3 4 Write V(x) as a product of SF(2 3 ) = 4 consecutive numbers
22
Constraints on the Coefficient In Z 2 3, SF(2 3 ) = 4. Product of 4 consecutive numbers: (x+1) (x+2) missing factors V (x) = 4x 2 + 4x = (x+1)(x+2) ≡ 0 % 2 3 compensated by constant 4(x+1)(x+2) = 4·2!· x + 2 2 f (x) = ax k + … Rule 1: If 2 m |ak!, then V(x) = ak! x + k ≡ 0 % 2 m k = ax k + a 1 x k-1 ….. (x+3) (x+4) 4
23
Example: Vanishing Polynomial Consider f (x) = 4x 2 in Z 2 3 a = 4 k = 2 V (x) = ? Rule 1: 2 m |a·k! => 2 3 | 4 · 2! V (x) = a · k! x + k = 4. 2! x + 2 = 4. 2! (x+2) (x+1) k 2 2! = 4x 2 + 4x ≡ 0 % 2 3 f (x) = 4x 2 V(x) = - 4x 2 + 4x = - 4x = - 4x % 8 = 4x
24
Coefficient Reduction: Requirement Define v 2 (k!) = {max x Є N: 2 x | k!} number-of-factors-2 in k! v 2 (4!) = v 2 (4 * 3 * 2* 1) = 3 Rule 1: 2 m | a · k! Number-of-factors-2 in a·k! ≥ m or v 2 (a·k!) ≥ m If 2 m does not divide a · k! v 2 (a·k!) < m v 2 (k!) < m and a < 2 m- v 2 (k!) Rule 2: Coefficient ( a ) has to be in the range {0, …, 2 m- v 2 (k!) -1} Constraint on coefficient Constraint on degree
25
Notation: Multivariate Polynomials Given d variables x = with degrees k = Replace in Rule 1 and Rule 2 x k = ∏ d i=1 x i k i k! = ∏ d i=1 k i ! x = ∏ d i=1 x i k k i v 2 (k!) = ∏ d v 2 (k i !) Use lexicographic term ordering for variables
26
Uniqueness Theorem: Any polynomial F in Z 2 m can be uniquely written as F = Σ kЄN d α k x k d is the number of variables α k Є {0, …, 2 m- v2(k!) -1} is the coefficient v 2 (k!) < m
27
Reduction Procedure Given a monomial f (x) = a·x k Degree reduction: Determine if 2 m | a·k! If yes, generate V(x) of with a·x k as the leading term f (x) = f (x) – V(x) If 2 m | a·k!, check if coefficient ( a ) is in {0, …, 2 m- v 2 (k!) -1} If not, perform division according to a·x k = q. 2 m- v2(k!) ·x k + r·x k Degree reducibleReduced form r < 2 m- v 2 (k!)
28
1. 1.Reducing 6x 2 y 2. 2.Degree Reduction: a = 6; k! = k x !.k y ! = 2!1! = 2 2 3 does not divide (a ·k! ) = 12; Degree reduction not possible Perform coefficient reduction Example: Reduction Given poly = 6x 2 y + 4xy in Z 2 3
29
3. 3.Coefficient Reduction: v 2 (k!) = v 2 (2! · 1!) = 1 Range = {0, …, 2 m- v 2 (k!) – 1} = {0,…, 3} a = 6 > 3; Can reduce coefficient 6x 2 y = 4x 2 y + 2x 2 y Degree reduction for 4x 2 y : Rule 1 : 2 3 | (4· 2! ·1!) 4x 2 y – 4. 2!·1! x + 2 y + 1 = 4xy 2 1 4. 4.poly = (4xy + 2x 2 y) + 4xy ≡ 2x 2 y in Z 2 3 Example: Reduction Given poly = 6x 2 y + 4xy in Z 2 3
30
Experimental 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(k d ); where k is the total degree and d is the number of variables Compare with BDD, BMD and SAT
31
Results
32
Conclusions & Future Work Technique to verify equivalence of multivariate polynomial RTL computations Fixed-size bit-vector arithmetic is polynomial algebra over the finite integer ring, Z 2 m f (x 1,…, x d ) % 2 m ≡ g (x 1, …, x d ) % 2 m 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
33
Questions?
34
Comparison
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.