SlideShare a Scribd company logo
1 of 84
Download to read offline
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Optimal filter implementation in fixed-point
arithmetic
Benoit Lopez
Seminar ARIC team

December 12th 2013

1/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Outline

1

Context and Objectives

2

FiPoGen

3

Bits Formatting

4

Conclusion

2/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

ANR DEFIS
Projet ANR-11-INSE-008
DEsign of FIxed-point embedded Systems (DEFIS)

3/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

ANR DEFIS
Projet ANR-11-INSE-008
DEsign of FIxed-point embedded Systems (DEFIS)
Various partners :
Research : IRISA, LIRMM (DALI), CEA, LIP6

3/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

ANR DEFIS
Projet ANR-11-INSE-008
DEsign of FIxed-point embedded Systems (DEFIS)
Various partners :
Research : IRISA, LIRMM (DALI), CEA, LIP6
Industrial : Thales, InPixal

3/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

On the first hand... A filter
x[n]
z

b0

+

+

z

+

+

1

h(z) =

z

Pn

1+

b1

i=0
Pn

bi z

1

y[n]

+

b1

a1

b2

z

a2

1

b3

x[n]

1

a1

1

b2
z

y[n]

+
z

b1
z

+

1

a2

z

1

z

1

z

1

i

i=1 ai z

i

z

1

b3

1

z

a3

1

a3

Signal Processing
LTI filters: FIR or IIR
Its transfer function
Algorithmic relationship used to compute output(s) from
input(s), for example:
y (k) =

n
X
i=0

bi u(k

i)

n
X

ai y (k

i)

i=1

4/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

On the other hand... A target
...
±2

2

...

2

0

2

s

Hardware target (FPGA, ASIC) or software target (DSP,µC)
Using fixed-point arithmetic for di↵erent reasons:
no FPU
cost
size
power consumption
etc.

5/41
Context and Objectives

FiPoGen

x[n]
z

b0

z

+

1

...

a1

1

z

+

+

±2

2

...

2

0

2

1

s

a2

1

b3

1

z

b2
z

+

Conclusion

y[n]

+

1

b1
z

+

Bits Formatting

a3

Need
Methodology and tools for the implementation of embedded filter
algorithms in fixed-point arithmetic.

6/41
Context and Objectives

FiPoGen

x[n]
z

b0

z

+

1

...

a1

1

z

+

+

±2

2

...

2

0

2

1

s

a2

1

b3

1

z

b2
z

+

Conclusion

y[n]

+

1

b1
z

+

Bits Formatting

a3

Need
Methodology and tools for the implementation of embedded filter
algorithms in fixed-point arithmetic.
A first methodology
1

Given a filter, choose an algorithm

2

Round the coe cients in fixed-point arithmetic

3

Implement algorithm
6/41
Context and Objectives

FiPoGen

x[n]
z

b0

z

+

1

...

a1

1

z

+

+

±2

2

...

2

0

2

1

s

a2

1

b3

1

z

b2
z

+

Conclusion

y[n]

+

1

b1
z

+

Bits Formatting

a3

Need
Methodology and tools for the implementation of embedded filter
algorithms in fixed-point arithmetic.
A first methodology
1

Given a filter, choose an algorithm
There are many possible realizations

2

Round the coe cients in fixed-point arithmetic

3

Implement algorithm

What word-length? Depends on the choice of algorithm
Is there only one possible implementation?
6/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Fixed-Point number
2m 2m
Xm

1

20

2

1

2`

X0

X

1

X`

w

Representation : X .2` with X = Xm Xm

1 ...X0 ...X` .

Format : determined by wordlength and fixed-point position,
and noted for example (m, `).

7/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Some FPF examples
p

p
2 with 8 bits : FxP8 ( 2) = 90.2
21 20 2
0

3

1

1

1

⇡ with 6 bits : FxP6 (3
2

1

1

0

⇡) =

1

0

0

18.2

3

2

6

2

0

2

6

1

1

7

7

2
1

(1, 6)

0

( 2, 7)

42 with 5 bits : FxP5 (42) = 10.22
26 25
0

1

22
0

1

0

(6, 2)

8/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Some FPF examples
p

p
2 with 8 bits : FxP8 ( 2) = 90.2
21 20 2
0

3

1

1.40625

1

1

⇡ with 6 bits : FxP6 (3
2

1

1

0

⇡) =

1

0

0

18.2

3

2

6

2

0

2

6=

1

1

7=

0.140625

7

2
1

(1, 6)

0

( 2, 7)

42 with 5 bits : FxP5 (42) = 10.22 = 40
26 25
0

1

22
0

1

0

(6, 2)

8/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Fixed-Point number
2m 2m
Xm

1

20

2

1

2`

X0

X

1

X`

w

Representation : X .2` with X = Xm Xm

1 ...X0 ...X`

Format : determined by wordlength and fixed-point position,
and noted for example (m, `)
Only the mantissa X is stored, the scale 2` is implicit

9/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Sum example
We want to compute 42 +
0

1

0

1

0

p

2 with an 8-bit operator :

1

0

0

1

0

84

0
1

1

0

1

0

90

s

10/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Sum example
We want to compute 42 +
0

1

0

0

1

1

0

2 with an 8-bit operator :

0

1

0
1

0

1

1

84

0

0

0

1

p

0

1

1

p
FxP8 (FxP8 (42) + FxP8 ( 2)) = FxP8 (84.2

0

1

2

0

86

1

+ 90.2

6)

=

10/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Sum example
We want to compute 42 +
0

1

0

0

1

1

0

2 with an 8-bit operator :

0

1

0
1

0

1

1

84

0

0

0

1

p

0

1

1

p
FxP8 (FxP8 (42) + FxP8 ( 2)) = FxP8 (84.2
84.2 1 + (90
5).2 1 = 86.2 1 = 43
p
FxP8 (42) + FxP8 ( 2) = 43.40625

0

1

2

0

86

1

+ 90.2

6)

=

10/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Sum example
We want to compute 42 +
0

1

0

0

1

1

0

2 with an 8-bit operator :

0

1

0
1

0

1

1

84

0

0

0

1

p

0

1

1

p
FxP8 (FxP8 (42) + FxP8 ( 2)) = FxP8 (84.2
84.2 1 + (90
5).2 1 = 86.2 1 = 43
p
FxP8 (42) + FxP8 ( 2) = 43.40625

0

1

2

0

86

1

+ 90.2

6)

=

10/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Fixed-Point number
2m 2m
Xm

1

20

2

1

2`

X0

X

1

X`

w

Representation : X .2` with X = Xm Xm 1 ...X0 ...X`
Format : determined by wordlength and fixed-point position,
and noted for example (m, `)
Only the mantissa X is stored, the scale 2` is implicit
Computation in finite precision implies errors.
Numerical degradations
quantization of the coe cients
round-o↵ errors in computations
11/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Filter

IIR Filter
Let H be the transfer function of a n
H(z) =

b0 + b1 z
1 + a1 z

1

th order IIR filter :

+ · · · + bn z
1 + ··· + a z
n

n
n

,

8z 2 C.

(1)

12/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Filter

IIR Filter
Let H be the transfer function of a n
H(z) =

b0 + b1 z
1 + a1 z

1

th order IIR filter :

+ · · · + bn z
1 + ··· + a z
n

n
n

,

8z 2 C.

(1)

There is a lot of di↵erent realizations for a filter :
Direct Form I, DF II, ⇢DF II transposed
State-Space realizations, -operator, LGS, LCW
parallel or cascade decompostion
...
Each realization needs its own parameters and therefore the impact
of FxP computation will depend on the realization.

12/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Filter

This filter is usually realized with the following algorithm
y (k) =

n
X

bi u(k

i)

i=0

n
X

ai y (k

i)

(2)

i=1

where u(k) is the input at step k and y (k) the output at step k.
We can see round-o↵ errors as the add of an error e(k) on the
output and only y † (k) can be computed.
y † (k) =

n
X
i=0

bi u(k

i)

n
X

ai y † (k

i) + e(k).

(3)

i=1

13/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Filter

u(k)
e(k)

H
He

y(k)
y(k)

+

y † (k)

y (k) , y † (k) y (k) can be seen as the result of the error
through the filter He :
He (z) =

1 + a1 z

1

1
+ · · · + an z

n

,

8z 2 C.

14/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Filter

u(k)
e(k)

H
He

y(k)
y(k)

+

y † (k)

y (k) , y † (k) y (k) can be seen as the result of the error
through the filter He :
He (z) =

1 + a1 z

1

1
+ · · · + an z

n

,

8z 2 C.

If the error e(k) is in [e; e], then we are able to compute
y such that y (k) is in [ y ; y ] :
y

=

y

=

y and

e +e
e e
|He |DC
kHe k`1
2
2
e +e
e e
|He |DC +
kHe k`1
2
2
14/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Objective

Objective:
Given an algorithm and a target, find the optimal implementation.
model the fixed-point algorithms
model the hardware resources (computational units, etc.)
evaluate the degradation
find one/some optimal implemented algorithm(s)

15/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Objective

From filter to code, global flow
algorithm
transformation

implementation

filter
set of equivalent
realisations

SIF

Realisation
choice

optimal realisation

Fixed-point
implementation

fixed-point
algorithm

language

Code
generation

code
sensibillity
mesures

multi-criteria
optimisation

16/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Objective

From filter to code, global flow
algorithm
transformation

implementation

filter
set of equivalent
realisations

SIF

Realisation
choice

optimal realisation

Fixed-point
implementation

fixed-point
algorithm

language

Code
generation

code
sensibillity
mesures

multi-criteria
optimisation

17/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Outline

1

Context and Objectives

2

FiPoGen

3

Bits Formatting

4

Conclusion

18/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

The only operations needed in filter algorithm computation are
sum-of-products:
n
X
S=
c i · xi
i=1

where ci are known constants and xi variables (inputs, state or
intermediate variables).

Question:
How to implement computation of S in fixed-point arithmetic?
What control on degradation errors?

19/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

The only operations needed in filter algorithm computation are
sum-of-products:
n
X
S=
c i · xi
i=1

where ci are known constants and xi variables (inputs, state or
intermediate variables).

Question:
How to implement computation of S in fixed-point arithmetic?
What control on degradation errors?
Answer:
A tool responding to the global flow in particular case of
sum-of-product (FiPoGen).

19/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Main example
Let H be the transfer function of a butterworth filter of 4th order:
H(z) =

0.00132801779278 + 0.00531207117112z 1 + 0.00796810675667z 2 + 0.00531207117112z 3 + 0.00132801779278z 4
1

2.87111622831650z 1 + 3.20825006629575z 2

1.63459488108445z 3 + 0.31870932778967z 4

Associated algorithm:
y (k)

=

0.0013279914856 u(k) + 0.00531196594238 u(k
+0.00531196594238 u(k
3.20825195312 y (k

1) + 0.00796794891357 u(k

3) + 0.0013279914856 u(k
2) + 1.63458251953 y (k

3)

2)

4) + 2.87109375 y (k

1)

0.318710327148 y (k

4)

Inputs datas :
wordlength of constants, u(k) and y (k) : 16 bits
u(k) 2 [ 13, 13] and y (k) 2 [ 17.123541; 17.123541]

Bits formatting example

20/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

From filter to code, global flow
algorithm
transformation

implementation

filter
set of equivalent
realisations

SIF

Realisation
choice

optimal realisation

Fixed-point
implementation

fixed-point
algorithm

language

Code
generation

code
sensibillity
mesures

multi-criteria
optimisation

21/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen - Fixed Point Generator
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Conversion
The user gives in input to FiPoGen the wordlentgh of each
constants, and FiPoGen computes the complete format of each of
them, and specifies the format of each variables.

22/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Order
In software, addition can be not associative, therefore all di↵erent
orders of additions must be considered.

23/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Order
In software, addition can be not associative, therefore all di↵erent
orders of additions must be considered.
oSoP
An evaluation scheme for a given sum-of-products with a given
order will be called ordered-sum-of-products (oSoP).
23/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fullyparametrized
scheme

one evaluation
scheme

fixed-point
algorithm

Formats
propagation /
Noise
evaluation

Evaluation
scheme

best fixed-point
scheme

Optimization /
Best scheme
choice

Code
generation

new scheme
code

S
+
+

+
16

+
+

(-1,-16)

+

-20887
16

+
16
(1,-14)
26781

⇥

(2,-13)

16
(5,-10)

y [n

3]

(2,-13)
23520

⇥

-26282
(5,-10)
y [n

1]

⇥

(5,-10)

16

2]
(-9,-24)
22280

⇥

(-7,-22)

16
(4,-11) (-6,-21)
u[n]

(5,-10)
y [n

4]

(-9,-24)
22280

⇥

16
(4,-11) (-7,-22)

u[n

4]

22280

⇥

(4,-11)
u[n

1]

16

+

y [n

⇥

16

16710

⇥

22280

⇥

(4,-11)
u[n

3]

(4,-11)
u[n

2]

23/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation
fixed-point
algorithm

Fixed-Point
Conversion

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

best fixed-point
scheme

Optimization /
Best scheme
choice

Code
generation

new scheme
code

Number of oSoP
For a given sum-of-products of N th order, there are
oSoP to consider.

QN

1
i=1 (2i

1)

23/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fullyparametrized
scheme

one evaluation
scheme

fixed-point
algorithm

Formats
propagation /
Noise
evaluation

Evaluation
scheme

best fixed-point
scheme

Optimization /
Best scheme
choice

Code
generation

new scheme
code

S
+
+

+
16

+
16

+
16
(-1,-16)
-20887

⇥

(2,-13)

16
(5,-10)

y [n

4]

(2,-13)

(1,-14)
26781

⇥

23520

⇥

-26282

y [n

16

22280

⇥

(-9,-24)

16
(4,-11) (-6,-21)

u[n

3]

(-9,-24)

16

+

(-7,-22)

16710

⇥

(-7,-22)

16

+

2]

1]

3]

16

+
(5,-10)

(5,-10)
y [n

(5,-10)
y [n

⇥

22280

⇥

22280

⇥

22280

⇥

(4,-11)
u[n

1]

(4,-11)
u[n

4]

(4,-11)
u[n]

(4,-11)
u[n

2]

23/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation
fixed-point
algorithm

Fixed-Point
Conversion

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

best fixed-point
scheme

Optimization /
Best scheme
choice

Code
generation

new scheme
code

Number of oSoP
For a given sum-of-products of N th order, there are
oSoP to consider.

QN

1
i=1 (2i

1)

Generation
At this step, FiPoGen generates all the oSoP one by one.

23/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Formats propagation
From an oSoP parametrized with inputs FPF and wordlength, and
using some propagation rules on adders and multipliers, we obtain
a fully-parametrized oSoP.

24/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
S
(5,-10)
+

(5,-10)
+

,-10)

(5
+

0)

(5,-1
(5,-

+

10)

(5,-

16
(-1,-16)
-20887

⇥

(8,-7)
16

(7,-8)
16

(5,-10)
y [n

4]
(1,-14)
26781

(8,-7)
16

F

⇥

(2,-13)
23520

⇥

(2,-13)
-26282

⇥

y [n

y [n

1]

2]
+

( -2

(-7,-22)
22280

6)

⇥

16

(-2,-1

16710

u[n

1]

22280

⇥

(4,-11)
u[n

2]

>> 2

)

(-4,-19)
16

(4,-11) (-7,-22)

(-6,-21)

7)

,-17

16

3]

+

7)
(-2,-1

)
,-17
( -2

(5,-10)
y [n

(-1,-1

>> 1
(-2,-17)

(5,-10)

(5,-10)

+

6)
(-1,-1

F

0)

F

>> 6
(-1,-16)

0)

(5,-1

10)

(5,-10)

(5,-1

⇥

9)

, -1
( -4
(4,-11)
u[n

+

( -4

, -1

16

3]
(-9,-24)
22280

⇥

9)
16

(4,-11) (-9,-24)
u[n]

22280

⇥

(4,-11)
u[n

4]

24/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Propagation =) right-shifts
By propagating formats, some additions yield a right-shift on its
operands (for aligning them onto the result format). This
right-shift implies error onto the final result.

24/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fullyparametrized
scheme

one evaluation
scheme

fixed-point
algorithm

Evaluation
scheme

Formats
propagation /
Noise
evaluation

best fixed-point
scheme

Optimization /
Best scheme
choice

Code
generation

new scheme
code

Right-shift =) error interval
The right shifting of d bits of a variable x (with (m, `) as FPF) is
equivalent to add an interval error [e] = [e; e] with
[e, e]

Truncation
[ 2`+d + 2` ; 0]

Round to the nearest
[ 2`+d 1 + 2` ; 2`+d 1 ]

(4)

Cumulated error is therefore computed for a given evaluation
scheme.
24/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Optimization criteria
errors
(noise : couple mean/variance)
error interval

25/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Optimization criteria
errors
latency (infinite parallelism)
height of the syntax tree

25/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Optimization criteria
errors
latency (infinite parallelism)
adequacy with hardware target
number of operators
wordlength of operators
etc.

25/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Optimization criteria
errors
latency (infinite parallelism)
adequacy with hardware target
etc.

25/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

FiPoGen
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

Once we have the best evaluation scheme, we choose a language
and we generate the associated fixed-point code.

26/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Outline

1

Context and Objectives

2

FiPoGen

3

Bits Formatting

4

Conclusion

27/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting
s
s
s
s
s
s
s
s

s
sf

Context
A sum of N terms (pi )1iN with di↵erent formats, and the known
FPF of final result (sf ), less than total wordlength (s).

28/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting
s
s
s
s
s
s
s
s

s
sf

Context
A sum of N terms (pi )1iN with di↵erent formats, and the known
FPF of final result (sf ), less than total wordlength (s).
Question:
Can we remove some useless bits ?
28/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting
s
s
s
s
s
s
s
s

s
sf

Two-step formatting
1

most significant bits

2

least significant bits

28/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

MSB formatting

Jacskon’s Rule (1979)
This Rule states that in consecutive additions and/or subtractions
in two’s complement arithmetic, some intermediate results and
operands may overflow. As long as the final result representation
can handle the final result without overflow, then the result is valid.

29/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

MSB formatting

Jacskon’s Rule (1979)
This Rule states that in consecutive additions and/or subtractions
in two’s complement arithmetic, some intermediate results and
operands may overflow. As long as the final result representation
can handle the final result without overflow, then the result is valid.
Example :
We want to compute 104 + 82

94 with 8 bits :

29/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

MSB formatting

Jacskon’s Rule (1979)
This Rule states that in consecutive additions and/or subtractions
in two’s complement arithmetic, some intermediate results and
operands may overflow. As long as the final result representation
can handle the final result without overflow, then the result is valid.
Example :
We want to compute 104 + 82
104 + 82 = 70 overflow !

94 with 8 bits :

29/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

MSB formatting

Jacskon’s Rule (1979)
This Rule states that in consecutive additions and/or subtractions
in two’s complement arithmetic, some intermediate results and
operands may overflow. As long as the final result representation
can handle the final result without overflow, then the result is valid.
Example :
We want to compute 104 + 82 94 with 8 bits :
104 + 82 = 70 overflow !
but 70 94 = 92 overflow !
This second overflow cancels the first one and we obtain the
expected result.

29/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

MSB formatting

Fixed-Point Jacskon’s Rule
Let s be a sum of n fixed-point number pi s, in format (M, L). If s
is known to have a final MSB equals to mf with mf < M, then:
1
0
mf +1
mf
M X
@
s=
2j pi,j A
1in

j=L

s
s
s
s
s
s
s
M

s
mf

L

s
sf
30/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

MSB formatting

Fixed-Point Jacskon’s Rule
Let s be a sum of n fixed-point number pi s, in format (M, L). If s
is known to have a final MSB equals to mf with mf < M, then:
1
0
mf +1
mf
M X
@
s=
2j pi,j A
1in

j=L

s
s
s
s
s
s
s s s
s
M
mf

L

s
sf
30/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

LSB formatting

LSB Formatting main idea (from Florent de Dinechin)
s
s
s
s
s
s
s
s

s
sf

31/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

LSB formatting

LSB Formatting main idea (from Florent de Dinechin)
s
s
s
s
s
s
s
s

s0
sf

31/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

LSB formatting

LSB Formatting main idea (from Florent de Dinechin)
s
s
s
s
s
s
s
s

s0
sf0

31/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

LSB formatting

LSB Formatting main idea (from Florent de Dinechin)
s
s
s
s
s
s
s
s

s0
sf0

sf0 6= sf BUT sf0 is a faithful round-o↵ of sf .

31/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

LSB formatting

LSB Formatting main idea (from Florent de Dinechin)
s
s
s
s
s
s
s

s

s

sf0

Can we determine a minimal
round-o↵ of sf ?

such that sf0 is always a faithful

31/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

LSB formatting

evaluation
For both rounding mode (round-to-nearest or truncation), the
smallest integer that provides sf0 = ?lf (sf ) is given by:
= dlog2 (n)e

32/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

LSB formatting

evaluation
For both rounding mode (round-to-nearest or truncation), the
smallest integer that provides sf0 = ?lf (sf ) is given by:
= dlog2 (n)e
More precisely
Some pi s may have LSB (`i ) greater than the final LSB `f , so we
don’t need to consider them in computation :
= dlog2 (nf )e
with nf = Card(If ) and If , {i | `i < `f }.

32/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Formatting method
s
s
s
s
s
s
s
s

1

s
sf

we compute

33/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Formatting method
s
s
s
s
s
s
s
s

1
2
3
4

we
we
we
we

s
sf0

compute
format all pi s into FPF (mf , lf
compute s
obtain sf0 from s

)

33/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Back to our main example
Main example

s
s
s
s
s
s
s
s
s
s
s

34/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Back to our main example
Main example

s
s
s
s
s
s
s
s
s
s
s
= dlog2 (n)e

All the di↵erent oSoP have the same errors
=) Here, error is not a criteria to choose the best oSoP

34/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

oSoP

S
(5,-10)
>> 4
(5,-14)
+

(5,-14)
+

(5,-14)
+

4)

(5,-1
+

)

14
(5,-

(5,-

F
9

23520

⇥

F

(5,-10)
y [n

1]

(2,-13)
-26282

(5,-10)

y [n

2]

(5,-

19

(4,-11) (-7,-22)
u[n]

22280

⇥

4)

12

(-2,-14)
(-1,-16)
-20887

⇥

+

)

14
(5,(5,-10)

y [n

4]

(5,-

F

3]
(-9,-24)
22280

⇥

(4,-11)
u[n

4]

(1,-14)
26781

4)
F

4)
F
(-1,-14)
(-7,-22)
18

F

21

(5,-1

(5,-1

14)

(-4,-14)

(4,-11)
u[n

+

(5,-1

14)

F

(-4,-14)
21

⇥
(8,-14)
(-9,-24)
9
22280
⇥

+

4)

(5,-1
+

14)
(5,-

4)

F

(8,-14)

(2,-13)

(5,-1

14)

(5,-14)

(5,-14)

22280
⇥
(7,-14)
(-6,-21)
(4,-11)
10
16710
u[n 2]
⇥

(-2,-14)
19
⇥

(4,-11)
u[n

1]

(5,-10)

y [n

3]

35/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Comparison

s
s
s
s
s
s
s
s
s
s
s
2

=0

3

= dlog2 (nf )e

1

= min(`i )
i

36/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Comparison
y(k)
F ix2
F ix3
F ix1

k

y 2 [ y;

y ] = [ 8.52445240 ⇥ 10

2

; 1.26555189 ⇥ 10

2

]
36/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Formatting
This new task can be inserted in FiPoGen process.
sum-of-product
realisation

Fixed-Point
Conversion

fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

37/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Formatting
This new task can be inserted in FiPoGen process.
sum-of-product
realisation

Fixed-Point
Conversion
fixed-point
algorithm

Formatting

"lighter"
fixed-point
algorithm

Evaluation
scheme

one evaluation
scheme

Formats
propagation /
Noise
evaluation

fullyparametrized
scheme

Optimization /
Best scheme
choice

best fixed-point
scheme

Code
generation

new scheme
code

37/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Word-length optimization
It is a main current problem in fixed-point arithmetic. It consists of
minimizing the word-length of each parameter under constraints.

38/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Word-length optimization
It is a main current problem in fixed-point arithmetic. It consists of
minimizing the word-length of each parameter under constraints.
P
The idea, for a sum-of-products s = i ci ⇥ vi , is to :
define the cost function to minimize

min (ws +

P

i

w ci +

P

i

wvi )

38/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Word-length optimization
It is a main current problem in fixed-point arithmetic. It consists of
minimizing the word-length of each parameter under constraints.
P
The idea, for a sum-of-products s = i ci ⇥ vi , is to :
define the cost function to minimize

define the constraints on the error by considering formatting

`s

` ci + ` v i

38/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Word-length optimization
It is a main current problem in fixed-point arithmetic. It consists of
minimizing the word-length of each parameter under constraints.
P
The idea, for a sum-of-products s = i ci ⇥ vi , is to :
define the cost function to minimize

define the constraints on the error by considering formatting

ws

w ci

`s
wv i

ms

` ci + ` v i
m ci m v i

1

38/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Word-length optimization
It is a main current problem in fixed-point arithmetic. It consists of
minimizing the word-length of each parameter under constraints.
P
The idea, for a sum-of-products s = i ci ⇥ vi , is to :
define the cost function to minimize

define the constraints on the error by considering formatting

y (k) 2 [ y ;

y]

38/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Word-length optimization
It is a main current problem in fixed-point arithmetic. It consists of
minimizing the word-length of each parameter under constraints.
P
The idea, for a sum-of-products s = i ci ⇥ vi , is to :
define the cost function to minimize

define the constraints on the error by considering formatting

y (k) 2 [ y ;

y]

y and y are functions of e and e which are functions of ws , wci
and wvi .

38/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Formatting

Word-length optimization
It is a main current problem in fixed-point arithmetic. It consists of
minimizing the word-length of each parameter under constraints.
P
The idea, for a sum-of-products s = i ci ⇥ vi , is to :
define the cost function to minimize

define the constraints on the error by considering formatting
solve the problem using known solvers or find a new solution

38/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Conclusion
This PhD thesis answers the problem of optimal filter
implementation in fixed-point arithmetic.
For this, some works have been realized:
Formalisms : for conversion and basic operations in
fixed-point arithmetic
FiPoGen : a tool generating fixed-point code for a
well-fashioned algorithm
Bits formatting : a first step towards word-length optimization

39/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

Second part of the PhD thesis
A lot of works still to be done:
Wordlength optimization considering bits formatting
Make FiPoGen realizes the complete flow defined before
Do the link with Silviu’s works

40/41
Context and Objectives

FiPoGen

Bits Formatting

Conclusion

THANK YOU
Any questions?

41/41

More Related Content

What's hot

Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)bolovv
 
Develop Embedded Software Module-Session 3
Develop Embedded Software Module-Session 3Develop Embedded Software Module-Session 3
Develop Embedded Software Module-Session 3Naveen Kumar
 
Detecting Bugs in Binaries Using Decompilation and Data Flow Analysis
Detecting Bugs in Binaries Using Decompilation and Data Flow AnalysisDetecting Bugs in Binaries Using Decompilation and Data Flow Analysis
Detecting Bugs in Binaries Using Decompilation and Data Flow AnalysisSilvio Cesare
 
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...Raffi Khatchadourian
 
Develop Embedded Software Module-Session 2
Develop Embedded Software Module-Session 2Develop Embedded Software Module-Session 2
Develop Embedded Software Module-Session 2Naveen Kumar
 
C aptitude.2doc
C aptitude.2docC aptitude.2doc
C aptitude.2docSrikanth
 
FPGA Implementation of A New Chien Search Block for Reed-Solomon Codes RS (25...
FPGA Implementation of A New Chien Search Block for Reed-Solomon Codes RS (25...FPGA Implementation of A New Chien Search Block for Reed-Solomon Codes RS (25...
FPGA Implementation of A New Chien Search Block for Reed-Solomon Codes RS (25...IJERA Editor
 
Automatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSELAutomatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSELJoel Falcou
 
The Goal and The Journey - Turning back on one year of C++14 Migration
The Goal and The Journey - Turning back on one year of C++14 MigrationThe Goal and The Journey - Turning back on one year of C++14 Migration
The Goal and The Journey - Turning back on one year of C++14 MigrationJoel Falcou
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONAnil Pokhrel
 

What's hot (19)

5th Semester Electronic and Communication Engineering (June/July-2015) Questi...
5th Semester Electronic and Communication Engineering (June/July-2015) Questi...5th Semester Electronic and Communication Engineering (June/July-2015) Questi...
5th Semester Electronic and Communication Engineering (June/July-2015) Questi...
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
 
Develop Embedded Software Module-Session 3
Develop Embedded Software Module-Session 3Develop Embedded Software Module-Session 3
Develop Embedded Software Module-Session 3
 
Detecting Bugs in Binaries Using Decompilation and Data Flow Analysis
Detecting Bugs in Binaries Using Decompilation and Data Flow AnalysisDetecting Bugs in Binaries Using Decompilation and Data Flow Analysis
Detecting Bugs in Binaries Using Decompilation and Data Flow Analysis
 
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
 
Develop Embedded Software Module-Session 2
Develop Embedded Software Module-Session 2Develop Embedded Software Module-Session 2
Develop Embedded Software Module-Session 2
 
Captitude 2doc-100627004318-phpapp01
Captitude 2doc-100627004318-phpapp01Captitude 2doc-100627004318-phpapp01
Captitude 2doc-100627004318-phpapp01
 
C aptitude.2doc
C aptitude.2docC aptitude.2doc
C aptitude.2doc
 
5th Semester Electronic and Communication Engineering (2013-June) Question Pa...
5th Semester Electronic and Communication Engineering (2013-June) Question Pa...5th Semester Electronic and Communication Engineering (2013-June) Question Pa...
5th Semester Electronic and Communication Engineering (2013-June) Question Pa...
 
Gate-Cs 1999
Gate-Cs 1999Gate-Cs 1999
Gate-Cs 1999
 
Adobe
AdobeAdobe
Adobe
 
FPGA Implementation of A New Chien Search Block for Reed-Solomon Codes RS (25...
FPGA Implementation of A New Chien Search Block for Reed-Solomon Codes RS (25...FPGA Implementation of A New Chien Search Block for Reed-Solomon Codes RS (25...
FPGA Implementation of A New Chien Search Block for Reed-Solomon Codes RS (25...
 
Automatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSELAutomatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSEL
 
The Goal and The Journey - Turning back on one year of C++14 Migration
The Goal and The Journey - Turning back on one year of C++14 MigrationThe Goal and The Journey - Turning back on one year of C++14 Migration
The Goal and The Journey - Turning back on one year of C++14 Migration
 
Network Security CS3-4
Network Security CS3-4 Network Security CS3-4
Network Security CS3-4
 
Cs gate-2011
Cs gate-2011Cs gate-2011
Cs gate-2011
 
Qno 1 (f)
Qno 1 (f)Qno 1 (f)
Qno 1 (f)
 
Chapter 4 - Classes in Java
Chapter 4 - Classes in JavaChapter 4 - Classes in Java
Chapter 4 - Classes in Java
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTION
 

Similar to Optimal Filter Implementation in Fixed-Point Arithmetic

FPGA based BCH Decoder
FPGA based BCH DecoderFPGA based BCH Decoder
FPGA based BCH Decoderijsrd.com
 
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]RootedCON
 
SDR channelizer by sooraj
SDR channelizer by soorajSDR channelizer by sooraj
SDR channelizer by soorajsooraj yadav
 
Sample Exam Questions on Python for revision
Sample Exam Questions on Python for revisionSample Exam Questions on Python for revision
Sample Exam Questions on Python for revisionafsheenfaiq2
 
openMP loop parallelization
openMP loop parallelizationopenMP loop parallelization
openMP loop parallelizationAlbert DeFusco
 
MuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for CMuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for CSusumu Tokumoto
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerMarina Kolpakova
 
Logic Design - Chapter 5: Part1 Combinattional Logic
Logic Design - Chapter 5: Part1 Combinattional LogicLogic Design - Chapter 5: Part1 Combinattional Logic
Logic Design - Chapter 5: Part1 Combinattional LogicGouda Mando
 
new optimization algorithm for topology optimization
new optimization algorithm for topology optimizationnew optimization algorithm for topology optimization
new optimization algorithm for topology optimizationSeonho Park
 
An optimal and progressive algorithm for skyline queries slide
An optimal and progressive algorithm for skyline queries slideAn optimal and progressive algorithm for skyline queries slide
An optimal and progressive algorithm for skyline queries slideWooSung Choi
 
Cryptography and Network Security Principles and Practice
Cryptography and Network Security Principles and PracticeCryptography and Network Security Principles and Practice
Cryptography and Network Security Principles and PracticeTaunyaCoffman887
 
Cryptography and Network Security Principles and Practice (2)
Cryptography and Network Security Principles and Practice (2)Cryptography and Network Security Principles and Practice (2)
Cryptography and Network Security Principles and Practice (2)MargenePurnell14
 
Lcdf4 chap 03_p2
Lcdf4 chap 03_p2Lcdf4 chap 03_p2
Lcdf4 chap 03_p2ozgur_can
 
Metaheuristic Tuning of Type-II Fuzzy Inference System for Data Mining
Metaheuristic Tuning of Type-II Fuzzy Inference System for Data MiningMetaheuristic Tuning of Type-II Fuzzy Inference System for Data Mining
Metaheuristic Tuning of Type-II Fuzzy Inference System for Data MiningVarun Ojha
 
decoder and encoder
 decoder and encoder decoder and encoder
decoder and encoderUnsa Shakir
 

Similar to Optimal Filter Implementation in Fixed-Point Arithmetic (20)

FPGA based BCH Decoder
FPGA based BCH DecoderFPGA based BCH Decoder
FPGA based BCH Decoder
 
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
 
SDR channelizer by sooraj
SDR channelizer by soorajSDR channelizer by sooraj
SDR channelizer by sooraj
 
Sample Exam Questions on Python for revision
Sample Exam Questions on Python for revisionSample Exam Questions on Python for revision
Sample Exam Questions on Python for revision
 
openMP loop parallelization
openMP loop parallelizationopenMP loop parallelization
openMP loop parallelization
 
MuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for CMuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for C
 
Slide11 icc2015
Slide11 icc2015Slide11 icc2015
Slide11 icc2015
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
 
Logic Design - Chapter 5: Part1 Combinattional Logic
Logic Design - Chapter 5: Part1 Combinattional LogicLogic Design - Chapter 5: Part1 Combinattional Logic
Logic Design - Chapter 5: Part1 Combinattional Logic
 
3320 cyclic codes.ppt
3320 cyclic codes.ppt3320 cyclic codes.ppt
3320 cyclic codes.ppt
 
RLTopics_2021_Lect1.pdf
RLTopics_2021_Lect1.pdfRLTopics_2021_Lect1.pdf
RLTopics_2021_Lect1.pdf
 
new optimization algorithm for topology optimization
new optimization algorithm for topology optimizationnew optimization algorithm for topology optimization
new optimization algorithm for topology optimization
 
An optimal and progressive algorithm for skyline queries slide
An optimal and progressive algorithm for skyline queries slideAn optimal and progressive algorithm for skyline queries slide
An optimal and progressive algorithm for skyline queries slide
 
Anfis.rpi04
Anfis.rpi04Anfis.rpi04
Anfis.rpi04
 
Cryptography and Network Security Principles and Practice
Cryptography and Network Security Principles and PracticeCryptography and Network Security Principles and Practice
Cryptography and Network Security Principles and Practice
 
Cryptography and Network Security Principles and Practice (2)
Cryptography and Network Security Principles and Practice (2)Cryptography and Network Security Principles and Practice (2)
Cryptography and Network Security Principles and Practice (2)
 
keeloq-final
keeloq-finalkeeloq-final
keeloq-final
 
Lcdf4 chap 03_p2
Lcdf4 chap 03_p2Lcdf4 chap 03_p2
Lcdf4 chap 03_p2
 
Metaheuristic Tuning of Type-II Fuzzy Inference System for Data Mining
Metaheuristic Tuning of Type-II Fuzzy Inference System for Data MiningMetaheuristic Tuning of Type-II Fuzzy Inference System for Data Mining
Metaheuristic Tuning of Type-II Fuzzy Inference System for Data Mining
 
decoder and encoder
 decoder and encoder decoder and encoder
decoder and encoder
 

Recently uploaded

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Optimal Filter Implementation in Fixed-Point Arithmetic

  • 1. Context and Objectives FiPoGen Bits Formatting Conclusion Optimal filter implementation in fixed-point arithmetic Benoit Lopez Seminar ARIC team December 12th 2013 1/41
  • 2. Context and Objectives FiPoGen Bits Formatting Conclusion Outline 1 Context and Objectives 2 FiPoGen 3 Bits Formatting 4 Conclusion 2/41
  • 3. Context and Objectives FiPoGen Bits Formatting Conclusion ANR DEFIS Projet ANR-11-INSE-008 DEsign of FIxed-point embedded Systems (DEFIS) 3/41
  • 4. Context and Objectives FiPoGen Bits Formatting Conclusion ANR DEFIS Projet ANR-11-INSE-008 DEsign of FIxed-point embedded Systems (DEFIS) Various partners : Research : IRISA, LIRMM (DALI), CEA, LIP6 3/41
  • 5. Context and Objectives FiPoGen Bits Formatting Conclusion ANR DEFIS Projet ANR-11-INSE-008 DEsign of FIxed-point embedded Systems (DEFIS) Various partners : Research : IRISA, LIRMM (DALI), CEA, LIP6 Industrial : Thales, InPixal 3/41
  • 6. Context and Objectives FiPoGen Bits Formatting Conclusion On the first hand... A filter x[n] z b0 + + z + + 1 h(z) = z Pn 1+ b1 i=0 Pn bi z 1 y[n] + b1 a1 b2 z a2 1 b3 x[n] 1 a1 1 b2 z y[n] + z b1 z + 1 a2 z 1 z 1 z 1 i i=1 ai z i z 1 b3 1 z a3 1 a3 Signal Processing LTI filters: FIR or IIR Its transfer function Algorithmic relationship used to compute output(s) from input(s), for example: y (k) = n X i=0 bi u(k i) n X ai y (k i) i=1 4/41
  • 7. Context and Objectives FiPoGen Bits Formatting Conclusion On the other hand... A target ... ±2 2 ... 2 0 2 s Hardware target (FPGA, ASIC) or software target (DSP,µC) Using fixed-point arithmetic for di↵erent reasons: no FPU cost size power consumption etc. 5/41
  • 8. Context and Objectives FiPoGen x[n] z b0 z + 1 ... a1 1 z + + ±2 2 ... 2 0 2 1 s a2 1 b3 1 z b2 z + Conclusion y[n] + 1 b1 z + Bits Formatting a3 Need Methodology and tools for the implementation of embedded filter algorithms in fixed-point arithmetic. 6/41
  • 9. Context and Objectives FiPoGen x[n] z b0 z + 1 ... a1 1 z + + ±2 2 ... 2 0 2 1 s a2 1 b3 1 z b2 z + Conclusion y[n] + 1 b1 z + Bits Formatting a3 Need Methodology and tools for the implementation of embedded filter algorithms in fixed-point arithmetic. A first methodology 1 Given a filter, choose an algorithm 2 Round the coe cients in fixed-point arithmetic 3 Implement algorithm 6/41
  • 10. Context and Objectives FiPoGen x[n] z b0 z + 1 ... a1 1 z + + ±2 2 ... 2 0 2 1 s a2 1 b3 1 z b2 z + Conclusion y[n] + 1 b1 z + Bits Formatting a3 Need Methodology and tools for the implementation of embedded filter algorithms in fixed-point arithmetic. A first methodology 1 Given a filter, choose an algorithm There are many possible realizations 2 Round the coe cients in fixed-point arithmetic 3 Implement algorithm What word-length? Depends on the choice of algorithm Is there only one possible implementation? 6/41
  • 11. Context and Objectives FiPoGen Bits Formatting Conclusion Fixed-Point Arithmetic Fixed-Point number 2m 2m Xm 1 20 2 1 2` X0 X 1 X` w Representation : X .2` with X = Xm Xm 1 ...X0 ...X` . Format : determined by wordlength and fixed-point position, and noted for example (m, `). 7/41
  • 12. Context and Objectives FiPoGen Bits Formatting Conclusion Fixed-Point Arithmetic Some FPF examples p p 2 with 8 bits : FxP8 ( 2) = 90.2 21 20 2 0 3 1 1 1 ⇡ with 6 bits : FxP6 (3 2 1 1 0 ⇡) = 1 0 0 18.2 3 2 6 2 0 2 6 1 1 7 7 2 1 (1, 6) 0 ( 2, 7) 42 with 5 bits : FxP5 (42) = 10.22 26 25 0 1 22 0 1 0 (6, 2) 8/41
  • 13. Context and Objectives FiPoGen Bits Formatting Conclusion Fixed-Point Arithmetic Some FPF examples p p 2 with 8 bits : FxP8 ( 2) = 90.2 21 20 2 0 3 1 1.40625 1 1 ⇡ with 6 bits : FxP6 (3 2 1 1 0 ⇡) = 1 0 0 18.2 3 2 6 2 0 2 6= 1 1 7= 0.140625 7 2 1 (1, 6) 0 ( 2, 7) 42 with 5 bits : FxP5 (42) = 10.22 = 40 26 25 0 1 22 0 1 0 (6, 2) 8/41
  • 14. Context and Objectives FiPoGen Bits Formatting Conclusion Fixed-Point Arithmetic Fixed-Point number 2m 2m Xm 1 20 2 1 2` X0 X 1 X` w Representation : X .2` with X = Xm Xm 1 ...X0 ...X` Format : determined by wordlength and fixed-point position, and noted for example (m, `) Only the mantissa X is stored, the scale 2` is implicit 9/41
  • 15. Context and Objectives FiPoGen Bits Formatting Conclusion Fixed-Point Arithmetic Sum example We want to compute 42 + 0 1 0 1 0 p 2 with an 8-bit operator : 1 0 0 1 0 84 0 1 1 0 1 0 90 s 10/41
  • 16. Context and Objectives FiPoGen Bits Formatting Conclusion Fixed-Point Arithmetic Sum example We want to compute 42 + 0 1 0 0 1 1 0 2 with an 8-bit operator : 0 1 0 1 0 1 1 84 0 0 0 1 p 0 1 1 p FxP8 (FxP8 (42) + FxP8 ( 2)) = FxP8 (84.2 0 1 2 0 86 1 + 90.2 6) = 10/41
  • 17. Context and Objectives FiPoGen Bits Formatting Conclusion Fixed-Point Arithmetic Sum example We want to compute 42 + 0 1 0 0 1 1 0 2 with an 8-bit operator : 0 1 0 1 0 1 1 84 0 0 0 1 p 0 1 1 p FxP8 (FxP8 (42) + FxP8 ( 2)) = FxP8 (84.2 84.2 1 + (90 5).2 1 = 86.2 1 = 43 p FxP8 (42) + FxP8 ( 2) = 43.40625 0 1 2 0 86 1 + 90.2 6) = 10/41
  • 18. Context and Objectives FiPoGen Bits Formatting Conclusion Fixed-Point Arithmetic Sum example We want to compute 42 + 0 1 0 0 1 1 0 2 with an 8-bit operator : 0 1 0 1 0 1 1 84 0 0 0 1 p 0 1 1 p FxP8 (FxP8 (42) + FxP8 ( 2)) = FxP8 (84.2 84.2 1 + (90 5).2 1 = 86.2 1 = 43 p FxP8 (42) + FxP8 ( 2) = 43.40625 0 1 2 0 86 1 + 90.2 6) = 10/41
  • 19. Context and Objectives FiPoGen Bits Formatting Conclusion Fixed-Point Arithmetic Fixed-Point number 2m 2m Xm 1 20 2 1 2` X0 X 1 X` w Representation : X .2` with X = Xm Xm 1 ...X0 ...X` Format : determined by wordlength and fixed-point position, and noted for example (m, `) Only the mantissa X is stored, the scale 2` is implicit Computation in finite precision implies errors. Numerical degradations quantization of the coe cients round-o↵ errors in computations 11/41
  • 20. Context and Objectives FiPoGen Bits Formatting Conclusion Filter IIR Filter Let H be the transfer function of a n H(z) = b0 + b1 z 1 + a1 z 1 th order IIR filter : + · · · + bn z 1 + ··· + a z n n n , 8z 2 C. (1) 12/41
  • 21. Context and Objectives FiPoGen Bits Formatting Conclusion Filter IIR Filter Let H be the transfer function of a n H(z) = b0 + b1 z 1 + a1 z 1 th order IIR filter : + · · · + bn z 1 + ··· + a z n n n , 8z 2 C. (1) There is a lot of di↵erent realizations for a filter : Direct Form I, DF II, ⇢DF II transposed State-Space realizations, -operator, LGS, LCW parallel or cascade decompostion ... Each realization needs its own parameters and therefore the impact of FxP computation will depend on the realization. 12/41
  • 22. Context and Objectives FiPoGen Bits Formatting Conclusion Filter This filter is usually realized with the following algorithm y (k) = n X bi u(k i) i=0 n X ai y (k i) (2) i=1 where u(k) is the input at step k and y (k) the output at step k. We can see round-o↵ errors as the add of an error e(k) on the output and only y † (k) can be computed. y † (k) = n X i=0 bi u(k i) n X ai y † (k i) + e(k). (3) i=1 13/41
  • 23. Context and Objectives FiPoGen Bits Formatting Conclusion Filter u(k) e(k) H He y(k) y(k) + y † (k) y (k) , y † (k) y (k) can be seen as the result of the error through the filter He : He (z) = 1 + a1 z 1 1 + · · · + an z n , 8z 2 C. 14/41
  • 24. Context and Objectives FiPoGen Bits Formatting Conclusion Filter u(k) e(k) H He y(k) y(k) + y † (k) y (k) , y † (k) y (k) can be seen as the result of the error through the filter He : He (z) = 1 + a1 z 1 1 + · · · + an z n , 8z 2 C. If the error e(k) is in [e; e], then we are able to compute y such that y (k) is in [ y ; y ] : y = y = y and e +e e e |He |DC kHe k`1 2 2 e +e e e |He |DC + kHe k`1 2 2 14/41
  • 25. Context and Objectives FiPoGen Bits Formatting Conclusion Objective Objective: Given an algorithm and a target, find the optimal implementation. model the fixed-point algorithms model the hardware resources (computational units, etc.) evaluate the degradation find one/some optimal implemented algorithm(s) 15/41
  • 26. Context and Objectives FiPoGen Bits Formatting Conclusion Objective From filter to code, global flow algorithm transformation implementation filter set of equivalent realisations SIF Realisation choice optimal realisation Fixed-point implementation fixed-point algorithm language Code generation code sensibillity mesures multi-criteria optimisation 16/41
  • 27. Context and Objectives FiPoGen Bits Formatting Conclusion Objective From filter to code, global flow algorithm transformation implementation filter set of equivalent realisations SIF Realisation choice optimal realisation Fixed-point implementation fixed-point algorithm language Code generation code sensibillity mesures multi-criteria optimisation 17/41
  • 28. Context and Objectives FiPoGen Bits Formatting Conclusion Outline 1 Context and Objectives 2 FiPoGen 3 Bits Formatting 4 Conclusion 18/41
  • 29. Context and Objectives FiPoGen Bits Formatting Conclusion The only operations needed in filter algorithm computation are sum-of-products: n X S= c i · xi i=1 where ci are known constants and xi variables (inputs, state or intermediate variables). Question: How to implement computation of S in fixed-point arithmetic? What control on degradation errors? 19/41
  • 30. Context and Objectives FiPoGen Bits Formatting Conclusion The only operations needed in filter algorithm computation are sum-of-products: n X S= c i · xi i=1 where ci are known constants and xi variables (inputs, state or intermediate variables). Question: How to implement computation of S in fixed-point arithmetic? What control on degradation errors? Answer: A tool responding to the global flow in particular case of sum-of-product (FiPoGen). 19/41
  • 31. Context and Objectives FiPoGen Bits Formatting Conclusion Main example Let H be the transfer function of a butterworth filter of 4th order: H(z) = 0.00132801779278 + 0.00531207117112z 1 + 0.00796810675667z 2 + 0.00531207117112z 3 + 0.00132801779278z 4 1 2.87111622831650z 1 + 3.20825006629575z 2 1.63459488108445z 3 + 0.31870932778967z 4 Associated algorithm: y (k) = 0.0013279914856 u(k) + 0.00531196594238 u(k +0.00531196594238 u(k 3.20825195312 y (k 1) + 0.00796794891357 u(k 3) + 0.0013279914856 u(k 2) + 1.63458251953 y (k 3) 2) 4) + 2.87109375 y (k 1) 0.318710327148 y (k 4) Inputs datas : wordlength of constants, u(k) and y (k) : 16 bits u(k) 2 [ 13, 13] and y (k) 2 [ 17.123541; 17.123541] Bits formatting example 20/41
  • 32. Context and Objectives FiPoGen Bits Formatting Conclusion From filter to code, global flow algorithm transformation implementation filter set of equivalent realisations SIF Realisation choice optimal realisation Fixed-point implementation fixed-point algorithm language Code generation code sensibillity mesures multi-criteria optimisation 21/41
  • 33. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen - Fixed Point Generator sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Conversion The user gives in input to FiPoGen the wordlentgh of each constants, and FiPoGen computes the complete format of each of them, and specifies the format of each variables. 22/41
  • 34. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Order In software, addition can be not associative, therefore all di↵erent orders of additions must be considered. 23/41
  • 35. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Order In software, addition can be not associative, therefore all di↵erent orders of additions must be considered. oSoP An evaluation scheme for a given sum-of-products with a given order will be called ordered-sum-of-products (oSoP). 23/41
  • 36. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fullyparametrized scheme one evaluation scheme fixed-point algorithm Formats propagation / Noise evaluation Evaluation scheme best fixed-point scheme Optimization / Best scheme choice Code generation new scheme code S + + + 16 + + (-1,-16) + -20887 16 + 16 (1,-14) 26781 ⇥ (2,-13) 16 (5,-10) y [n 3] (2,-13) 23520 ⇥ -26282 (5,-10) y [n 1] ⇥ (5,-10) 16 2] (-9,-24) 22280 ⇥ (-7,-22) 16 (4,-11) (-6,-21) u[n] (5,-10) y [n 4] (-9,-24) 22280 ⇥ 16 (4,-11) (-7,-22) u[n 4] 22280 ⇥ (4,-11) u[n 1] 16 + y [n ⇥ 16 16710 ⇥ 22280 ⇥ (4,-11) u[n 3] (4,-11) u[n 2] 23/41
  • 37. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation fixed-point algorithm Fixed-Point Conversion Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme best fixed-point scheme Optimization / Best scheme choice Code generation new scheme code Number of oSoP For a given sum-of-products of N th order, there are oSoP to consider. QN 1 i=1 (2i 1) 23/41
  • 38. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fullyparametrized scheme one evaluation scheme fixed-point algorithm Formats propagation / Noise evaluation Evaluation scheme best fixed-point scheme Optimization / Best scheme choice Code generation new scheme code S + + + 16 + 16 + 16 (-1,-16) -20887 ⇥ (2,-13) 16 (5,-10) y [n 4] (2,-13) (1,-14) 26781 ⇥ 23520 ⇥ -26282 y [n 16 22280 ⇥ (-9,-24) 16 (4,-11) (-6,-21) u[n 3] (-9,-24) 16 + (-7,-22) 16710 ⇥ (-7,-22) 16 + 2] 1] 3] 16 + (5,-10) (5,-10) y [n (5,-10) y [n ⇥ 22280 ⇥ 22280 ⇥ 22280 ⇥ (4,-11) u[n 1] (4,-11) u[n 4] (4,-11) u[n] (4,-11) u[n 2] 23/41
  • 39. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation fixed-point algorithm Fixed-Point Conversion Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme best fixed-point scheme Optimization / Best scheme choice Code generation new scheme code Number of oSoP For a given sum-of-products of N th order, there are oSoP to consider. QN 1 i=1 (2i 1) Generation At this step, FiPoGen generates all the oSoP one by one. 23/41
  • 40. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Formats propagation From an oSoP parametrized with inputs FPF and wordlength, and using some propagation rules on adders and multipliers, we obtain a fully-parametrized oSoP. 24/41
  • 41. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen S (5,-10) + (5,-10) + ,-10) (5 + 0) (5,-1 (5,- + 10) (5,- 16 (-1,-16) -20887 ⇥ (8,-7) 16 (7,-8) 16 (5,-10) y [n 4] (1,-14) 26781 (8,-7) 16 F ⇥ (2,-13) 23520 ⇥ (2,-13) -26282 ⇥ y [n y [n 1] 2] + ( -2 (-7,-22) 22280 6) ⇥ 16 (-2,-1 16710 u[n 1] 22280 ⇥ (4,-11) u[n 2] >> 2 ) (-4,-19) 16 (4,-11) (-7,-22) (-6,-21) 7) ,-17 16 3] + 7) (-2,-1 ) ,-17 ( -2 (5,-10) y [n (-1,-1 >> 1 (-2,-17) (5,-10) (5,-10) + 6) (-1,-1 F 0) F >> 6 (-1,-16) 0) (5,-1 10) (5,-10) (5,-1 ⇥ 9) , -1 ( -4 (4,-11) u[n + ( -4 , -1 16 3] (-9,-24) 22280 ⇥ 9) 16 (4,-11) (-9,-24) u[n] 22280 ⇥ (4,-11) u[n 4] 24/41
  • 42. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Propagation =) right-shifts By propagating formats, some additions yield a right-shift on its operands (for aligning them onto the result format). This right-shift implies error onto the final result. 24/41
  • 43. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fullyparametrized scheme one evaluation scheme fixed-point algorithm Evaluation scheme Formats propagation / Noise evaluation best fixed-point scheme Optimization / Best scheme choice Code generation new scheme code Right-shift =) error interval The right shifting of d bits of a variable x (with (m, `) as FPF) is equivalent to add an interval error [e] = [e; e] with [e, e] Truncation [ 2`+d + 2` ; 0] Round to the nearest [ 2`+d 1 + 2` ; 2`+d 1 ] (4) Cumulated error is therefore computed for a given evaluation scheme. 24/41
  • 44. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Optimization criteria errors (noise : couple mean/variance) error interval 25/41
  • 45. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Optimization criteria errors latency (infinite parallelism) height of the syntax tree 25/41
  • 46. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Optimization criteria errors latency (infinite parallelism) adequacy with hardware target number of operators wordlength of operators etc. 25/41
  • 47. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Optimization criteria errors latency (infinite parallelism) adequacy with hardware target etc. 25/41
  • 48. Context and Objectives FiPoGen Bits Formatting Conclusion FiPoGen sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code Once we have the best evaluation scheme, we choose a language and we generate the associated fixed-point code. 26/41
  • 49. Context and Objectives FiPoGen Bits Formatting Conclusion Outline 1 Context and Objectives 2 FiPoGen 3 Bits Formatting 4 Conclusion 27/41
  • 50. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting s s s s s s s s s sf Context A sum of N terms (pi )1iN with di↵erent formats, and the known FPF of final result (sf ), less than total wordlength (s). 28/41
  • 51. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting s s s s s s s s s sf Context A sum of N terms (pi )1iN with di↵erent formats, and the known FPF of final result (sf ), less than total wordlength (s). Question: Can we remove some useless bits ? 28/41
  • 52. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting s s s s s s s s s sf Two-step formatting 1 most significant bits 2 least significant bits 28/41
  • 53. Context and Objectives FiPoGen Bits Formatting Conclusion MSB formatting Jacskon’s Rule (1979) This Rule states that in consecutive additions and/or subtractions in two’s complement arithmetic, some intermediate results and operands may overflow. As long as the final result representation can handle the final result without overflow, then the result is valid. 29/41
  • 54. Context and Objectives FiPoGen Bits Formatting Conclusion MSB formatting Jacskon’s Rule (1979) This Rule states that in consecutive additions and/or subtractions in two’s complement arithmetic, some intermediate results and operands may overflow. As long as the final result representation can handle the final result without overflow, then the result is valid. Example : We want to compute 104 + 82 94 with 8 bits : 29/41
  • 55. Context and Objectives FiPoGen Bits Formatting Conclusion MSB formatting Jacskon’s Rule (1979) This Rule states that in consecutive additions and/or subtractions in two’s complement arithmetic, some intermediate results and operands may overflow. As long as the final result representation can handle the final result without overflow, then the result is valid. Example : We want to compute 104 + 82 104 + 82 = 70 overflow ! 94 with 8 bits : 29/41
  • 56. Context and Objectives FiPoGen Bits Formatting Conclusion MSB formatting Jacskon’s Rule (1979) This Rule states that in consecutive additions and/or subtractions in two’s complement arithmetic, some intermediate results and operands may overflow. As long as the final result representation can handle the final result without overflow, then the result is valid. Example : We want to compute 104 + 82 94 with 8 bits : 104 + 82 = 70 overflow ! but 70 94 = 92 overflow ! This second overflow cancels the first one and we obtain the expected result. 29/41
  • 57. Context and Objectives FiPoGen Bits Formatting Conclusion MSB formatting Fixed-Point Jacskon’s Rule Let s be a sum of n fixed-point number pi s, in format (M, L). If s is known to have a final MSB equals to mf with mf < M, then: 1 0 mf +1 mf M X @ s= 2j pi,j A 1in j=L s s s s s s s M s mf L s sf 30/41
  • 58. Context and Objectives FiPoGen Bits Formatting Conclusion MSB formatting Fixed-Point Jacskon’s Rule Let s be a sum of n fixed-point number pi s, in format (M, L). If s is known to have a final MSB equals to mf with mf < M, then: 1 0 mf +1 mf M X @ s= 2j pi,j A 1in j=L s s s s s s s s s s M mf L s sf 30/41
  • 59. Context and Objectives FiPoGen Bits Formatting Conclusion LSB formatting LSB Formatting main idea (from Florent de Dinechin) s s s s s s s s s sf 31/41
  • 60. Context and Objectives FiPoGen Bits Formatting Conclusion LSB formatting LSB Formatting main idea (from Florent de Dinechin) s s s s s s s s s0 sf 31/41
  • 61. Context and Objectives FiPoGen Bits Formatting Conclusion LSB formatting LSB Formatting main idea (from Florent de Dinechin) s s s s s s s s s0 sf0 31/41
  • 62. Context and Objectives FiPoGen Bits Formatting Conclusion LSB formatting LSB Formatting main idea (from Florent de Dinechin) s s s s s s s s s0 sf0 sf0 6= sf BUT sf0 is a faithful round-o↵ of sf . 31/41
  • 63. Context and Objectives FiPoGen Bits Formatting Conclusion LSB formatting LSB Formatting main idea (from Florent de Dinechin) s s s s s s s s s sf0 Can we determine a minimal round-o↵ of sf ? such that sf0 is always a faithful 31/41
  • 64. Context and Objectives FiPoGen Bits Formatting Conclusion LSB formatting evaluation For both rounding mode (round-to-nearest or truncation), the smallest integer that provides sf0 = ?lf (sf ) is given by: = dlog2 (n)e 32/41
  • 65. Context and Objectives FiPoGen Bits Formatting Conclusion LSB formatting evaluation For both rounding mode (round-to-nearest or truncation), the smallest integer that provides sf0 = ?lf (sf ) is given by: = dlog2 (n)e More precisely Some pi s may have LSB (`i ) greater than the final LSB `f , so we don’t need to consider them in computation : = dlog2 (nf )e with nf = Card(If ) and If , {i | `i < `f }. 32/41
  • 66. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Formatting method s s s s s s s s 1 s sf we compute 33/41
  • 67. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Formatting method s s s s s s s s 1 2 3 4 we we we we s sf0 compute format all pi s into FPF (mf , lf compute s obtain sf0 from s ) 33/41
  • 68. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Back to our main example Main example s s s s s s s s s s s 34/41
  • 69. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Back to our main example Main example s s s s s s s s s s s = dlog2 (n)e All the di↵erent oSoP have the same errors =) Here, error is not a criteria to choose the best oSoP 34/41
  • 70. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting oSoP S (5,-10) >> 4 (5,-14) + (5,-14) + (5,-14) + 4) (5,-1 + ) 14 (5,- (5,- F 9 23520 ⇥ F (5,-10) y [n 1] (2,-13) -26282 (5,-10) y [n 2] (5,- 19 (4,-11) (-7,-22) u[n] 22280 ⇥ 4) 12 (-2,-14) (-1,-16) -20887 ⇥ + ) 14 (5,(5,-10) y [n 4] (5,- F 3] (-9,-24) 22280 ⇥ (4,-11) u[n 4] (1,-14) 26781 4) F 4) F (-1,-14) (-7,-22) 18 F 21 (5,-1 (5,-1 14) (-4,-14) (4,-11) u[n + (5,-1 14) F (-4,-14) 21 ⇥ (8,-14) (-9,-24) 9 22280 ⇥ + 4) (5,-1 + 14) (5,- 4) F (8,-14) (2,-13) (5,-1 14) (5,-14) (5,-14) 22280 ⇥ (7,-14) (-6,-21) (4,-11) 10 16710 u[n 2] ⇥ (-2,-14) 19 ⇥ (4,-11) u[n 1] (5,-10) y [n 3] 35/41
  • 71. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Comparison s s s s s s s s s s s 2 =0 3 = dlog2 (nf )e 1 = min(`i ) i 36/41
  • 72. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Comparison y(k) F ix2 F ix3 F ix1 k y 2 [ y; y ] = [ 8.52445240 ⇥ 10 2 ; 1.26555189 ⇥ 10 2 ] 36/41
  • 73. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Formatting This new task can be inserted in FiPoGen process. sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code 37/41
  • 74. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Formatting This new task can be inserted in FiPoGen process. sum-of-product realisation Fixed-Point Conversion fixed-point algorithm Formatting "lighter" fixed-point algorithm Evaluation scheme one evaluation scheme Formats propagation / Noise evaluation fullyparametrized scheme Optimization / Best scheme choice best fixed-point scheme Code generation new scheme code 37/41
  • 75. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Word-length optimization It is a main current problem in fixed-point arithmetic. It consists of minimizing the word-length of each parameter under constraints. 38/41
  • 76. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Word-length optimization It is a main current problem in fixed-point arithmetic. It consists of minimizing the word-length of each parameter under constraints. P The idea, for a sum-of-products s = i ci ⇥ vi , is to : define the cost function to minimize min (ws + P i w ci + P i wvi ) 38/41
  • 77. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Word-length optimization It is a main current problem in fixed-point arithmetic. It consists of minimizing the word-length of each parameter under constraints. P The idea, for a sum-of-products s = i ci ⇥ vi , is to : define the cost function to minimize define the constraints on the error by considering formatting `s ` ci + ` v i 38/41
  • 78. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Word-length optimization It is a main current problem in fixed-point arithmetic. It consists of minimizing the word-length of each parameter under constraints. P The idea, for a sum-of-products s = i ci ⇥ vi , is to : define the cost function to minimize define the constraints on the error by considering formatting ws w ci `s wv i ms ` ci + ` v i m ci m v i 1 38/41
  • 79. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Word-length optimization It is a main current problem in fixed-point arithmetic. It consists of minimizing the word-length of each parameter under constraints. P The idea, for a sum-of-products s = i ci ⇥ vi , is to : define the cost function to minimize define the constraints on the error by considering formatting y (k) 2 [ y ; y] 38/41
  • 80. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Word-length optimization It is a main current problem in fixed-point arithmetic. It consists of minimizing the word-length of each parameter under constraints. P The idea, for a sum-of-products s = i ci ⇥ vi , is to : define the cost function to minimize define the constraints on the error by considering formatting y (k) 2 [ y ; y] y and y are functions of e and e which are functions of ws , wci and wvi . 38/41
  • 81. Context and Objectives FiPoGen Bits Formatting Conclusion Formatting Word-length optimization It is a main current problem in fixed-point arithmetic. It consists of minimizing the word-length of each parameter under constraints. P The idea, for a sum-of-products s = i ci ⇥ vi , is to : define the cost function to minimize define the constraints on the error by considering formatting solve the problem using known solvers or find a new solution 38/41
  • 82. Context and Objectives FiPoGen Bits Formatting Conclusion Conclusion This PhD thesis answers the problem of optimal filter implementation in fixed-point arithmetic. For this, some works have been realized: Formalisms : for conversion and basic operations in fixed-point arithmetic FiPoGen : a tool generating fixed-point code for a well-fashioned algorithm Bits formatting : a first step towards word-length optimization 39/41
  • 83. Context and Objectives FiPoGen Bits Formatting Conclusion Second part of the PhD thesis A lot of works still to be done: Wordlength optimization considering bits formatting Make FiPoGen realizes the complete flow defined before Do the link with Silviu’s works 40/41
  • 84. Context and Objectives FiPoGen Bits Formatting Conclusion THANK YOU Any questions? 41/41