Top Banner
Verification & Synthesis of Verification & Synthesis of Arithmetic Datapaths using Arithmetic Datapaths using Finite Ring Algebra Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of Utah Salt Lake City, UT-84112
56

Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Jan 20, 2016

Download

Documents

Nicholas Gibbs
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Verification & Synthesis of Verification & Synthesis of Arithmetic Datapaths using Arithmetic Datapaths using

Finite Ring AlgebraFinite Ring Algebra

Priyank KallaPriyank Kalla

Electrical and Computer Engineering

University of Utah

Salt Lake City, UT-84112

Page 2: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Research Group MembersResearch Group Members

Graduate StudentsGraduate Students::

• Namrata ShekharNamrata Shekhar – PhD – PhD RTL Verification of Arithmetic DatapathsRTL Verification of Arithmetic Datapaths

• Sivaram GopalakrishnanSivaram Gopalakrishnan – PhD – PhD RTL Synthesis of Arithmetic DatapathsRTL Synthesis of Arithmetic Datapaths

• Vijay DurairajVijay Durairaj – PhD + – PhD + Chris CondratChris Condrat – BS/MS – BS/MS SAT & SAT-based Decision ProceduresSAT & SAT-based Decision Procedures

Collaborators:Collaborators:

• Prof.Prof. Florian Enescu + BrandonFlorian Enescu + Brandon Mathematics & Statistics, Georgia State Univ.Mathematics & Statistics, Georgia State Univ.

Page 3: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

OutlineOutline Introducing the ProblemsIntroducing the Problems

• Equivalence Verification & High-Level SynthesisEquivalence Verification & High-Level Synthesis

• Applications: Fixed Point Arithmetic, Polynomial Signal Applications: Fixed Point Arithmetic, Polynomial Signal Processing, Audio/Video/Multimedia DSPProcessing, Audio/Video/Multimedia DSP

ModelingModeling: Poly-Functions over Finite Integer Rings: Poly-Functions over Finite Integer Rings

Previous WorkPrevious Work: CAD & Symbolic Computer Algebra: CAD & Symbolic Computer Algebra

ContributionsContributions• Vanishing Polynomials, Canonical Forms for VerificationVanishing Polynomials, Canonical Forms for Verification

• Polynomial Reduction + Decomposition for SynthesisPolynomial Reduction + Decomposition for Synthesis

Algorithm Design & Experimental ResultsAlgorithm Design & Experimental Results Open Problems & ChallengesOpen Problems & Challenges: CAD + Algebra: CAD + Algebra

Page 4: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

The Verification & Synthesis ProblemsThe Verification & Synthesis Problems

Page 5: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Polynomials over Bit-Vectors?Polynomials over Bit-Vectors?

Quadratic filter design for polynomial signal processing

y = a0 . x12 + a1 . x1 + b0 . x0

2 + b1 . x0 + c . x0 . x1

Page 6: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Bit-Vector Arithmetic = %2Bit-Vector Arithmetic = %2mm Algebra Algebra

Represent integers as a vector of bits Bit x0 represents values 0 or 1

Vector X[1:0] = {x1, x0} represents integers

00, 01, 10, 11 (4 values from 0 to 3) Bit-vector of size m: integer values in 0,…, 2m-1 Vector X[m-1 : 0] represents integers reduced % 2m

+2-bit

2-bit

3-bit*

2-bit

2-bit

4-bit

ADDER MULTIPLIER

Page 7: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Fixed-Size (m) Data-path: ModelingFixed-Size (m) Data-path: Modeling

Control the datapath size: Fixed size bit-vectors (m)

* *

8-bit

8-bit

16-bit32-bit

* *

16-bit

16-bit

16-bit16-bit

Bit-vector of size m: integer values in 0,…, 2m-1

Fixed-size (m) bit-vector

arithmetic

Polynomials reduced %2m

Algebra over the ring Z2m

Page 8: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Fixed-Size Data-path: ImplementationFixed-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

• If( x[7:0] > 255 ) then x[7:0] = 255;

• Used in image-processing applications

Page 9: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Example: Anti-Aliasing FunctionExample: 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

MAC

x = a2 + b2

coefficients coefficients

a b

x

F

DFF

Page 10: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Example: Anti-Aliasing FunctionExample: 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]; F1 % 216 = F2 % 216

Transform the problem • F1 - F2 = 57344x5 + 16384x4 + 8192x3 + 16384x2 + 32768x

≡ 0 % 216

F1 - F2 : Vanishing polynomial

Page 11: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Multiple Word-Length OperandsMultiple Word-Length Operands Bit-vector operands with different word-lengthsBit-vector operands with different word-lengths

Input variables : Input variables : {{xx11,…, ,…, xxdd} } Output variablesOutput variables: : ff, , gg

Input bit-widths: Input bit-widths: {{nn11,…, ,…, nndd} } Output width : Output width : mm

Model as polynomial function Model as polynomial function

**

8-bit

12-bit

20-bit

32-bit

1 21 2 22 2n n mx Z ,x Z f ,g Z

n n n m1 2 d 22 2 2Z × Z × × Z Z

Page 12: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Example: Digital Image Rejection UnitExample: Digital Image Rejection Unit

YY11 ≠ Y ≠ Y22

• YY11[15:0] = Y[15:0] = Y22[15:0][15:0]

• YY11 % 2 % 21616 ≡ Y ≡ Y22 % 2 % 21616

4 4 2 2

1Y 16384(A B ) 64767(A B ) A B

57344AB(A B)

input A[11:0], B[7:0]; output Y1[15:0], Y2[15:0];

2 2 2

2

2

Y 24576A B 15615A 8192AB 32768AB

A 17153B 65535B

Page 13: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Previous Work: Function RepresentationsPrevious 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

Page 14: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Previous Work: OthersPrevious Work: Others

SAT and MILP-based techniques

• Suitable for linear/multi-linear forms

Word-level ATPG, congruence closure, co-

operative decision procedures

• Solve linear congruences under modulo arithmetic

Theorem-Proving (HOL), term-rewriting

• Abstract away the data-path size using data

independence, symmetry, other abstractions

• Here, datapath size (m) defines ring cardinality (Z2m)

Page 15: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Previous Work: Symbolic AlgebraPrevious Work: Symbolic Algebra

Galois Field Decomposition of Boolean

Functions: GF(2m) [Pradhan, 1978 + recent work]

Symbolic Algebra Tools: Singular, Macaulay,

Maple, Mathematica, ZEN, NTL, CoCoA

• Polynomial equivalence over R, Q, C, Zp

• Unique Factorization Domains (UFDs) : Uniquely

factorize into irreducibles

• Match corresponding coefficients to prove

equivalence

Page 16: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Symbolic Algebra in CADSymbolic Algebra in CAD

MODD: DAG representation of polynomials over GF(2m)

[Pradhan, IWLS 05, DATE 04]

Guiding Synthesis engines using Groebner’s basis

[De Micheli, TCAD 02]

• Given polynomial F and Library elements <I1, …, In>

• F = h1 I1 + …… + hn In

• Again, works over UFDs

• Approximate RTL as polynomials over Reals

Theorem Proving [Clarke et al.]

• HOL + Mathematica = Analytica

Page 17: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Why is the Problem Difficult?Why is the Problem Difficult?

Z2m is a non-UFD

• f = x2 + 6x in Z8 can be factorized as

Atypical approach required to prove equivalence

f

x x+6

f

x+2 x+4

Page 18: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Problem Formulations + SolutionsProblem Formulations + Solutions

f (x1, …, xd) % n ≡ g(x1, …, xd) % n

• Proving equivalence is NP-hard [Ibarra, J. ACM ’83]

Vanishing polynomials [ICCD ’05, DATE’06]

• f(x) – g(x) ≡ 0 % 2m : Zero Equivalence

• An instance of Ideal Membership Testing

• Efficient solutions over fields (Groebner’s bases): Z2m[x1,…, xd] ?

Canonical forms [ICCAD ’05]

• Unique representations for polyfunctions over Z2m

• Equivalence by coefficient matching

• Concepts from Hungerbuhler et al. [J. Sm. Not., ‘06 ]

Page 19: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Ideal Membership TestingIdeal Membership Testing

( f – g ) % 2m = 0 or ( f – g ) vanishes % 2m

Membership in the Ideal of all Vanishing Polynomials in Z2m

Grobner's basis? Buchberger's algorithm?

Generate the Ideal!

Z2m[x1, …, xd]

Z2m

Ideal xx % 2m

h: % 2m

0f

gf – g ?

Page 20: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Ideal Membership Testing in ZIdeal Membership Testing in Zpp

Fermat’s Little Theorem:

• x p ≡ x (mod p) or

• x p – x ≡ 0 (mod p)

• x p –x generates the vanishing ideal in Zp[x]

f(x) = 0 % p iff f(x) = (xp-x)g(x)

Zp: Principal Ideal Domain

This does not follow in Z2m

Generalize the result from:

%p to %pm to % (any integer) n

Page 21: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Ideal Membership TestingIdeal Membership Testing

Generate the ideal of 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]

P Q

Ideal xx % 2m

h: % 2m

0f

gf – g ?

Page 22: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Results From Number TheoryResults From Number Theory

(f-g) % 2m = 0 means that 2m | (f-g)

n! divides a product of n consecutive numbers.

• 4! divides 99 X 100 X 101 X 102

Find least n such that 2m|n!

• Smarandache Function (SF).

• SF(23) = 4, since 23|4!

2m divides the product of n = SF(2m) consecutive numbers

Page 23: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Results From Number TheoryResults From Number Theory

f ≡ g in Z23 or (f - g) ≡ 0 % 23

• 23|(f - g) in Z23

• 23|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(23) = 4 consecutive numbers

Page 24: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Results From Number TheoryResults From Number Theory

f ≡ g in Z23 or (f - g) ≡ 0 % 23

• 23|(f - g) in Z23

• 23|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(23) = 4 consecutive numbers

Page 25: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Results From Number TheoryResults From Number Theory

f ≡ g in Z23 or (f - g) ≡ 0 % 23

• 23|(f - g) in Z23

• 23|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(23) = 4 consecutive numbers

Page 26: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Results From Number TheoryResults From Number Theory

f ≡ g in Z23 or (f - g) ≡ 0 % 23

• 23|(f - g) in Z23

• 23|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(23) = 4 consecutive numbers

Page 27: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Basis for factorizationBasis 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).

Page 28: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Example: Vanishing polynomialExample: 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) in Z23.

p is a vanishing polynomial.

Page 29: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Example: Vanishing polynomialExample: 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

Page 30: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Constraints on the CoefficientConstraints 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

Page 31: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Constraints on the CoefficientConstraints 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

Page 32: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Deciding Vanishing PolynomialsDeciding Vanishing Polynomials

n = SF(2m), i.e. the least n such that 2m|n!

Fn is an arbitrary polynomial in Z2m[x]

ak is an arbitrary integer

bk = 2m/gcd(k!,2m)

Polynomial F in Z2m vanishes if

F = FnSn + Σ n-1ak bk Sk

k=0

Rule 1 Rule 2

Page 33: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

AlgorithmAlgorithm

Input: poly, 2m

1. Calculate n = SF(2m)

2. k = n: Reduce according to Rule 1• Divide by Sn

• If remainder is zero, F = FnSn, else Continue

poly = 4x2 + 4x in Z23

1. n = SF(23) = 4

2. k = 4: Divide by S4

• Degree (poly) = 2

< degree(S4) = 4• quo = 0, rem = 4x2 + 4x

• F4 = 0; Continue

Example 1Example 1F = FnSn + Σ n-1ak bk Sk k=0

Page 34: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

AlgorithmAlgorithm

Input: poly, 2m

1. Calculate n = SF(2m)

2. k = n: Reduce according to Rule 1• Divide by Sn

• If remainder is zero, F = FnSn, else Continue

poly = 4x2 + 4x in Z23

1. n = SF(23) = 4

2. k = 4: Divide by S4

• Degree (poly) = 2

< degree(S4) = 4• quo = 0, rem = 4x2 + 4x

• F4 = 0; Continue

Example 1Example 1F = FnSn + Σ n-1ak bk Sk k=0

Page 35: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

AlgorithmAlgorithm

3. Reduce according to Rule 2. Divide by Sn-1 to S0

• Check if quotient is a multiple of

bk = 2m/gcd(k!,2m)• If remainder is zero,

stop. Else, continue

3. k = 3: Divide by S3

• degree (poly) = 2 < degree(S3) = 3

• quo= 0, rem = 4x2 + 4x continue

4. k = 2: Divide by S2

• quo = 4; rem = 0• b2 = 23/gcd(2!,23) = 4• a2 = quo/ b2 = 1 Є Z

Example 1Example 1

poly = a2.b2.S2 = 1.4.(x+1)(x+2) ≡ 0 in Z23

F = FnSn + Σ n-1ak bk Sk k=0

Page 36: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

AlgorithmAlgorithm

3. Reduce according to Rule 2. Divide by Sn-1 to S0

• Check if quotient is a multiple of

bk = 2m/gcd(k!,2m)• If remainder is zero,

stop. Else, continue

3. k = 3: Divide by S3

• degree (poly) = 2 < degree(S3) = 3

• quo= 0, rem = 4x2 + 4x continue

4. k = 2: Divide by S2

• quo = 4; rem = 0• b2 = 23/gcd(2!,23) = 4• a2 = quo/ b2 = 1 Є Z

Example 1Example 1

poly = a2.b2.S2 = 1.4.(x+1)(x+2) ≡ 0 in Z23

F = FnSn + Σ n-1ak bk Sk k=0

Page 37: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Example 2Example 2

poly = 5x2 + 3x + 7 in Z23 n = SF(23) = 4 degree (poly) = 2 < n. Skip Rule 1, try Rule 2 Divide by S2

• quo = 5; rem = 5 + 4x

• b2 = 23/gcd(2!,23) = 4

• a2 = quo/ b2 = 5/4 is not in Z poly does not satisfy Rule 2 poly is not a vanishing polynomial in Z23

Page 38: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Status of our Work - ExtensionsStatus of our Work - Extensions

Multiple Variables: Multiple Variables: Z2m[x1, …, xd]

• Given polynomials (Given polynomials (f, gf, g) ) dd variables variables

xx = < = <xx11, …, , …, xxdd> > over over ZZ22mm

Prove that Prove that (f-g) = 0 %(f-g) = 0 % 2 2mm What if word-lengths are different too?What if word-lengths are different too?

xx1 1 Z Z22nn

1 1 , …… , , …… , xxd d Z Z22nn

dd

No problems!No problems! Straight-forward extensions of previousStraight-forward extensions of previous conceptsconcepts

Other approach: Other approach: Canonical formsCanonical forms of poly- of poly-functionsfunctions

Page 39: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Polyfunctions over Polyfunctions over ZZ22mm

Polynomials over Z2m[x1, …, xd]

• Represented by polyfunctions from Z2m[x1, …, xd] to Z2m

F1 % 2m ≡ F2 % 2m => they have the same underlying polyfunction

(f )

Use equivalence classes of polynomials

• Derive representative for each class: Canonical form

f

g

Equivalence classes

Z2m[x1, …, xd] Z2m

F2

F1

G2

G1

Page 40: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Motivating our ApproachMotivating our Approachmodule fixed_bit_width (x, f, g);

input [2:0] x;

output [2:0] f, g;

assign f[2:0] = 5x2 + 6x - 3;

assign g[2:0] = x2 + 2x + 5;

f (x) = 5x2 + 6x - 3 = (x2 + 2x + 5) + (4x2 + 4x) • f (x) = g(x) + V (x) in Z23

V (x) = 4x2 + 4x ≡ 0 % 23 ; for x in {0,…,7}• f (x) = g (x) + 0 in Z23

Required: To identify and eliminate such redundant sub-expressions(vanishing)

Page 41: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Vanishing Polynomials for ReducibilityVanishing Polynomials for Reducibility

In Z23, say f (x) = 4x2

• f (x) = f (x) - V(x)

• Generate V(x) of degree 2

• V(x) = 4x2 + 4x ≡ 0 % 23

Reduce by subtraction: • 4x2 f (x)

– 4x2 + 4x V(x)= - 4x = - 4x % 8 = 4x

• 4x2 can be reduced to 4x

• Degree reduction

Page 42: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Degree Reduction: RequirementDegree Reduction: Requirement Generate appropriate vanishing polynomial , V(x) f (x) = axk + a1xk-1 + …

V(x) = axk + a2xk-1 + …

f (x) – V(x) = bxk-1 + …

V(x): axk is the leading term Identify constraints on

• Degree : k; Coefficient : a f (x) = axk + …

If 2m|ak!, then V(x) = ak! x + k ≡ 0 % 2m k

= axk + a1xk-1…..

Page 43: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Coefficient Reduction: ExampleCoefficient Reduction: Example

Degree is not always reducible

In Z23, f (x) = 6x2

• a = 6, k = 2

• 8 does not divide 6 × 2!

Divide and subtract

• 6x2 = 2x2 + 4x2 % 23

• 4x2 can be reduced to 4x f (x) = 2x2 + 4x : Lower Coefficient

Page 44: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Our ApproachOur Approach

Say f (x) = akxk + ak-1xk-1 + …+ a0

• 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 …

Page 45: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Experimental SetupExperimental Setup

Distinct RTL designs are input to GAUT [U. de LESTER]

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 zero-testing algorithm

Reduce f, g to canonical forms….

Algorithm implemented in MAPLE

Compare with BMD, SAT and MILP

Complexity: O(kd)

Page 46: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

ResultsResults

1

10

100

1000

PSK

Anti-Alia

s Funct

ion

Cubic F

ilter

Degre

e-4

Filter

Savitz

y-Gola

y Filt

er

MIB

ENCH

Horner

Poly

1

Horner

Poly

2

Horner

Poly

3

Poly U

nopt.

Vanis

hing P

oly.

Our Approach (< 30 s)

BDD-VIS

BMD

SAT-Zchaff

Page 47: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Limitations: Mathematics versus CADLimitations: Mathematics versus CAD

Finite Ring Algebra = Cannot DIVIDE!Right shift breaks the model

Overflow arithmetic versus Saturation Comparators = non-polynomial?

Internal bit-vectors of arbitrary word-lengths

Only Yes/No Equivalence? Find bugs too!

Couple Verification with Simulation!

Arithmetic interfaced with Boolean……

Page 48: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Intermediate Signal TruncationIntermediate Signal Truncation

a = 127 b = 1 f1 = 383

c = 255

a = 127 b = 1 f2 = 127c = 255

a[7:0] b[7:0]

t1[7:0]

+

c[7:0]

+

f1[8:0]

a[7:0] b[7:0]

t2[7:0]

+

c[7:0]

+

f2[8:0]

Page 49: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Proposed SolutionProposed Solution

a[7:0] b[7:0]

t1[7:0]

+

c[7:0]

+

f1[8:0]

a[7:0] b[7:0]

t2[7:0]

+

c[7:0]

+

f2[8:0]

Canonize

Canonize

Canonize

Canonize

Required: Algorithm for reduction to canonical form over

n n n m1 2 d 22 2 2Z × Z × × Z Z

Page 50: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Polynomial Abstraction from RTLPolynomial Abstraction from RTL

If If (x > 2b’10)(x > 2b’10)

then then y = x * x * xy = x * x * x

Else Else y = x*xy = x*x

Traditional modeling

.

Proposed modeling: y as a polyfunction from

: Unique representation

Issues with the proposed abstraction:

Scalability

4 32Z Z3 2y 3x 8x 22x

3 2[0,2] y = x and 3 y = x x x =

Page 51: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Verification via Simulation?Verification via Simulation?

Page 52: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Simulation Vector GenerationSimulation Vector Generation

f = f = xx44 + x + x2 2 (specification)(specification)

• x=0, f=0x=0, f=0

• x=1, f=2x=1, f=2

• x=2, f=4x=2, f=4

• x=3, f=2x=3, f=2

• x=4, f=0x=4, f=0

• x=5, f=2x=5, f=2

• x=6, f=4x=6, f=4

• x=7, f=2x=7, f=2

Prove Prove f f = = gg over over ZZ88 via Simulationvia Simulation

• How many vectors to Simulate? Exhaustive Simulation?How many vectors to Simulate? Exhaustive Simulation?

• NO!NO! Simulate onlySimulate only n = n = SF(2SF(233) = ) = 4 CONSECUTIVE vectors4 CONSECUTIVE vectors

g = g = 2x 2x2 2 (implementation)(implementation)

• x=0, g=0x=0, g=0

• x=1, g=2x=1, g=2

• x=2, g=0x=2, g=0

• x=3, g=2x=3, g=2

• x=4, g=0x=4, g=0

• x=5, g=2x=5, g=2

• x=6, g=0x=6, g=0

• x=7, g=2x=7, g=2

Page 53: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Applications to SynthesisApplications to Synthesis

Datapath size (m): 8 bits

SF(28) = 10

Polynomial can be

factorized into S10(x)

F[7:0] = (x+1)(x+2)...(x+10)

Page 54: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Polynomial DecompositionPolynomial Decomposition

F = 8xyF = 8xy22 + 11y + 11y33 + 9y + 9y2 2 + 1 + 1 X, Y [3:0] are 4-bit vectors (%16)X, Y [3:0] are 4-bit vectors (%16) Synthesize: Area = Synthesize: Area = 320320

U = 8x + 3yU = 8x + 3y F = UF = U33 + U + U2 2 + 1 + 1 Synthesize: Area = 181+20 = Synthesize: Area = 181+20 = 201201

Page 55: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

ConclusionsConclusions

Finite Word-Length Bit-Vector Arithmetic is Finite Ring

Algebra

Computations reduced % integer power of 2

NON-UFDs! Number Theory, Commutative Algebra

Mathematicians should help us here…….

Techniques to verify equivalence of polynomial RTL

computations

f(x) % 2m ≡ g(x) % 2m is transformed into f(x) - g(x) ≡ 0 % 2m

Ideal Membership Testing, Canonical Forms….

Tremendous scope in high-level synthesis….

Page 56: Verification & Synthesis of Arithmetic Datapaths using Finite Ring Algebra Priyank Kalla Priyank Kalla Electrical and Computer Engineering University of.

Questions?Questions?