SlideShare a Scribd company logo
Context and Objectives

Bits Formatting

Conclusion

Formatting bits to better implement signal
processing algorithms
e
Benoit Lopez - Thibault Hilaire - Laurent-St´phane Didier
PECCS 2014

January 9th 2014

1/20
Context and Objectives

Bits Formatting

Conclusion

Outline

1

Context and Objectives

2

Bits Formatting

3

Conclusion

2/20
Context and Objectives

Bits Formatting

Conclusion

In PECCS’14
Smartphone applications, measurement applications, embedded
devices, ...

3/20
Context and Objectives

Bits Formatting

Conclusion

In PECCS’14
Smartphone applications, measurement applications, embedded
devices, ...
Implementation problem
We need methodology and tools for the implementation of
embedded filter algorithms with only integer arithmetic.

3/20
Context and Objectives

Bits Formatting

Conclusion

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

b0

+

+

z

+

+

h(z) =

1

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:
n

y (k) =
i=0

n

bi u(k − i) −

i=1

ai y (k − i)
4/20
Context and Objectives

Bits Formatting

Conclusion

On the other hand... A target
...
↵

±2

s

2

...

2

0

2

↵

Hardware target (FPGA, ASIC) or software target (DSP,µC)
Due to resources constraints (cost, size, power consumption,
...) we have no FPU, so we can only use fixed-point arithmetic

5/20
Context and Objectives

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Fixed-Point number
Fixed-point numbers are integers used to approximate real
numbers.
−2m 2m−1
Xm

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, ).

6/20
Context and Objectives

Bits Formatting

Conclusion

Fixed-Point Arithmetic

Fixed-Point number
Fixed-point numbers are integers used to approximate real
numbers.
−2m 2m−1
Xm

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, ).
Computation in finite precision and choice of formats imply errors.
Numerical degradations
quantization of the coefficients
round-off errors in computations
6/20
Context and Objectives

Bits Formatting

Conclusion

Filter

IIR Filter
Let H be the transfer function of a n − th order IIR filter :
H(z) =

b0 + b1 z −1 + · · · + bn z −n
,
1 + a1 z −1 + · · · + an z −n

∀z ∈ C.

(1)

7/20
Context and Objectives

Bits Formatting

Conclusion

Filter

IIR Filter
Let H be the transfer function of a n − th order IIR filter :
H(z) =

b0 + b1 z −1 + · · · + bn z −n
,
1 + a1 z −1 + · · · + an z −n

∀z ∈ C.

(1)

This filter is usually realized with the following algorithm
n

y (k) =
i=0

n

bi u(k − i) −

i=1

ai y (k − i)

(2)

where u(k) is the input at step k and y (k) the output at step k.

7/20
Context and Objectives

Bits Formatting

Conclusion

Filter

IIR Filter
Let H be the transfer function of a n − th order IIR filter :
H(z) =

b0 + b1 z −1 + · · · + bn z −n
,
1 + a1 z −1 + · · · + an z −n

∀z ∈ C.

(1)

This filter is usually realized with the following algorithm
n

y (k) =
i=0

n

bi u(k − i) −

i=1

ai y (k − i)

(2)

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

y † (k) =
i=0

n

bi u(k − i) −

i=1

ai y † (k − i) + e(k).

(3)
7/20
Context and Objectives

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
,
1 + a1 z −1 + · · · + an z −n

∀z ∈ C.

8/20
Context and Objectives

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
,
1 + a1 z −1 + · · · + an z −n

∀z ∈ C.

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

=

∆y

=

e +e
e −e
|He |DC −
He
2
2
e +e
e −e
|He |DC +
He
2
2

∞

∞

8/20
Context and Objectives

Bits Formatting

Conclusion

Objective

Fixed-Point implementation and especially the choice of formats,
imply errors.
In the context of digital signal processing, we are able to control
these errors.

9/20
Context and Objectives

Bits Formatting

Conclusion

Objective

Fixed-Point implementation and especially the choice of formats,
imply errors.
In the context of digital signal processing, we are able to control
these errors.
Objective:
Given an algorithm and a bound on the final error, find an
implementation which reduces the number of bits of the
computation while controlling the error on the output result.

9/20
Context and Objectives

Bits Formatting

Conclusion

Outline

1

Context and Objectives

2

Bits Formatting

3

Conclusion

10/20
Context and Objectives

Bits Formatting

Conclusion

Sum-of-Products
The only operations needed in filter algorithm computation are
sum-of-products:
n

s=
i=1

n

ci · xi =

pi
i=1

where ci are known constants and xi variables (inputs, state or
intermediate variables).
In the context of filter design, we know the fixed-point format
of the final result.

11/20
Context and Objectives

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 different formats, and the known
FPF of final result (sf ), less than total wordlength (s).

12/20
Context and Objectives

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 different formats, and the known
FPF of final result (sf ), less than total wordlength (s).
Questions:
Can we remove bits that don’t impact the final result ? If we want
a faithful round-off of the final result, can we remove some bits ?
12/20
Context and Objectives

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

12/20
Context and Objectives

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.

13/20
Context and Objectives

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 :

13/20
Context and Objectives

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 !

13/20
Context and Objectives

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.

13/20
Context and Objectives

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:


mf +1

s=

1≤i≤n

mf



j=L

2j pi,j 

s
s
s
s
s
s
s
M

s
mf

L

s
sf
14/20
Context and Objectives

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:


mf +1

s=

1≤i≤n

mf



j=L

2j pi,j 

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

L

s
sf
14/20
Context and Objectives

Bits Formatting

Conclusion

LSB formatting

LSB Formatting main idea
s
s
s
s
s
s
s
s

s
sf

15/20
Context and Objectives

Bits Formatting

Conclusion

LSB formatting

LSB Formatting main idea
s
s
s
s
s
s
s
s

s
sf

If we remove some bits, we will not compute sf anymore but a
faithful round-off of sf can be acceptable.

15/20
Context and Objectives

Bits Formatting

Conclusion

LSB formatting

LSB Formatting main idea
s
s
s
s
s
s
sδ

s
δ
s

sf

Can we determine a minimal δ such that sf is always a faithful
round-off of sf ?

15/20
Context and Objectives

Bits Formatting

Conclusion

LSB formatting

LSB Formatting main idea
s
s
s
s
s
s
sδ

s
δ
s

sf

δ evaluation
For both rounding mode (round-to-nearest or truncation), the
smallest integer δ that provides sf = lf (sf ) is given by:
δ = log2 (n)
15/20
Context and Objectives

Bits Formatting

Conclusion

Formatting

Formatting method
s
s
s
s
s
s
s
s

1

s
sf

we compute δ

16/20
Context and Objectives

Bits Formatting

Conclusion

Formatting

Formatting method
s
s
s
s
s
s
sδ

s
δ
s

1
2

sf

we compute δ
we format all pi s into FPF (mf , lf − δ)

16/20
Context and Objectives

Bits Formatting

Conclusion

Formatting

Formatting method

s
s
s
s
sδ

s
δ
s

1
2
3

sf

we compute δ
we format all pi s into FPF (mf , lf − δ)
we compute sδ
16/20
Context and Objectives

Bits Formatting

Conclusion

Formatting

Formatting method

s
s
s
s
sδ

s
δ
s

1
2
3
4

we
we
we
we

sf

compute δ
format all pi s into FPF (mf , lf − δ)
compute sδ
obtain sf from sδ
16/20
Context and Objectives

Bits Formatting

Conclusion

Formatting

Example
The following algorithm is the fixed-point algorithm of a 4th −order
butterworth filter:
y (k) = 0.0013279914856 u(k) + 0.00531196594238 u(k − 1)

+0.00796794891357 u(k − 2) + 0.00531196594238 u(k − 3)

+0.0013279914856 u(k − 4) + 2.87109375 y (k − 1)

−3.20825195312 y (k − 2) + 1.63458251953 y (k − 3)

−0.318710327148 y (k − 4)

Inputs datas :
wordlength of constants, u(k) and y (k) : 16 bits
u(k) ∈ [−13, 13]

17/20
Context and Objectives

Bits Formatting

Conclusion

Formatting

Example
The following algorithm is the fixed-point algorithm of a 4th −order
butterworth filter:
y (k) = 0.0013279914856 u(k) + 0.00531196594238 u(k − 1)

+0.00796794891357 u(k − 2) + 0.00531196594238 u(k − 3)

+0.0013279914856 u(k − 4) + 2.87109375 y (k − 1)

−3.20825195312 y (k − 2) + 1.63458251953 y (k − 3)

−0.318710327148 y (k − 4)

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

17/20
Context and Objectives

Bits Formatting

Conclusion

Formatting

Example
s
s
s
s
s
s
s
s
s
s
s

18/20
Context and Objectives

Bits Formatting

Conclusion

Formatting

Example
s
s
s
s
s
s
s
s
s
s
s
δ = log2 (n)

18/20
Context and Objectives

Bits Formatting

Conclusion

Conclusion
We try to answer the following question :
For a given sum-of-products, how to reduce the number of bits of
the operands while controlling the error ?
For this, some works have been realized:
FiPoGen : a tool generating fixed-point code for a given
sum-of-products
Bits formatting : a first step towards word-length optimization

19/20
Context and Objectives

Bits Formatting

Conclusion

THANK YOU
Any questions?

20/20

More Related Content

What's hot

Network Security CS3-4
Network Security CS3-4 Network Security CS3-4
Network Security CS3-4
Infinity Tech Solutions
 
Captitude 2doc-100627004318-phpapp01
Captitude 2doc-100627004318-phpapp01Captitude 2doc-100627004318-phpapp01
Captitude 2doc-100627004318-phpapp01
ManjeeraBhargavi Varanasi
 
C aptitude.2doc
C aptitude.2docC aptitude.2doc
C aptitude.2doc
Srikanth
 
Qno 1 (f)
Qno 1 (f)Qno 1 (f)
Control flow Graph
Control flow GraphControl flow Graph
Control flow Graph
Md Arif Hasan
 
Gate-Cs 1999
Gate-Cs 1999Gate-Cs 1999
Gate-Cs 1999
Ravi Rajput
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTION
Anil Pokhrel
 
Basic Block
Basic BlockBasic Block
Basic Block
Shiv1234567
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
Dr.DHANALAKSHMI SENTHILKUMAR
 
Introduction to code optimization by dipankar
Introduction to code optimization by dipankarIntroduction to code optimization by dipankar
Introduction to code optimization by dipankar
Dipankar Nalui
 
Gate Previous Years Papers It2005
Gate Previous Years Papers It2005Gate Previous Years Papers It2005
Gate Previous Years Papers It2005
Rahul Jain
 
Interm codegen
Interm codegenInterm codegen
Interm codegen
Anshul Sharma
 
Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)
bolovv
 
Code optimisation presnted
Code optimisation presntedCode optimisation presnted
Code optimisation presnted
bhavanatmithun
 
Code generator
Code generatorCode generator
Code generator
Tech_MX
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)
Tasif Tanzim
 
Identity based encryption from the weil pairing
Identity based encryption from the weil pairingIdentity based encryption from the weil pairing
Identity based encryption from the weil pairing
National Chengchi University
 
NIPS2017 Few-shot Learning and Graph Convolution
NIPS2017 Few-shot Learning and Graph ConvolutionNIPS2017 Few-shot Learning and Graph Convolution
NIPS2017 Few-shot Learning and Graph Convolution
Kazuki Fujikawa
 
Adobe
AdobeAdobe
Lecture 12 intermediate code generation
Lecture 12 intermediate code generationLecture 12 intermediate code generation
Lecture 12 intermediate code generation
Iffat Anjum
 

What's hot (20)

Network Security CS3-4
Network Security CS3-4 Network Security CS3-4
Network Security CS3-4
 
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
 
Qno 1 (f)
Qno 1 (f)Qno 1 (f)
Qno 1 (f)
 
Control flow Graph
Control flow GraphControl flow Graph
Control flow Graph
 
Gate-Cs 1999
Gate-Cs 1999Gate-Cs 1999
Gate-Cs 1999
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTION
 
Basic Block
Basic BlockBasic Block
Basic Block
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
 
Introduction to code optimization by dipankar
Introduction to code optimization by dipankarIntroduction to code optimization by dipankar
Introduction to code optimization by dipankar
 
Gate Previous Years Papers It2005
Gate Previous Years Papers It2005Gate Previous Years Papers It2005
Gate Previous Years Papers It2005
 
Interm codegen
Interm codegenInterm codegen
Interm codegen
 
Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)
 
Code optimisation presnted
Code optimisation presntedCode optimisation presnted
Code optimisation presnted
 
Code generator
Code generatorCode generator
Code generator
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)
 
Identity based encryption from the weil pairing
Identity based encryption from the weil pairingIdentity based encryption from the weil pairing
Identity based encryption from the weil pairing
 
NIPS2017 Few-shot Learning and Graph Convolution
NIPS2017 Few-shot Learning and Graph ConvolutionNIPS2017 Few-shot Learning and Graph Convolution
NIPS2017 Few-shot Learning and Graph Convolution
 
Adobe
AdobeAdobe
Adobe
 
Lecture 12 intermediate code generation
Lecture 12 intermediate code generationLecture 12 intermediate code generation
Lecture 12 intermediate code generation
 

Similar to PECCS 2014

FPGA based BCH Decoder
FPGA based BCH DecoderFPGA based BCH Decoder
FPGA based BCH Decoder
ijsrd.com
 
ECE 2103_L6 Boolean Algebra Canonical Forms [Autosaved].pptx
ECE 2103_L6 Boolean Algebra Canonical Forms [Autosaved].pptxECE 2103_L6 Boolean Algebra Canonical Forms [Autosaved].pptx
ECE 2103_L6 Boolean Algebra Canonical Forms [Autosaved].pptx
MdJubayerFaisalEmon
 
Boolean algebra and logic gates
Boolean algebra and logic gatesBoolean algebra and logic gates
Boolean algebra and logic gates
ZareenRauf1
 
ECE 2103_L6 Boolean Algebra Canonical Forms.pptx
ECE 2103_L6 Boolean Algebra Canonical Forms.pptxECE 2103_L6 Boolean Algebra Canonical Forms.pptx
ECE 2103_L6 Boolean Algebra Canonical Forms.pptx
MdJubayerFaisalEmon
 
Digital electronics k map comparators and their function
Digital electronics k map comparators and their functionDigital electronics k map comparators and their function
Digital electronics k map comparators and their function
kumarankit06875
 
A few solvers for portfolio selection
A few solvers for portfolio selectionA few solvers for portfolio selection
A few solvers for portfolio selection
Bogusz Jelinski
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.ppt
skatiarrahaman
 
unit-i-number-systems.pdf
unit-i-number-systems.pdfunit-i-number-systems.pdf
unit-i-number-systems.pdf
RameshK531901
 
Big oh Representation Used in Time complexities
Big oh Representation Used in Time complexitiesBig oh Representation Used in Time complexities
Big oh Representation Used in Time complexities
LAKSHMITHARUN PONNAM
 
Lec20
Lec20Lec20
MIPS_Programming.pdf
MIPS_Programming.pdfMIPS_Programming.pdf
MIPS_Programming.pdf
XxUnnathxX
 
digital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptxdigital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptx
RameshK531901
 
random test
random testrandom test
random test
kapilonweb
 
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
afsheenfaiq2
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
Prabin Gautam
 
dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)
Mumtaz Ali
 
Mm chap08 -_lossy_compression_algorithms
Mm chap08 -_lossy_compression_algorithmsMm chap08 -_lossy_compression_algorithms
Mm chap08 -_lossy_compression_algorithms
Eellekwameowusu
 
Unit 4 dica
Unit 4 dicaUnit 4 dica
Unit 4 dica
Pavan Mukku
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
RajJain516913
 
sheet6.pdf
sheet6.pdfsheet6.pdf
sheet6.pdf
aminasouyah
 

Similar to PECCS 2014 (20)

FPGA based BCH Decoder
FPGA based BCH DecoderFPGA based BCH Decoder
FPGA based BCH Decoder
 
ECE 2103_L6 Boolean Algebra Canonical Forms [Autosaved].pptx
ECE 2103_L6 Boolean Algebra Canonical Forms [Autosaved].pptxECE 2103_L6 Boolean Algebra Canonical Forms [Autosaved].pptx
ECE 2103_L6 Boolean Algebra Canonical Forms [Autosaved].pptx
 
Boolean algebra and logic gates
Boolean algebra and logic gatesBoolean algebra and logic gates
Boolean algebra and logic gates
 
ECE 2103_L6 Boolean Algebra Canonical Forms.pptx
ECE 2103_L6 Boolean Algebra Canonical Forms.pptxECE 2103_L6 Boolean Algebra Canonical Forms.pptx
ECE 2103_L6 Boolean Algebra Canonical Forms.pptx
 
Digital electronics k map comparators and their function
Digital electronics k map comparators and their functionDigital electronics k map comparators and their function
Digital electronics k map comparators and their function
 
A few solvers for portfolio selection
A few solvers for portfolio selectionA few solvers for portfolio selection
A few solvers for portfolio selection
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.ppt
 
unit-i-number-systems.pdf
unit-i-number-systems.pdfunit-i-number-systems.pdf
unit-i-number-systems.pdf
 
Big oh Representation Used in Time complexities
Big oh Representation Used in Time complexitiesBig oh Representation Used in Time complexities
Big oh Representation Used in Time complexities
 
Lec20
Lec20Lec20
Lec20
 
MIPS_Programming.pdf
MIPS_Programming.pdfMIPS_Programming.pdf
MIPS_Programming.pdf
 
digital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptxdigital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptx
 
random test
random testrandom test
random test
 
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
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)
 
Mm chap08 -_lossy_compression_algorithms
Mm chap08 -_lossy_compression_algorithmsMm chap08 -_lossy_compression_algorithms
Mm chap08 -_lossy_compression_algorithms
 
Unit 4 dica
Unit 4 dicaUnit 4 dica
Unit 4 dica
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
 
sheet6.pdf
sheet6.pdfsheet6.pdf
sheet6.pdf
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 

PECCS 2014

  • 1. Context and Objectives Bits Formatting Conclusion Formatting bits to better implement signal processing algorithms e Benoit Lopez - Thibault Hilaire - Laurent-St´phane Didier PECCS 2014 January 9th 2014 1/20
  • 2. Context and Objectives Bits Formatting Conclusion Outline 1 Context and Objectives 2 Bits Formatting 3 Conclusion 2/20
  • 3. Context and Objectives Bits Formatting Conclusion In PECCS’14 Smartphone applications, measurement applications, embedded devices, ... 3/20
  • 4. Context and Objectives Bits Formatting Conclusion In PECCS’14 Smartphone applications, measurement applications, embedded devices, ... Implementation problem We need methodology and tools for the implementation of embedded filter algorithms with only integer arithmetic. 3/20
  • 5. Context and Objectives Bits Formatting Conclusion On the first hand... A filter x[n] z b0 + + z + + h(z) = 1 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: n y (k) = i=0 n bi u(k − i) − i=1 ai y (k − i) 4/20
  • 6. Context and Objectives Bits Formatting Conclusion On the other hand... A target ... ↵ ±2 s 2 ... 2 0 2 ↵ Hardware target (FPGA, ASIC) or software target (DSP,µC) Due to resources constraints (cost, size, power consumption, ...) we have no FPU, so we can only use fixed-point arithmetic 5/20
  • 7. Context and Objectives Bits Formatting Conclusion Fixed-Point Arithmetic Fixed-Point number Fixed-point numbers are integers used to approximate real numbers. −2m 2m−1 Xm 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, ). 6/20
  • 8. Context and Objectives Bits Formatting Conclusion Fixed-Point Arithmetic Fixed-Point number Fixed-point numbers are integers used to approximate real numbers. −2m 2m−1 Xm 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, ). Computation in finite precision and choice of formats imply errors. Numerical degradations quantization of the coefficients round-off errors in computations 6/20
  • 9. Context and Objectives Bits Formatting Conclusion Filter IIR Filter Let H be the transfer function of a n − th order IIR filter : H(z) = b0 + b1 z −1 + · · · + bn z −n , 1 + a1 z −1 + · · · + an z −n ∀z ∈ C. (1) 7/20
  • 10. Context and Objectives Bits Formatting Conclusion Filter IIR Filter Let H be the transfer function of a n − th order IIR filter : H(z) = b0 + b1 z −1 + · · · + bn z −n , 1 + a1 z −1 + · · · + an z −n ∀z ∈ C. (1) This filter is usually realized with the following algorithm n y (k) = i=0 n bi u(k − i) − i=1 ai y (k − i) (2) where u(k) is the input at step k and y (k) the output at step k. 7/20
  • 11. Context and Objectives Bits Formatting Conclusion Filter IIR Filter Let H be the transfer function of a n − th order IIR filter : H(z) = b0 + b1 z −1 + · · · + bn z −n , 1 + a1 z −1 + · · · + an z −n ∀z ∈ C. (1) This filter is usually realized with the following algorithm n y (k) = i=0 n bi u(k − i) − i=1 ai y (k − i) (2) where u(k) is the input at step k and y (k) the output at step k. We can see round-off errors as the add of an error e(k) on the output and only y † (k) can be computed. n y † (k) = i=0 n bi u(k − i) − i=1 ai y † (k − i) + e(k). (3) 7/20
  • 12. Context and Objectives 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 , 1 + a1 z −1 + · · · + an z −n ∀z ∈ C. 8/20
  • 13. Context and Objectives 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 , 1 + a1 z −1 + · · · + an z −n ∀z ∈ C. If the error e(k) is in [e; e], then we are able to compute ∆y and ∆y such that ∆y (k) is in [∆y ; ∆y ] : ∆y = ∆y = e +e e −e |He |DC − He 2 2 e +e e −e |He |DC + He 2 2 ∞ ∞ 8/20
  • 14. Context and Objectives Bits Formatting Conclusion Objective Fixed-Point implementation and especially the choice of formats, imply errors. In the context of digital signal processing, we are able to control these errors. 9/20
  • 15. Context and Objectives Bits Formatting Conclusion Objective Fixed-Point implementation and especially the choice of formats, imply errors. In the context of digital signal processing, we are able to control these errors. Objective: Given an algorithm and a bound on the final error, find an implementation which reduces the number of bits of the computation while controlling the error on the output result. 9/20
  • 16. Context and Objectives Bits Formatting Conclusion Outline 1 Context and Objectives 2 Bits Formatting 3 Conclusion 10/20
  • 17. Context and Objectives Bits Formatting Conclusion Sum-of-Products The only operations needed in filter algorithm computation are sum-of-products: n s= i=1 n ci · xi = pi i=1 where ci are known constants and xi variables (inputs, state or intermediate variables). In the context of filter design, we know the fixed-point format of the final result. 11/20
  • 18. Context and Objectives 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 different formats, and the known FPF of final result (sf ), less than total wordlength (s). 12/20
  • 19. Context and Objectives 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 different formats, and the known FPF of final result (sf ), less than total wordlength (s). Questions: Can we remove bits that don’t impact the final result ? If we want a faithful round-off of the final result, can we remove some bits ? 12/20
  • 20. Context and Objectives 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 12/20
  • 21. Context and Objectives 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. 13/20
  • 22. Context and Objectives 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 : 13/20
  • 23. Context and Objectives 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 ! 13/20
  • 24. Context and Objectives 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. 13/20
  • 25. Context and Objectives 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:   mf +1 s= 1≤i≤n mf  j=L 2j pi,j  s s s s s s s M s mf L s sf 14/20
  • 26. Context and Objectives 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:   mf +1 s= 1≤i≤n mf  j=L 2j pi,j  s s s s s s s s s s M mf L s sf 14/20
  • 27. Context and Objectives Bits Formatting Conclusion LSB formatting LSB Formatting main idea s s s s s s s s s sf 15/20
  • 28. Context and Objectives Bits Formatting Conclusion LSB formatting LSB Formatting main idea s s s s s s s s s sf If we remove some bits, we will not compute sf anymore but a faithful round-off of sf can be acceptable. 15/20
  • 29. Context and Objectives Bits Formatting Conclusion LSB formatting LSB Formatting main idea s s s s s s sδ s δ s sf Can we determine a minimal δ such that sf is always a faithful round-off of sf ? 15/20
  • 30. Context and Objectives Bits Formatting Conclusion LSB formatting LSB Formatting main idea s s s s s s sδ s δ s sf δ evaluation For both rounding mode (round-to-nearest or truncation), the smallest integer δ that provides sf = lf (sf ) is given by: δ = log2 (n) 15/20
  • 31. Context and Objectives Bits Formatting Conclusion Formatting Formatting method s s s s s s s s 1 s sf we compute δ 16/20
  • 32. Context and Objectives Bits Formatting Conclusion Formatting Formatting method s s s s s s sδ s δ s 1 2 sf we compute δ we format all pi s into FPF (mf , lf − δ) 16/20
  • 33. Context and Objectives Bits Formatting Conclusion Formatting Formatting method s s s s sδ s δ s 1 2 3 sf we compute δ we format all pi s into FPF (mf , lf − δ) we compute sδ 16/20
  • 34. Context and Objectives Bits Formatting Conclusion Formatting Formatting method s s s s sδ s δ s 1 2 3 4 we we we we sf compute δ format all pi s into FPF (mf , lf − δ) compute sδ obtain sf from sδ 16/20
  • 35. Context and Objectives Bits Formatting Conclusion Formatting Example The following algorithm is the fixed-point algorithm of a 4th −order butterworth filter: y (k) = 0.0013279914856 u(k) + 0.00531196594238 u(k − 1) +0.00796794891357 u(k − 2) + 0.00531196594238 u(k − 3) +0.0013279914856 u(k − 4) + 2.87109375 y (k − 1) −3.20825195312 y (k − 2) + 1.63458251953 y (k − 3) −0.318710327148 y (k − 4) Inputs datas : wordlength of constants, u(k) and y (k) : 16 bits u(k) ∈ [−13, 13] 17/20
  • 36. Context and Objectives Bits Formatting Conclusion Formatting Example The following algorithm is the fixed-point algorithm of a 4th −order butterworth filter: y (k) = 0.0013279914856 u(k) + 0.00531196594238 u(k − 1) +0.00796794891357 u(k − 2) + 0.00531196594238 u(k − 3) +0.0013279914856 u(k − 4) + 2.87109375 y (k − 1) −3.20825195312 y (k − 2) + 1.63458251953 y (k − 3) −0.318710327148 y (k − 4) Inputs datas : wordlength of constants, u(k) and y (k) : 16 bits u(k) ∈ [−13, 13] and y (k) ∈ [−17.123541; 17.123541] 17/20
  • 37. Context and Objectives Bits Formatting Conclusion Formatting Example s s s s s s s s s s s 18/20
  • 38. Context and Objectives Bits Formatting Conclusion Formatting Example s s s s s s s s s s s δ = log2 (n) 18/20
  • 39. Context and Objectives Bits Formatting Conclusion Conclusion We try to answer the following question : For a given sum-of-products, how to reduce the number of bits of the operands while controlling the error ? For this, some works have been realized: FiPoGen : a tool generating fixed-point code for a given sum-of-products Bits formatting : a first step towards word-length optimization 19/20
  • 40. Context and Objectives Bits Formatting Conclusion THANK YOU Any questions? 20/20