1 / 37

Exploiting Vanishing Polynomials for Equivalence Verification of Fixed-Size Arithmetic Datapaths

Exploiting Vanishing Polynomials for Equivalence Verification of Fixed-Size Arithmetic Datapaths. 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.

tracia
Download Presentation

Exploiting Vanishing Polynomials for Equivalence Verification of Fixed-Size Arithmetic Datapaths

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Exploiting 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

  2. Outline • 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

  3. The Equivalence Verification Problem

  4. 8-bit * 16-bit 8-bit 8-bit * * 32-bit 8-bit * 8-bit 8-bit Fixed-size (m) bit-vector arithmetic Polynomials reduced %2m Algebra over the ring Z2m Fixed-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

  5. Fixed-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 - g%2m 2m 2m • Saturation Arithmetic • Saturate at overflow • Used in image-processing applications

  6. DFF Example: 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 coefficients coefficients a b x = a2 + b2 x MAC F

  7. Example: Anti-Aliasing Function • 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] • Transform the problem • F1 - F2 = 57344x5 + 16384x4 + 8192x3 + 16384x2 + 32768x ≡ 0 % 216 • F1 - F2 : 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: Z2m→ Z2m

  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 (Z2m)

  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, Zp • Unique Factorization Domains (UFDs) : Uniquely factorize into irreducibles • Match corresponding coefficients to prove equivalence

  11. Why is the Problem Difficult? • Z2mis a non-UFD • f = x2 + xinZ6can be factorized as f f x x+1 x+3 x+4 • Atypical approach required to prove equivalence

  12. Proposed 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 & Warren’s work [Proc. Amer. Math.Soc, 1957] • Singmaster’s work [J. Num. Th, 1974]

  13. h: % 2m Ideal x x % 2m 0 f g f – g ? Ideal Membership Testing Q P • h:P →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 ?

  14. Ideal Membership Testing in Zp • Fermat’s Little Theorem: • x p≡ x (mod p) or • x p – x ≡ 0 (mod p) • x p –xgenerates the vanishing ideal in Zp[x] • f(x) = 0 % p iff f(x) = (xp-x)g(x) • Zp: Principal Ideal Domain • This does not followin Z2m

  15. h: % 2m Ideal x x % 2m f g f – g ? Ideal Membership Testing 0 Q P • Generate the idealof 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]

  16. Results From Number Theory • n! divides a product of n consecutive numbers. • 4! divides 99X 100 X 101 X 102 • Find least n such that 2m|n! • Smarandache Function (SF). • SF(23) = 4, since 23|4! • 2mdivides the product of n = SF(2m) consecutive numbers

  17. Results From Number Theory • f ≡ gin Z23or(f - g) ≡ 0 % 23 • 23|(f - g)inZ23 • 23|4! • 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? • (x+1)

  18. Results From Number Theory • f ≡ gin Z23or(f - g) ≡ 0 % 23 • 23|(f - g)inZ23 • 23|4! • 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? • (x+1)(x+2)

  19. Results From Number Theory • f ≡ gin Z23or(f - g) ≡ 0 % 23 • 23|(f - g)inZ23 • 23|4! • 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? • (x+1)(x+2)(x+3)

  20. Results From Number Theory • f ≡ gin Z23or(f - g) ≡ 0 % 23 • 23|(f - g)inZ23 • 23|4! • 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? • (x+1)(x+2)(x+3)(x+4)

  21. Basis 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).

  22. Example 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 = (x+1)(x+2)(x+3)(x+4) = S4(x) inZ23. • 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] = 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} • 4x2+4x not equal to (x+1)(x+2)(x+3)(x+4) • Required: To show that h(x) is a vanishing polynomial in Z23

  24. Constraints on the Coefficient • h(x) = 4x2 + 4x = 4(x+1)(x+2) • In Z23, SF(23) = 4. Product of 4 consecutive numbers: • S4(x) = (x+1) (x+2) (x+3) (x+4) 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

  25. Constraints on the Coefficient • h(x) = 4x2 + 4x = 4(x+1)(x+2) compensated by constant • In Z23, SF(23) = 4. Product of 4 consecutive numbers: • S4(x) = (x+1) (x+2) (x+3) (x+4) 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

  26. Deciding Vanishing Polynomials • Polynomial F in Z2m vanishes if • n = SF(2m),i.e. the least n such that 2m|n! • Fn is an arbitrary polynomial in Z2m[x] • akis an arbitrary integer • bk = 2m/gcd(k!,2m) F = FnSn + Σn-1ak bk Sk k=0 Rule 1 Rule 2

  27. 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 + 4xin Z23 n = SF(23) = 4 k = 4: Divide by S4 Degree (poly) = 2 < degree(S4) = 4 quo = 0, rem = 4x2 + 4x F4 = 0; Continue Algorithm Example 1 F = FnSn + Σn-1ak bk Sk k=0

  28. 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 + 4xin Z23 n = SF(23) = 4 k = 4: Divide by S4 Degree (poly) = 2 < degree(S4) = 4 quo = 0, rem = 4x2 + 4x F4 = 0; Continue Algorithm Example 1 F = FnSn + Σn-1ak bk Sk k=0

  29. Reduce according to Rule 2. Divide by Sn-1to 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 < degree(S3) = 3 quo= 0, rem = 4x2 + 4xcontinue k = 2: Divide by S2 quo = 4; rem = 0 b2 = 23/gcd(2!,23) = 4 a2 = quo/ b2 = 1 ЄZ Algorithm Example 1 F = FnSn + Σn-1ak bk Sk k=0 poly = a2.b2.S2 = 1.4.(x+1)(x+2) ≡ 0 in Z23

  30. Reduce according to Rule 2. Divide by Sn-1to 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 < degree(S3) = 3 quo= 0, rem = 4x2 + 4xcontinue k = 2: Divide by S2 quo = 4; rem = 0 b2 = 23/gcd(2!,23) = 4 a2 = quo/ b2 = 1 ЄZ Algorithm Example 1 F = FnSn + Σn-1ak bk Sk k=0 poly = a2.b2.S2 = 1.4.(x+1)(x+2) ≡ 0 in Z23

  31. Example 2 • poly = 5x2 + 3x+ 7 inZ23 • n = SF(23) = 4 • degree (poly) = 2 < 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 inZ • poly does not satisfy Rule 2 • poly is not a vanishing polynomial inZ23

  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(Z2m)

  33. Results

  34. Applications to Synthesis • Datapath size (m): 8 bits • SF(28) = 10 • Polynomial can be factorized into S10(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) % 2m≡ g(x) % 2mis transformed into f(x) - g(x) ≡ 0 % 2m • 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?

More Related