450 likes | 466 Views
This research paper discusses the problem of equivalence verification in arithmetic datapaths with finite word-length operands. It explores polynomial functions over finite integer rings and presents limitations of previous work in this area. The paper also provides theory, applications, results, and conclusions, along with potential future work.
E N D
SIMULATION BOUNDS FOR EQUIVALENCE VERIFICATION OF ARITHMETIC DATAPATHS WITH FINITE WORD-LENGTH OPERANDS Namrata Shekhar1, Priyank Kalla1, M. Brandon Meredith2, Florian Enescu2 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
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
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 Bit-width Operands • Control the datapath size: Fixed size bit-vectors (m) • Bit-vector of size m: Integer values in 0,…, 2m-1
20-bit 8-bit * 32-bit * 12-bit General Datapath Model • Bit-vector operands with different word-lengths • Input variables : {x1,…, xd} Output variables : f • Input bit-widths: {n1,…, nd} Output width : m • . • . • Model f as polynomial function
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
a0 FFT(A) a1 FAB0 invFFT(FAB) a2 c’0 a3 FAB1 c’1 FAB2 c’2 FAB3 b0 FFT(B) c’3 b1 b2 b3 Motivation: Convolution of A and B C = (c0, c1, c2, c3) where C′ = (c′0, c′1, c′2, c′3) = DFT-1 (DFT(A)·DFT(B)) Datapath size is fixed How many simulation vectors required to prove C = C’ ?
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
Example: Anti-Aliasing Function • Implemented as a fixed size datapath in x • 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] • How many vectors required to prove: F1 % 216 ≡ F2 % 216
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
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
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]
Fundamental Theorem of Algebra • A degree-k polynomial F(x) has exactly k roots • F(x) = x2 + 6x = x ( x + 6 ) • IfF(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, Zp, C • Z2mis a non-UFD
F F x x+6 x+4 x+2 Why is the Problem Difficult? • Consider F(x) = x2 + 6xinZ8 • Degree-2 polynomial has 4 unique roots • F(x) = 0 for 4 vectors, but F(x) ≠ 0 inZ8 • Not applicable to bit-vector arithmetic
Previous Work: Finite Ring Algebra • f (x1, …, xd) % n≡g(x1, …, xd) % n • Proving equivalence is NP-hard [Ibarra et al, ACM ‘83] • Previous approaches • f (x1, x2, …, xd) – g (x1, x2, …, xd) ≡ 0% 2m: 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
Zero Equivalence 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}: Vanishing polynomial • Required: To find if any given expression vanishes • Use concepts from ideal membership testing
h: % 2m Ideal xi xi % 2m f 0 g f – g ? Ideal Membership Testing • h:Z2m[x]→ Z2m defined by % 2m • Ideal members map to0 • Test for membership in • Representative expression for members of this ideal [Chen, Disc. Math ‘96] • Use concepts from Number theory and polynomial algebra Z2m[x] Z2m Ideal of Vanishing Polynomials
Results From Number Theory • Find least n such that 2m|n! • Smarandache Function: λ = SF (2m) • λ = SF(23) = 4, since 23|4! • n! divides a product of n consecutive numbers • 4! divides 99X 100 X 101 X 102 • 2mdivides the product ofnconsecutive numbers • 23 divides the product of 4 consecutive numbers
Results From Number Theory • F ≡ G in Z23or(F - G) ≡ 0 % 23 • 23|(F - G)inZ23 • 23divides the product of 4 consecutive numbers If (F-G) is a product of 4 consecutive numbers then 23|(F - G) • A polynomial as a product of 4 consecutive numbers? • . (x) (x-1) (x-2) (x-3)
Basis for Factorization • Y0(x) = 1 • Y1(x) = (x) • Y2(x) = (x)(x - 1) = Product of 2 consecutive numbers • Y3(x) = (x)(x - 1)(x - 2) = Product of 3 consecutive numbers • … • … • Yk(x) = (x – k + 1) Yk-1(x) = Product of k consecutive numbers Rule 1: Factorize into at least Yλ(x) to vanish, where λ = SF(2m)
Example 1: Vanishing Polynomial • 4th degree polynomial F over Z23 • λ = 4 • . • Degree (x) = k = 4 = λ • F can be written as a product of 4 consecutive numbers in x • . • F is a vanishing polynomial
Constraints on the Coefficient • F(x) = 4x2 + 4x = (x)(x-1) % 23 • Y4(x) = (x)(x-1) 4 compensated by constant (x-2)(x-3) missing factor Rule 2: Coefficient has to be a multiple of bk =2m/gcd(k!, 2m) Here, Coefficient of F(x) = 4, Degree of F(x) = 2 b2 = 23/gcd(2!, 23) = 4 is a multiple of the coefficient Use Rule 1 and Rule 2 to determine if any F(x) = 0 % 2m
Deciding Vanishing Polynomials • Polynomial F in vanishes if • Fλ is an arbitrary polynomial over • Yλ= Ykis as defined earlier: λ = SF(2m) • akis an arbitrary integer • . Rule 1 Rule 2
Polynomial Representations • Newton’s interpolation formula: Any polynomial F(x) can be written as • : Forward difference operator • pis the degree of F(x)
Polynomial Representations • Newton’s interpolation formula: Any polynomial F(x) can be written as • : Forward difference operator • pis the degree of F(x)
Reinterpret Vanishing ideal • Newton’s interpolation formula: Any polynomial F(x) can be written as • : Forward difference operator • Yk(x)is as defined earlier • pis the degree of F(x)
Reinterpret Vanishing ideal • Newton’s interpolation formula: Any polynomial F(x) can be written as • : Forward difference operator • Yk(x)is as defined earlier • pis the degree of F(x)
Polynomial Representations • Newton’s interpolation formula: Any polynomial F(x) can be written as • is any arbitrary integer • Yk(x)is as defined earlier • pis the degree of F(x)
Rule 1 Polynomial Representations • Any polynomial F(x) in can be written as • Fλ is an arbitrary polynomial over • Yλ= Ykis as defined earlier: λ = SF(2m) • is an arbitrary integer 0
Polynomial Representations • Any polynomial F(x) in can now be reduced to • Fλ is an arbitrary polynomial over • Yλ= Ykis as defined earlier: λ = SF(2m) • is an arbitrary integer
Polynomial Representations • Any polynomial F(x) in can now be reduced to • Apply Rule 2 • F(x) vanishes iff ck is a multiple of • Check for all ck, where • ckevaluated no more thanλtimes • F(x) evaluated no more thanλtimes
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
f = x4 + x2 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 Z23 λ= SF(23) = 4 Example • g = 2x2 • 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
Extension to Multiple Variables • Given d variables x = <x1, …, xd> with degrees k =< k1, …, kd> over Z2m • Basis for d variables: • . Rule 1 (for d variables): Factorize into Yλ(x), such that ki≥λfor anyxi ; λ= SF(2m)
Example: Vanishing Polynomial • 4th degree polynomial F(x, y) over Z23 • SF(23) = 4 • . • Degree (x) = k1 = 4 = SF(23) • Degree (y) = k2 = 1 • F can be written as a product of 4 consecutive numbers in x • . • F is a vanishing polynomial
Effect of Bit-vectors • 4th degree polynomial F(x, y) in Z21× Z22→ Z23 • λ= 4 • . • Define • . • F = Y2(x) · Y1(y) ≡ 0 % 23 Rule 1(extended): Factorize into Yk(x), such that ki≥μifor anyxi
Results • By extension, for F(x) over • If F(x) ≡ 0 for any μi consecutive values of xi in • . • Total number of vectors: • Further, • F(x) – G(x) = 0 → F(x) = G(x) over • To prove equivalence, we need vectors
f = x4y+ x2y 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 Z22× Z2→ Z23 λ = 4, μ1= 4 ; μ2 = 2 Required: μ1.μ2 = 8 vectors Example • g = 2x2y • 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
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
Limitations a[7:0] b[7:0] c[7:0] a[7:0] b[7:0] c[7:0] + + ≠ t1[7:0] t2[7:0] + + f1[8:0] f2[8:0] a = 127 b = 1 f1 = 383 c = 255 a = 127 b = 1 f2 = 127 c = 255
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
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