Download presentation
Presentation is loading. Please wait.
Published byJared Simon Modified over 8 years ago
1
SIMULATION BOUNDS FOR EQUIVALENCE VERIFICATION OF ARITHMETIC DATAPATHS WITH FINITE WORD-LENGTH OPERANDS Namrata Shekhar, Priyank Kalla, M. Brandon Meredith 2, Florian Enescu Namrata Shekhar 1, Priyank Kalla 1, M. Brandon Meredith 2, Florian Enescu 2 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 Problem Overview Application: Arithmetic datapaths in DSP designs Problem modeling Polynomial functions over finite integer rings Limitations of previous work Theory and Applications Results and Conclusions Future work
3
The Equivalence Verification Problem
4
Fixed Bit-width Operands 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
General Datapath Model Bit-vector operands with different word-lengths Input variables : {x 1,…, x d } Output variables : f Input bit-widths: {n 1,…, n d } Output width : m. Model f as polynomial function * * 8-bit 12-bit 20-bit 32-bit
6
Arithmetic Data-path: Implementation Signal Truncation Keep lower-order bits, ignore higher bits. Fractional Arithmetic with rounding Keep higher-order m-bits, round lower order bits. Saturation Arithmetic Saturate at overflow Used in image-processing applications
7
Motivation: Motivation: Convolution of A and B Datapath size is fixed How many simulation vectors required to prove C = C’ ? FFT(A) invFFT(FAB) FFT(B) a0a0 a1a1 a2a2 a3a3 b0b0 b1b1 b2b2 b3b3 FAB 0 FAB 1 FAB 2 FAB 3 c’ 0 c’ 1 c’ 2 c’ 3 C = (c 0, c 1, c 2, c 3 ) where C ′ = (c′ 0, c ′ 1, c ′ 2, c ′ 3 ) = DFT -1 (DFT(A)·DFT(B))
8
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 coefficients
9
Example: Anti-Aliasing Function Implemented as a fixed size datapath in x 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] How many vectors required to prove : F 1 % 2 16 ≡ F 2 % 2 16
10
Contributions Abstract the design as a polynomial function Exhaustive simulation is not necessary to prove equivalence Upper bound on the number of vectors To prove equivalence Sufficient to catch errors Bound corresponds to a function in number theory
11
Previous Work Bit/Word level canonical diagrams BDDs, ZBDDs, BMDs, TEDs SAT and MILP-based techniques Bit-vector decision procedures, Word-level ATPG, SMT Theorem-Proving, term-rewriting Problem model is algebraic
12
Previous Work: Simulation Reduction in simulation complexity Three-valued logic simulation [Bryant, ACM ’91] Utilizing structural information [Brand, ICCAD ’92] Automated approach using BDDs [Yuan, ICCAD ‘99] Polynomial methods using the fundamental theorem of algebra Generate simulation vectors [Sanchez, HLDVT ‘99] Reduce the complexity of model checking [ Raudvere, ICCAD ‘05]
13
Fundamental Theorem of Algebra A degree- k polynomial F(x) has exactly k roots F(x) = x 2 + 6x = x ( x + 6 ) If F(x) = 0 for k + 1 values, then F(x) is a zero polynomial Can also be extended for multi-variate polynomials Limitations: Results applicable only over unique factorization domains (UFD): Z, Z p, C Z 2 m is a non-UFD
14
Why is the Problem Difficult? Consider F(x) = x 2 + 6x in Z 8 Degree- 2 polynomial has 4 unique roots F(x) = 0 for 4 vectors, but F(x) ≠ 0 in Z 8 Not applicable to bit-vector arithmetic F x+6 F x+4x+2x
15
Previous Work: Finite Ring Algebra f (x 1, …, x d ) % n ≡ g(x 1, …, x d ) % n Proving equivalence is NP-hard [Ibarra et al, ACM ‘83] Previous approaches f (x 1, x 2, …, x d ) – g (x 1, x 2, …, x d ) ≡ 0 % 2 m : Zero Equivalence [ICCD ’05] Reduction to canonical forms [ICCAD ’05] Limitations: Intermediate expression swell No error trace is provided Simulation vector generation: Based on zero equivalence
16
Zero Equivalence 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}: Vanishing polynomial Required: To find if any given expression vanishes Use concepts from ideal membership testing
17
Ideal Membership Testing h:Z 2 m[x] → Z 2 m defined by % 2 m Ideal members map to 0 Test for membership in Representative expression for members of this ideal [Chen, Disc. Math ‘96] Use concepts from Number theory and polynomial algebra Ideal xixi x i % 2 m h: % 2 m 0 f g f – g ? Z2m[x]Z2m[x] Ideal of Vanishing Polynomials Z2mZ2m
18
Results From Number Theory Find least n such that 2 m |n! Smarandache Function: λ = SF (2 m ) λ = SF(2 3 ) = 4, since 2 3 |4! n! divides a product of n consecutive numbers 4! divides 99 X 100 X 101 X 102 2 m divides the product of n consecutive numbers 2 3 divides the product of 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 divides the product of 4 consecutive numbers If (F-G) is a product of 4 consecutive numbers then 2 3 |(F - G) A polynomial as a product of 4 consecutive numbers?. (x-1)(x-2)(x-3)(x)
20
Basis for Factorization Y 0 (x) = 1 Y 1 (x) = (x) Y 2 (x) = (x)(x - 1) = Product of 2 consecutive numbers Y 3 (x) = (x)(x - 1)(x - 2) = Product of 3 consecutive numbers … Y k (x) = (x – k + 1) Y k-1 (x) = Product of k consecutive numbers Rule 1: Factorize into at least Y λ (x) to vanish, where λ = SF(2 m )
21
Example 1: Vanishing Polynomial 4 th degree polynomial F over Z 2 3 λ = 4. Degree (x) = k = 4 = λ F can be written as a product of 4 consecutive numbers in x. F is a vanishing polynomial
22
Constraints on the Coefficient F(x) = 4x 2 + 4x = (x)(x-1) % 2 3 Y 4 (x) = (x)(x-1) Rule 2: Coefficient has to be a multiple of b k = 2 m /gcd(k!, 2 m ) Here, Coefficient of F(x) = 4, Degree of F(x) = 2 b 2 = 2 3 /gcd(2!, 2 3 ) = 4 is a multiple of the coefficient Use Rule 1 and Rule 2 to determine if any F(x) = 0 % 2 m compensated by constant missing factor (x-2)(x-3) 4
23
Deciding Vanishing Polynomials F λ is an arbitrary polynomial over Y λ = Y k is as defined earlier: λ = SF(2 m ) a k is an arbitrary integer. Polynomial F in vanishes if Rule 1 Rule 2
24
Polynomial Representations : Forward difference operator p is the degree of F(x) Newton’s interpolation formula: Any polynomial F(x) can be written as
25
Polynomial Representations : Forward difference operator p is the degree of F(x) Newton’s interpolation formula: Any polynomial F(x) can be written as
26
Reinterpret Vanishing ideal : Forward difference operator Y k (x) is as defined earlier p is the degree of F(x) Newton’s interpolation formula: Any polynomial F(x) can be written as
27
Reinterpret Vanishing ideal : Forward difference operator Y k (x) is as defined earlier p is the degree of F(x) Newton’s interpolation formula: Any polynomial F(x) can be written as
28
Polynomial Representations is any arbitrary integer Y k (x) is as defined earlier p is the degree of F(x) Newton’s interpolation formula: Any polynomial F(x) can be written as
29
Polynomial Representations F λ is an arbitrary polynomial over Y λ = Y k is as defined earlier: λ = SF(2 m ) is an arbitrary integer Any polynomial F(x) in can be written as Rule 1 0
30
Polynomial Representations F λ is an arbitrary polynomial over Y λ = Y k is as defined earlier: λ = SF(2 m ) is an arbitrary integer Any polynomial F(x) in can now be reduced to
31
Polynomial Representations Apply Rule 2 F( x ) vanishes iff c k is a multiple of Check for all c k, where c k evaluated no more than λ times F(x) evaluated no more than λ times Any polynomial F(x) in can now be reduced to
32
Results By extension, If F(x) ≡ 0 for any λ consecutive values of x in. Further, F(x) – G(x) = 0 → F(x) = G(x) Any λ consecutive values of x are sufficient to prove equivalence
33
Example f = x 4 + x 2 Simulating, x=0, f=0 x=1, f=2 x=2, f=4 x=3, f=2 x=4, f=0 x=5, f=2 x=6, f=4 x=7, f=2 Consider f, g over Z 2 3 λ = SF(2 3 ) = 4 g = 2x 2 Simulating, x=0, g=0 x=1, g=2 x=2, g=0 x=3, g=2 x=4, g=0 x=5, g=2 x=6, g=0 x=7, g=2
34
Extension to Multiple Variables Given d variables x = with degrees k = over Z 2 m Basis for d variables:. Rule 1 (for d variables): Factorize into Y λ (x), such that k i ≥ λ for any x i ; λ = SF(2 m )
35
Example: Vanishing Polynomial 4 th degree polynomial F(x, y) over Z 2 3 SF(2 3 ) = 4. Degree (x) = k 1 = 4 = SF(2 3 ) Degree (y) = k 2 = 1 F can be written as a product of 4 consecutive numbers in x. F is a vanishing polynomial
36
Effect of Bit-vectors 4 th degree polynomial F(x, y) in Z 2 1 × Z 2 2 → Z 2 3 λ = 4. Define. F = Y 2 (x) · Y 1 (y) ≡ 0 % 2 3 Rule 1(extended): Factorize into Y k (x), such that k i ≥ μ i for any x i
37
Results By extension, for F(x) over If F(x) ≡ 0 for any μ i consecutive values of x i in. Total number of vectors: Further, F(x) – G(x) = 0 → F(x) = G(x) over To prove equivalence, we need vectors
38
Example f = x 4 y+ x 2 y Simulating, x=0, y=0, f=0 x=1, y=0, f=0 x=2, y=0, f=0 x=3, y=0, f=0 x=0, y=1, f=0 x=1, y=1, f=2 x=2, y=1, f=4 x=3, y=1, f=2 Consider f, g over Z 2 2 × Z 2 → Z 2 3 λ = 4, μ 1 = 4 ; μ 2 = 2 Required : μ 1. μ 2 = 8 vectors g = 2x 2 y Simulating, x=0, y=0, g=0 x=1, y=0, g=0 x=2, y=0, g=0 x=3, y=0, g=0 x=0, y=1, g=0 x=1, y=1, g=2 x=2, y=1, g=0 x=3, y=1, g=2
39
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 sizes for inputs and outputs Determine the maximum number of simulation vectors required Check for equivalence or determine bugs
40
Simulation Results for Equivalent Designs Simulation Results for Equivalent Designs
41
Simulation Results for Buggy Designs Simulation Results for Buggy Designs
42
Limitations a = 127 b = 1 f 1 = 383 c = 255 ≠ a = 127 b = 1 f 2 = 127 c = 255 a [7:0] b [7:0] t 1 [7:0] + c [7:0] + f 1 [8:0] a [7:0] b [7:0] t 2 [7:0] + c [7:0] + f 2 [8:0]
43
Conclusions Technique to verify equivalence of polynomial RTL computations Bit-vector arithmetic is polynomial algebra over the system of finite integer rings Exhaustive simulation is not necessary to prove Results based on concepts from number theory and polynomial algebra
44
Questions ?
45
Polynomial Abstraction If (x > 2b’10) then y = x * x * x Else y = x*x Traditional modeling. Proposed modeling: y as a polyfunction from : Unique representation Issues with the proposed abstraction: Scalability
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.