From controller to code
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

From controller to code

on

  • 174 views

A brief description of my research work.

A brief description of my research work.

Statistics

Views

Total Views
174
Views on SlideShare
174
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

From controller to code Presentation Transcript

  • 1. From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 1/72
  • 2. Context Linear filters and equivalent realizations 1 Context and problematicsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 2/72
  • 3. Context Linear filters and equivalent realizationsOutline 1 Context 2 Linear filters and equivalent realizationsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 3/72
  • 4. Context Linear filters and equivalent realizationsContext 0 01 01 11 11 0 10 0 00 01 1 01 10 11 10 11 110 010 10 00 00 10 1 01 10 10 01 0 01 01 implantation Implementation implantation Filters/Controllers algorithmes TS Cibles Targets Algorithms algorithmes TS CiblesFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 4/72
  • 5. Context Linear filters and equivalent realizationsContext 0 01 01 11 11 0 10 0 00 01 1 01 10 11 10 11 110 010 10 00 00 10 1 01 10 10 01 0 01 01 implantation Implementation implantation Filters/Controllers algorithmes TS Cibles Targets Algorithms algorithmes TS CiblesFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 4/72
  • 6. Context Linear filters and equivalent realizationsContext 0 01 01 11 11 0 10 0 00 01 1 01 10 11 10 11 110 010 10 00 00 10 1 01 10 10 01 0 01 01 implantation Implementation implantation Filters/Controllers algorithmes TS Cibles Targets Algorithms algorithmes TS CiblesFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 4/72
  • 7. Context Linear filters and equivalent realizationsContext 0 01 01 11 11 0 10 0 00 01 1 01 10 11 10 11 110 010 10 00 00 10 1 01 10 10 01 0 01 01 implantation Implementation implantation Filters/Controllers algorithmes TS Cibles Targets Algorithms algorithmes TS Cibles • Finite precision implementation (fixed-point arithmetic) • LTI systems • hardware (FPGA, ASIC) or software (DSP, µC)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 4/72
  • 8. Context Linear filters and equivalent realizationsContext 0 01 01 11 11 0 10 0 00 01 1 01 10 11 10 11 110 010 10 00 00 10 1 01 10 10 01 0 01 01 implantation Implementation implantation Filters/Controllers algorithmes TS Cibles Targets Algorithms algorithmes TS Cibles • Finite precision implementation (fixed-point arithmetic) • LTI systems • hardware (FPGA, ASIC) or software (DSP, µC) Methodology for the implementation of embedded algorithms (controllers/filters)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 4/72
  • 9. Context Linear filters and equivalent realizationsImplementation under constraints Embedded systems suffer from various constraints: • Cost (short Time to Market, rapid renewal, etc...) • Power consumption (energy-autonomous systems) • Resources (Limited computing resources (no FPU))From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 5/72
  • 10. Context Linear filters and equivalent realizationsImplementation under constraints Embedded systems suffer from various constraints: • Cost (short Time to Market, rapid renewal, etc...) • Power consumption (energy-autonomous systems) • Resources (Limited computing resources (no FPU)) The implementation of a given algorithm is difficult: • Deal with precision problems • Implementation ⇒ accuracy problems • Fixed-point arithmetic • Area/power consumption constraints • multiple wordlength paradigm (ASIC and FPGA) • Time-consuming workFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 5/72
  • 11. Context Linear filters and equivalent realizationsImplementation under constraints Embedded systems suffer from various constraints: • Cost (short Time to Market, rapid renewal, etc...) • Power consumption (energy-autonomous systems) • Resources (Limited computing resources (no FPU)) The implementation of a given algorithm is difficult: • Deal with precision problems • Implementation ⇒ accuracy problems • Fixed-point arithmetic • Area/power consumption constraints • multiple wordlength paradigm (ASIC and FPGA) • Time-consuming work We need tools to transform controller into code that deal with precision/performance/computational cost tradeoffFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 5/72
  • 12. Context Linear filters and equivalent realizationsObjectives The objectives of the presentation is to give an overview of: • the interest and the difficulties of this problem • the parts already (almost) done • the various parts in-progress • some analogies with the optimal polynomial implementation problemFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 6/72
  • 13. Context Linear filters and equivalent realizationsFinite precision degradations The implementation ⇒ degradations (performances, characteristics, etc.)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 7/72
  • 14. Context Linear filters and equivalent realizationsFinite precision degradations The implementation ⇒ degradations (performances, characteristics, etc.) Origins of the degradations Two sources of deteriorations are considered: • Roundoff errors into the computations → roundoff noiseFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 7/72
  • 15. Context Linear filters and equivalent realizationsFinite precision degradations The implementation ⇒ degradations (performances, characteristics, etc.) Origins of the degradations Two sources of deteriorations are considered: • Roundoff errors into the computations → roundoff noise • Quantization of the coefficients → parametric errorsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 7/72
  • 16. Context Linear filters and equivalent realizationsFinite precision degradations The implementation ⇒ degradations (performances, characteristics, etc.) Origins of the degradations Two sources of deteriorations are considered: • Roundoff errors into the computations → roundoff noise • Quantization of the coefficients → parametric errors The degradations depends on • the algorithmic relationship used to compute output(s) from input(s) • the computations themselves (wordlengths, roundoff mode, binary point position, additions order, etc.)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 7/72
  • 17. Context Linear filters and equivalent realizationsLinear filters LTI: Linear system with known and constant coefficients • FIR (Finite Impulse Response) : n n −i H(z) = bi z , ⇒ y (k) = bi u(k − i) i=0 i=0 • IIR (Infinite Impulse Response) : n −i n n i=0 bi z H(z) = n −i , ⇒ y (k) = bi u(k−i)− ai y (k−i) 1+ i=1 ai z i=0 i=1 Filters and signal processingFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 8/72
  • 18. Context Linear filters and equivalent realizationsEquivalent realizations For a given LTI controller, it exist various equivalent realizations • Direct Form I (2n + 1 coefs) u(k) u(k − 1) u(k − n) q −1 q −1 q −1 q −1 b0 b1 b2 bi bn n −i i=0 bi z H(z) = n −i 1+ i=1 ai z + y(k) n n y (k) = bi u(k−i)− ai y (k−i) −an −ai −a2 −a1 i =0 i =1 q −1 q −1 q −1 q −1 y(k − n) y(k − 1)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 9/72
  • 19. Context Linear filters and equivalent realizationsEquivalent realizations For a given LTI controller, it exist various equivalent realizations • Direct Form I (2n + 1 coefs) • Direct Form II (transposed or not) (2n + 1 coefs) u(k) e(k) y(k) + b0 + q −1 e(k − 1) + −a1 b1 + q −1 + −a2 b2 + q −1 + −ai bi + q −1 −an bn e(k − n)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 9/72
  • 20. Context Linear filters and equivalent realizationsEquivalent realizations For a given LTI controller, it exist various equivalent realizations • Direct Form I (2n + 1 coefs) • Direct Form II (transposed or not) (2n + 1 coefs) • State-space (depend on the basis) ((n + 1)2 coefs) X (k + 1) = AX (k) + Bu(k) y (k) = CX (k) + Du(k) A X (k) → T .X (k) U (k) Y (k) B + q −1 C + X(k + 1) X(k) DFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 9/72
  • 21. Context Linear filters and equivalent realizationsEquivalent realizations For a given LTI controller, it exist various equivalent realizations • Direct Form I (2n + 1 coefs) • Direct Form II (transposed or not) (2n + 1 coefs) • State-space (depend on the basis) ((n + 1)2 coefs) • δ-operator δ q−1 ∆ Aδ U (k) Y (k) ∆ + q −1 Bδ + δ −1 Cδ + X(k + 1) X(k) δ −1 Dδ δ[X (k)] = Aδ X (k) + Bδ u(k) y (k) = Cδ X (k) + Dδ u(k)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 9/72
  • 22. Context Linear filters and equivalent realizationsEquivalent realizations For a given LTI controller, it exist various equivalent realizations • Direct Form I (2n + 1 coefs) • Direct Form II (transposed or not) (2n + 1 coefs) • State-space (depend on the basis) ((n + 1)2 coefs) • δ-operator δ q−1 ∆ • Cascad and/or parallel decompositions H1 H2 + H1 H2 Hi Hm Hi H Hm HFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 9/72
  • 23. Context Linear filters and equivalent realizationsEquivalent realizations For a given LTI controller, it exist various equivalent realizations • Direct Form I (2n + 1 coefs) • Direct Form II (transposed or not) (2n + 1 coefs) • State-space (depend on the basis) ((n + 1)2 coefs) • δ-operator δ q−1 ∆ • Cascad and/or parallel decompositions • ρDirect Form II transposed (5n + 1 ou 4n + 1 coefs) ρDFIIt u(k) βn βn−1 βi β1 β0 + z −1 ∆i ρ−1 ρ−1 ρ−1 ρ−1 + + + + + n i+1 i 1 γi −1 ρi αn αn−1 αi α1 y(k)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 9/72
  • 24. Context Linear filters and equivalent realizationsEquivalent realizations For a given LTI controller, it exist various equivalent realizations • Direct Form I (2n + 1 coefs) • Direct Form II (transposed or not) (2n + 1 coefs) • State-space (depend on the basis) ((n + 1)2 coefs) • δ-operator δ q−1 ∆ • Cascad and/or parallel decompositions • ρDirect Form II transposed (5n + 1 ou 4n + 1 coefs) ρDFIIt • lattice, ρ-modale, LGC et LCW-structures, sparse state-space, etc. Each of these realizations uses different coefficients. They are equivalent in infinite precision, but no more in finite precision. The finite precision degradation (parametric errors and roundoff noises) depends on the realization.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 9/72
  • 25. Context Linear filters and equivalent realizationsComparison with polynomials – 1 It is very interesting to compare filter realizations and polynomial evaluation: z −1 • The shift operator • The multiplication by xFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 10/72
  • 26. Context Linear filters and equivalent realizationsComparison with polynomials – 1 It is very interesting to compare filter realizations and polynomial evaluation: z −1 • The shift operator • The multiplication by x • Direct forms • Horner’s methodFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 10/72
  • 27. Context Linear filters and equivalent realizationsComparison with polynomials – 1 It is very interesting to compare filter realizations and polynomial evaluation: z −1 • The shift operator • The multiplication by x • Direct forms • Horner’s method • ρ-operator • Newton’s basis n z − γj Pi = Πik=1 (X − xk ) i (z) = ∆j j=i+1From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 10/72
  • 28. Context Linear filters and equivalent realizationsComparison with polynomials – 1 It is very interesting to compare filter realizations and polynomial evaluation: z −1 • The shift operator • The multiplication by x • Direct forms • Horner’s method • ρ-operator • Newton’s basis n z − γj Pi = Πik=1 (X − xk ) i (z) = ∆j j=i+1 • ρDFIIt • Horner’s method with Newton’s basisFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 10/72
  • 29. Context Linear filters and equivalent realizationsComparison with polynomials – 2 X (k + 1) = AX (k) + Bu(k) • State-space y (k) = C X (k) + Du(k)   X0 = 1 0 ... 0 x        1 0  • Xi +1 =   .. ..  Xi     . .      1 0 P = an an−1 . . . a0 XnFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 11/72
  • 30. Context Linear filters and equivalent realizationsComparison with polynomials – 2 X (k + 1) = T −1 AT X (k) + T −1 Bu(k) • State-space y (k) = C T X (k) + Du(k)   X0 = 1 0 ... 0 x        1 0  • Xi +1 = T −1   .. ..  T Xi     . .      1 0 P = an an−1 . . . a0 T Xn • Basis change with any T invertibleFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 11/72
  • 31. Context Linear filters and equivalent realizationsComparison with polynomials – 2 X (k + 1) = T −1 AT X (k) + T −1 Bu(k) • State-space y (k) = C T X (k) + Du(k)   X0 = 1 0 ... 0 x        1 0  • Xi +1 = T −1   .. ..  T Xi     . .      1 0 P = an an−1 . . . a0 T Xn • Basis change with any T invertible Could it be interesting to consider other polynomial evaluation schemes (Estrin, Knuth&Eve, etc.) ?From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 11/72
  • 32. Context Linear filters and equivalent realizationsHW or SW implementation In addition to the choice of the realization, a lot of other options: • Fixed-point evaluation schemes • order of the operations • fixed-point alignments • quantization modes, etc.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 12/72
  • 33. Context Linear filters and equivalent realizationsHW or SW implementation In addition to the choice of the realization, a lot of other options: • Fixed-point evaluation schemes • order of the operations • fixed-point alignments • quantization modes, etc. • Software implementation (µC, DSP, etc.): • Parallelization • Ressource allocationsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 12/72
  • 34. Context Linear filters and equivalent realizationsHW or SW implementation In addition to the choice of the realization, a lot of other options: • Fixed-point evaluation schemes • order of the operations • fixed-point alignments • quantization modes, etc. • Software implementation (µC, DSP, etc.): • Parallelization • Ressource allocations • Hardware implementation (FPGA, ASIC) • Multiple word-length paradigm • Operators optimizations (multiplications by constant, etc.) • Hardware-oriented arithmetic • Operators regroupmentFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 12/72
  • 35. Context Linear filters and equivalent realizationsHW or SW implementation In addition to the choice of the realization, a lot of other options: • Fixed-point evaluation schemes • order of the operations • fixed-point alignments • quantization modes, etc. • Software implementation (µC, DSP, etc.): • Parallelization • Ressource allocations • Hardware implementation (FPGA, ASIC) • Multiple word-length paradigm • Operators optimizations (multiplications by constant, etc.) • Hardware-oriented arithmetic • Operators regroupment Different levels of optimizations !From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 12/72
  • 36. Objectives SIF Criteria Evaluation scheme Methodology 2 Our approachFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 13/72
  • 37. Objectives SIF Criteria Evaluation scheme MethodologyOutline 3 Objectives 4 SIF 5 Criteria 6 Evaluation scheme 7 MethodologyFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 14/72
  • 38. Objectives SIF Criteria Evaluation scheme MethodologyObjectives Given a controller and a target, find the optimal implementation. • Model all the equivalent realizations • SIF (Specialized Implicit Form) • Model the fixed-point algorithms • depends on evaluation schemes for sum-of-products • Model the hardware resources • computational units, etc. • Evaluate the degradation • Find one/some optimal realizations Tradeoff between: • Performance / Accuracy (multi-criteria) • Computational cost • Area, power consumption • Computation time, reusability, off-line efforts, etc.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 15/72
  • 39. Objectives SIF Criteria Evaluation scheme MethodologyFrom controller to code transfer function, state-space, etc. structure SIF set of equivalent realizations T , ∆, γ, ... realization choice Z abstract syntax tree roundoff modes word-length implementation ... arithmetic operators fixed-point algorithm (Z*, ...) code langage generation codeFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 16/72
  • 40. Objectives SIF Criteria Evaluation scheme MethodologyA Unifying Framework Realizations We have shown that it was possible to describe all these realizations in a descriptor framework called Specialized Implicit Form (SIF). • Macroscopic description of the computations • More general than state-space • Explicit all the operations and their linking       J 0 0 T (k + 1) 0 M N T (k) −K I 0 X (k + 1) = 0 P Q  X (k) −L 0 I Y (k) 0 R S U(k)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 17/72
  • 41. Objectives SIF Criteria Evaluation scheme MethodologyA Unifying Framework Realizations We have shown that it was possible to describe all these realizations in a descriptor framework called Specialized Implicit Form (SIF). • Macroscopic description of the computations • More general than state-space • Explicit all the operations and their linking       J 0 0 T (k + 1) 0 M N T (k) −K I 0 X (k + 1) = 0 P Q  X (k) −L 0 I Y (k) 0 R S U(k) → it is able to represent all the graph flows with delay, additions and constant multiplications SIFFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 17/72
  • 42. Objectives SIF Criteria Evaluation scheme MethodologyA Unifying Framework Realizations We have shown that it was possible to describe all these realizations in a descriptor framework called Specialized Implicit Form (SIF). • Macroscopic description of the computations • More general than state-space • Explicit all the operations and their linking       J 0 0 T (k + 1) 0 M N T (k) −K I 0 X (k + 1) = 0 P Q  X (k) −L 0 I Y (k) 0 R S U(k) We denote Z the matrix containing all the   −J M N coefficients (and the structure of the  K P Q Z realization) L R S SIFFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 17/72
  • 43. Objectives SIF Criteria Evaluation scheme MethodologyDifferent criteria We have three kinds of criteria to evaluate the finite-precision degradation: • Performance: • transfer function error H − H † • poles or zeros errors |λ| − |λ† | • weighted errorsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 18/72
  • 44. Objectives SIF Criteria Evaluation scheme MethodologyDifferent criteria We have three kinds of criteria to evaluate the finite-precision degradation: • Performance: • transfer function error H − H † • poles or zeros errors |λ| − |λ† | • weighted errors • Accuracy: • Signal to Quantization Noise RatioFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 18/72
  • 45. Objectives SIF Criteria Evaluation scheme MethodologyDifferent criteria We have three kinds of criteria to evaluate the finite-precision degradation: • Performance: • transfer function error H − H † • poles or zeros errors |λ| − |λ† | • weighted errors • Accuracy: • Signal to Quantization Noise Ratio • Computational cost: • number of coefficients, number of operations • area, power consumption (FPGA, ASIC) • WCET • complexity, etc.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 18/72
  • 46. Objectives SIF Criteria Evaluation scheme MethodologyDifferent criteria We have three kinds of criteria to evaluate the finite-precision degradation: • Performance: • transfer function error H − H † • poles or zeros errors |λ| − |λ† | • weighted errors • Accuracy: • Signal to Quantization Noise Ratio • Computational cost: • number of coefficients, number of operations • area, power consumption (FPGA, ASIC) • WCET • complexity, etc. → These criteria require to know the exact implementation.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 18/72
  • 47. Objectives SIF Criteria Evaluation scheme MethodologyDifferent criteria We have three kinds of criteria to evaluate the finite-precision degradation: • Performance: • transfer function error H − H † • poles or zeros errors |λ| − |λ† | • weighted errors • Accuracy: • Signal to Quantization Noise Ratio • Computational cost: • number of coefficients, number of operations • area, power consumption (FPGA, ASIC) • WCET • complexity, etc. → These criteria require to know the exact implementation. So we extend them in a priori criteria (that do not depend on implementation) and a posteriori criteria.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 18/72
  • 48. Objectives SIF Criteria Evaluation scheme Methodologya priori criteria – 1 a priori measures These criteria come from control: a priori measures • sensitivity with respect to the coefficients Z • transfer function sensitivity : ∂H ∂ZFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 19/72
  • 49. Objectives SIF Criteria Evaluation scheme Methodologya priori criteria – 1 a priori measures These criteria come from control: a priori measures • sensitivity with respect to the coefficients Z • transfer function sensitivity : ∂H ∂Z • poles or zeros sensitivity : ∂|λk | ∂ZFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 19/72
  • 50. Objectives SIF Criteria Evaluation scheme Methodologya priori criteria – 1 a priori measures These criteria come from control: a priori measures • sensitivity with respect to the coefficients Z • transfer function sensitivity : ∂H ∂Z • poles or zeros sensitivity : ∂|λk | ∂Z • Roundoff Noise Gain we suppose here that each quantization error leads to the addition of a white independent uniform noise → Gain from these noises to the outputFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 19/72
  • 51. Objectives SIF Criteria Evaluation scheme Methodologya priori criteria – 2 a priori measures The idea is to approximate how much the transfer function is modified by the coefficients’ quantization. Denote 0 if Zi,j could be exactly implemented ∈ {2p |p ∈ Z} (δZ )i,j = 1 else Then, the transfer function error is approached by the L2 -sensitivity measure L2 -sensitivity measure 2 ∂H ML2 = × δZ ∂Z 2From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 20/72
  • 52. Objectives SIF Criteria Evaluation scheme Methodologya priori criteria – 3 a priori measures In a same way, the pole error is approached by a pole-sensitivity measured. pole-sensitivity n 2 ∂ |λk | Ψ ωk × δZ ∂Z F k=1 where λk are the poles, and ωk some wieghting parameters (usually 1 ωk = 1−|λ | ) kFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 21/72
  • 53. Objectives SIF Criteria Evaluation scheme Methodologya priori criteria – 3 a priori measures In a same way, the pole error is approached by a pole-sensitivity measured. pole-sensitivity n 2 ∂ |λk | Ψ ωk × δZ ∂Z F k=1 where λk are the poles, and ωk some wieghting parameters (usually 1 ωk = 1−|λ | ) k →In closed-loop, Ψ is related to the distance to instability.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 21/72
  • 54. Objectives SIF Criteria Evaluation scheme Methodologya priori criteria – 3 a priori measures In a same way, the pole error is approached by a pole-sensitivity measured. pole-sensitivity n 2 ∂ |λk | Ψ ωk × δZ ∂Z F k=1 where λk are the poles, and ωk some wieghting parameters (usually 1 ωk = 1−|λ | ) k →In closed-loop, Ψ is related to the distance to instability. These measures have been developed for the SIF: • MIMO case • open and closed-loop cases • analytical expressions 2 And extended with more accurate fixed-point considerations σδHFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 21/72
  • 55. Objectives SIF Criteria Evaluation scheme Methodologya posteriori measure a posteriori measures The main measure based on exact implementation is the Signal to Quantization Noise Ratio SQNR : a posteriori measure It measures the noise on the output produced by the implementation • bit-accurate measure • depends on HW/SW • wordlength • evaluation scheme (order, roundoff mode, etc.) • an optimization on the word-length can be done → For that purpose, we need to generate bit-accurate fixed-point algorithmsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 22/72
  • 56. Objectives SIF Criteria Evaluation scheme MethodologySum-of-products evaluation scheme – 1 fixed-point evaluation schemes The only operations needed are sum-of-products: n S= ci · xi i=1 where ci are known constants and xi variables (inputs, state or intermediate variables). We have developed technics to transform real sum-of-products into fixed-point algorithms: • we consider the Πn (2i − 1) possible ordered-sum-of-products i=1 (assuming the fixed-point addition is commutative but not associative) • given the various word-lengths (operators, constants), we propagate fixed-point rules among the abstract syntax tree • we consider various scheme (RBM/RAM, no-shifts, etc.)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 23/72
  • 57. Objectives SIF Criteria Evaluation scheme MethodologySum-of-products evaluation scheme – 2 fixed-point evaluation schemes S = 1.524·X0 +4.89765·X1 −42.3246·X2 +58.35498·X3 +2.857·X4 −49.3246·X5 +24.3468·X6 • 8-bit coefficients, 16-bit additions • Q6.2 for xi and sFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 24/72
  • 58. Objectives SIF Criteria Evaluation scheme MethodologySujet de la Th`se e Travaux r´alis´s jusqu’ici e eSum-of-products evaluation scheme – 2Ordered Sum of Products fixed-point evaluation schemes S = 1.524·X0 +4.89765·Xe−42.3246·X2 +58.35498·X3 +2.857·X4 −49.3246·X5 +24.3468·X6 On fixe ici les repr´sentations virgule fixe : 1 8 bits sign´s pour les coefficients e • 8-bit coefficients, 16-bit additions Q6, 2 pour les Xi et S. • Q6.2 for xi and s S + + + >> 4 + × >> 1 + × + × 117 X3 >> 1 × 97 >> 3 × X6 -99 X5 × 91 X4 × -85 X2 98 X0 78 X1 Roundoff After Multiplication Roundoff After Multiplication →The roundoff noise is then deducedFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 24/72
  • 59. Objectives SIF Criteria Evaluation scheme Methodology Sujet de la Th`se e Travaux r´alis´s jusqu’ici e e Ordered Sum of ProductsSum-of-products evaluation scheme – 2 fixed-point evaluation schemes S On fixe 0 +4.89765·X1 −42.3246·X2 +58.35498·X3 +2.857·X4 −49.3246·X5 +24.3468·X6 = 1.524·X ici les repr´sentations virgule fixe : e 8 bits sign´s pour les coefficients e • 8-bit coefficients, 16-bit additions Q6, 2 pour les Xi et S. • Q6.2 for xi and s S + + + >> 4 + × × + >> 1 + × 117 X3 X6 × × 97 × × -99 X5 >> 1 91 X0 X4 >> 3 X1 -85 X2 98 78 Roundoff Before Multiplication Roundoff Before Multiplication →The roundoff noise is then deducedFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 24/72
  • 60. Objectives SIF Criteria Evaluation scheme MethodologyState-space example  0.58399 −0.42019 0.64635 X (k + 1) = X (k) +  0.42019 0.1638 −0.23982 Y (k) = 0.64635 0.23982 X (k) + 0.13111U(k) From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 25/72
  • 61. Objectives SIF Criteria Evaluation scheme MethodologyState-space example  0.58399 −0.42019 0.64635 X (k + 1) = X (k) +  0.42019 0.1638 −0.23982 Y (k) = 0.64635 0.23982 X (k) + 0.13111U(k)  16-bit input, output, states 16-bit coefficients 32-bit accumulators max U = 10From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 25/72
  • 62. Objectives SIF Criteria Evaluation scheme MethodologyState-space example  0.58399 −0.42019 0.64635 X (k + 1) = X (k) +  0.42019 0.1638 −0.23982 Y (k) = 0.64635 0.23982 X (k) + 0.13111U(k)  16-bit input, output, states 16-bit coefficients Roundoff After Multiplication 32-bit accumulators Intermediate variables max Acc ← (xn(1) ∗ 19136); U = 10 ⇒ γU = 11  Acc ← Acc + (xn(2) ∗ −27537) >> 1; 26 Acc ← Acc + (u ∗ 21179); xnp(1) ← Acc >> 15; γADD = 27 Acc ← (xn(1) ∗ 27537); 26 Acc ← Acc + (xn(2) ∗ 21470) >> 1;   Acc ← Acc + (u ∗ −31433) >> 1; 15 16 15 xnp(2) ← Acc >> 16; Outputs γZ = 16 17 17 Acc ← (xn(1) ∗ 21179); 15 17 17 Acc ← Acc + (xn(2) ∗ 31433) >> 2; Acc ← Acc + (u ∗ 17184) >> 2; 11 y ← Acc >> 15; γX = Permutations 11 xn ← xnp;From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 25/72
  • 63. Objectives SIF Criteria Evaluation scheme Methodology realizationOptimal realization optimization A 1st possible optimization concerns the realizationFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 26/72
  • 64. Objectives SIF Criteria Evaluation scheme Methodology realizationOptimal realization optimization A 1st possible optimization concerns the realization Let H be a given controller, we denote RH the set of equivalent realizations (with H as transfer function). 2 Let J be an a priori criterion (sensibility, RNG, σ∆H , ...). The optimal realization problem The optimal realization problem consists in finding a realization that minimizes J Ropt = arg min J (R) R∈RHFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 26/72
  • 65. Objectives SIF Criteria Evaluation scheme Methodology realizationOptimal realization optimization A 1st possible optimization concerns the realization Let H be a given controller, we denote RH the set of equivalent realizations (with H as transfer function). 2 Let J be an a priori criterion (sensibility, RNG, σ∆H , ...). The optimal realization problem The optimal realization problem consists in finding a realization that minimizes J Ropt = arg min J (R) R∈RH RH is too large, so pratically we only considered structured realizations (state-space, ρ-forms, etc.)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 26/72
  • 66. Objectives SIF Criteria Evaluation scheme MethodologyExample – 1 We consider the following transfer function: 38252z 3 − 101878z 2 + 91135z − 27230 H:z → z 4 − 2.3166z 3 + 2.1662z 2 − 0.96455z + 0.17565 ¯ • Closed-loop L2 -sensitivity ML2 ¯ • Closed-loop pole-sensitivity : Ψ ¯ • Roundoff Noise Gain (RNG) : GFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 27/72
  • 67. Objectives SIF Criteria Evaluation scheme MethodologyExample – 2 ¯W ML2 ¯ Ψ ¯ G ¯ TO Nb. op. Z1 1.9046e+7 3.3562e+7 1.186e+6 7 + 8×From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 28/72
  • 68. Objectives SIF Criteria Evaluation scheme MethodologyExample – 2 ¯W ML2 ¯ Ψ ¯ G ¯ TO Nb. op. Z1 1.9046e+7 3.3562e+7 1.186e+6 3.6764e+8 7 + 8× Z2 3.6427e+5 6.5007e+5 3.6582e+2 19 + 24× Z1 : canonical form Z2 : balanced state-spaceFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 28/72
  • 69. Objectives SIF Criteria Evaluation scheme MethodologyExample – 2 ¯W ML2 ¯ Ψ ¯ G ¯ TO Nb. op. Z1 1.9046e+7 3.3562e+7 1.186e+6 3.6764e+8 7 + 8× Z2 3.6427e+5 6.5007e+5 3.6582e+2 19 + 24× Z3 1.5267e+3 1.6689e+4 1.7455e+2 19 + 24× ¯ Z3 : ML2 -optimal state-spaceFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 28/72
  • 70. Objectives SIF Criteria Evaluation scheme MethodologyExample – 2 ¯W ML2 ¯ Ψ ¯ G ¯ TO Nb. op. Z1 1.9046e+7 3.3562e+7 1.186e+6 3.6764e+8 7 + 8× Z2 3.6427e+5 6.5007e+5 3.6582e+2 19 + 24× Z3 1.5267e+3 1.6689e+4 1.7455e+2 19 + 24× Z4 1.6272e+3 2.7425e+3 1.1778e+2 19 + 24× ¯ Z4 : Ψ-optimal state-spaceFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 28/72
  • 71. Objectives SIF Criteria Evaluation scheme MethodologyExample – 2 ¯W ML2 ¯ Ψ ¯ G ¯ TO Nb. op. Z1 1.9046e+7 3.3562e+7 1.186e+6 3.6764e+8 7 + 8× Z2 3.6427e+5 6.5007e+5 3.6582e+2 19 + 24× Z3 1.5267e+3 1.6689e+4 1.7455e+2 19 + 24× Z4 1.6272e+3 2.7425e+3 1.1778e+2 19 + 24× Z5 1.9474e+13 1.2294e+13 3.2261e−3 19 + 24× ¯ Z5 : G -optimal state-spaceFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 28/72
  • 72. Objectives SIF Criteria Evaluation scheme MethodologyExample – 2 ¯W ML2 ¯ Ψ ¯ G ¯ TO Nb. op. Z1 1.9046e+7 3.3562e+7 1.186e+6 3.6764e+8 7 + 8× Z2 3.6427e+5 6.5007e+5 3.6582e+2 1.1387e+5 19 + 24× Z3 1.5267e+3 1.6689e+4 1.7455e+2 5.4111e+4 19 + 24× Z4 1.6272e+3 2.7425e+3 1.1778e+2 3.6512e+4 19 + 24× Z5 1.9474e+13 1.2294e+13 3.2261e−3 1.7239e+10 19 + 24× Z6 2.8696e+3 4.5371e+3 7.9809e−3 6.0078e+0 19 + 24× Tradeoff measure: we are looking for a good enough realization: ¯W ¯ ¯ ML2 (Z ) Ψ(Z ) G (Z ) ¯ TO(Z ) + ¯ opt + ¯ opt ¯W ML opt Ψ G 2 ¯ Z6 : TO-optimal state-spaceFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 28/72
  • 73. Objectives SIF Criteria Evaluation scheme MethodologyExample – 3 ¯W ML2 ¯ Ψ ¯ G ¯ TO Nb. op. Z7 1.5342e−2 8.1051e−2 2.8082e−8 4.5466e+0 11 + 12× Z8 1.5341e−2 8.089e−2 4.217e−8 4.8783e+0 11 + 16× Z9 1.1388e−1 2.8203e−2 3.7783e−6 9.8937e+1 11 + 16× Z10 1.5342e−2 8.0015e−2 4.1742e−8 4.8371e+0 11 + 16× Z11 1.6065e−2 3.8802e−2 4.7451e−8 3.5597e+0 11 + 16× Z7 : γ = 1111 : δ-Direct Form II ¯W Z8 : ML2 -optimal ρDFIIt ¯ Z9 : Ψ-optimal ρDFIIt ¯ Z10 : G -optimal ρDFIIt ¯ Z11 : TO-optimal ρDFIItFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 29/72
  • 74. Objectives SIF Criteria Evaluation scheme MethodologyWord-lengths optimization word-length optimization A 2nd possible optimization concerns the hardware implementation On FPGA or ASIC, one can use multiple wordlength paradigm Optimal word-length Let Z be a realization and β = (βZ , βT , βX , βY , βADD ) the word-length We consider J a computational cost (area, power consumption, WCET, etc.). The optimal wordlength problem is: β opt = arg min J (β) with SQNR SQNRmin β∈BFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 30/72
  • 75. Objectives SIF Criteria Evaluation scheme MethodologyGlobal methodology transfer function a) b) structure Structure SIF catalog set of equivalent realizations c) optimal a priori measure realization realization a) Choose a structure d) implementation scheme fixed-point (state-space, ρDFIIt, ...) implementation fixed-point realization wordlength e) optimal implementation f) code language generation codeFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 31/72
  • 76. Objectives SIF Criteria Evaluation scheme MethodologyGlobal methodology transfer function a) b) structure Structure SIF catalog set of equivalent realizations c) optimal a priori measure realization realization b) Formalization SIF and d) implementation scheme fixed-point set of equivalent implementation realizations fixed-point realization wordlength e) optimal implementation f) code language generation codeFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 31/72
  • 77. Objectives SIF Criteria Evaluation scheme MethodologyGlobal methodology transfer function a) b) structure Structure SIF catalog set of equivalent realizations c) optimal a priori measure realization realization d) c) Optimization of an a implementation fixed-point scheme implementation priori criterion fixed-point realization wordlength e) optimal implementation f) code language generation codeFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 31/72
  • 78. Objectives SIF Criteria Evaluation scheme MethodologyGlobal methodology transfer function a) b) structure Structure SIF catalog set of equivalent realizations c) optimal a priori measure realization d) Given some realization word-lengths and an implementation d) fixed-point sum-of-products evaluation scheme implementation scheme, the fixed-point fixed-point realization wordlength representation are defined e) optimal implementation f) code language generation codeFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 31/72
  • 79. Objectives SIF Criteria Evaluation scheme MethodologyGlobal methodology transfer function a) b) structure Structure SIF catalog set of equivalent realizations c) optimal a priori measure realization e) Optimization of the realization implementation: d) optimization of a implementation fixed-point scheme implementation computational cost under fixed-point realization wordlength a priori criterion constraint e) optimal implementation f) code language generation codeFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 31/72
  • 80. Objectives SIF Criteria Evaluation scheme MethodologyGlobal methodology transfer function a) b) structure Structure SIF catalog set of equivalent realizations c) optimal a priori measure realization realization d) f) Fixed-point code implementation fixed-point scheme implementation generation (C, VHDL, ...) fixed-point realization wordlength e) optimal implementation f) code language generation codeFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 31/72
  • 81. Objectives SIF Criteria Evaluation scheme MethodologyExample – 1 An other example to be implemented on 8-bit device (with 16-bit accumulator) 0.02088z 2 + 0.04176z + 0.02088 H(z) = z 2 − 1.651z + 0.7342From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 32/72
  • 82. Objectives SIF Criteria Evaluation scheme MethodologyExample – 1 An other example to be implemented on 8-bit device (with 16-bit accumulator) 0.02088z 2 + 0.04176z + 0.02088 H(z) = z 2 − 1.651z + 0.7342 Some possible realizations: R1 : Direct Form I R2 : Direct Form II R3 : Balanced state-space 2 R4 : σ∆H -optimal state-space R5 : optimal state-space with δ-optimal R6 : optimal ρ-Direct Form IIFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 32/72
  • 83. Objectives SIF Criteria Evaluation scheme MethodologyExample – 2 Roundoff Before Multiplication - 8 bits realisation 2 σ∆H H − H† 2 σξ2 Nb + × R1 114.8242 0.024423 0.0092127 4 + 5× R2 51.0143 0.02797 0.017759 4 + 6× R3 8.7612 0.012219 0.0012579 6 + 9× R4 11.3538 0.0089503 0.0012985 6 + 9× R5 4.6303 0.0040723 0.0037008 8 + 11× R6 7.3958 0.010575 0.00064769 6 + 7×From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 33/72
  • 84. Objectives SIF Criteria Evaluation scheme MethodologyAlgorithms Input: u: 8 bits integer Output: y : 8 bits integer Data: xn: array [1..5] of 8 bits integers Data: T : array [1..5] of 8 bits integers Input: u: 8 bits integer Data: Acc: 16 bits integer Output: y : 8 bits integer begin Data: xn: array [1..5] of 8 bits integers // Intermediate variables Data: T : 8 bits integer Acc ← (xn(1) ∗ −31); Data: Acc: 16 bits integer Acc ← Acc + (xn(2) ∗ 114); begin Acc ← Acc + (u ∗ −8); // Intermediate variables T1 ← Acc >> 7; Acc ← (xn(1) ∗ −47); Acc ← (xn(1) ∗ −64); Acc ← Acc + (xn(2) ∗ 106); Acc ← Acc + (xn(2) ∗ −116); Acc ← Acc + xn(3); Acc ← Acc + (u ∗ −114); Acc ← Acc + (xn(4) ∗ 3); T2 ← Acc >> 8; Acc ← Acc + u; // States T1 ← Acc >> 6; Acc ← T1 << 5; // States Acc ← Acc + xn(1) << 6; xn(1) ← xn(2); xn(1) ← Acc >> 6; xn(2) ← T1 ; Acc ← T2 << 5; xn(3) ← xn(4); Acc ← Acc + xn(2) << 6; xn(4) ← u; xn(2) ← Acc >> 6; // Outputs // Outputs y ← T1 ; Acc ← (xn(1) ∗ −92); end Acc ← Acc + (xn(2) ∗ −31); Algorithm 1: R1 : Direct Form I Acc ← Acc + (u ∗ 3); y ← Acc >> 7; end Algorithm 2: R5 - δ-state-spaceFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 34/72
  • 85. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology 3 Further workFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 35/72
  • 86. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization MethodologyOutline 8 Realizations 9 Parametrized filters 10 Hardware choices 11 Best fixed-point filter 12 Optimization 13 MethodologyFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 36/72
  • 87. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization MethodologyResearch for new structures Realizations New structures Exploit new interesting structures • lattice and lattice wave digital filters • ρ-modal state-space • LGC et LCW-structures • sparse state-spaces • combine efficiently all the realizations • ...From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 37/72
  • 88. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology parametrizedParametrized filters – 1 filters, LPV We are also considering filters/controllers where the coefficients depend on extra parameters θFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 38/72
  • 89. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology parametrizedParametrized filters – 1 filters, LPV We are also considering filters/controllers where the coefficients depend on extra parameters θ Example: 2nd order filter b0 z 2 + b1 z + b2 H(z) = a0 z 2 + a1 z + a2 with • b0 = gT 2 , b1 = 2gT 2 , b2 = gT 2 • a0 = 4ξωc T + ωc T 2 + 4, a1 = 2ωc T 2 − 8, 2 2 a2 = ωc T 2 − 4ξωc T + 4 2From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 38/72
  • 90. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology parametrizedParametrized filters – 1 filters, LPV We are also considering filters/controllers where the coefficients depend on extra parameters θ Example: 2nd order filter b0 z 2 + b1 z + b2 H(z) = a0 z 2 + a1 z + a2 with • b0 = gT 2 , b1 = 2gT 2 , b2 = gT 2 • a0 = 4ξωc T + ωc T 2 + 4, a1 = 2ωc T 2 − 8, 2 2 a2 = ωc T 2 − 4ξωc T + 4 2     g g Fe  T    θ=  ωc  or θ = Fc  , . . .   π ξ ξFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 38/72
  • 91. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology parametrizedParametrized filters – 2 filters, LPV Question: What will be the impact of the quantization of these parameters (π for example)?From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 39/72
  • 92. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology parametrizedParametrized filters – 2 filters, LPV Question: What will be the impact of the quantization of these parameters (π for example)? So, we want to consider • the quantization of parameters θ • the computation of Z (θ † ) and the associated quantizationFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 39/72
  • 93. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology parametrizedParametrized filters – 2 filters, LPV Question: What will be the impact of the quantization of these parameters (π for example)? So, we want to consider • the quantization of parameters θ • the computation of Z (θ † ) and the associated quantization What is the best realization for all θ ∈ Θ ?From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 39/72
  • 94. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology hardwareHardware choices choices A lot of possibilities for the hardware implementation • Use appropriate operators (FPGA) • use optimized tools (FloPoCo) • flat computations or dedicated operators • dedicated DSP blocks • multiple constants multiplications • etc.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 40/72
  • 95. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology hardwareHardware choices choices A lot of possibilities for the hardware implementation • Use appropriate operators (FPGA) • use optimized tools (FloPoCo) • flat computations or dedicated operators • dedicated DSP blocks • multiple constants multiplications • etc. • Residue Number Systems • Which basis {2k , 2k − 1, 2k + 1} ou {2k ± c} • Scaling could be a problemFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 40/72
  • 96. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology bestBest fixed-point filter fixed-point filter Given a real transfer function H, is it possible to find the best ( . 2 or . ∞ ) transfer function H † with fixed-point coefficients ?From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 41/72
  • 97. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology bestBest fixed-point filter fixed-point filter Given a real transfer function H, is it possible to find the best ( . 2 or . ∞ ) transfer function H † with fixed-point coefficients ? • Transpose work done on polynomials • possible for FIR • much more complicated for IIR • For a given structure, find the best fixed-point coefficients Z †From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 41/72
  • 98. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization Methodology bestBest fixed-point filter fixed-point filter Given a real transfer function H, is it possible to find the best ( . 2 or . ∞ ) transfer function H † with fixed-point coefficients ? • Transpose work done on polynomials • possible for FIR • much more complicated for IIR • For a given structure, find the best fixed-point coefficients Z † Very promising work, but need dedicated timeFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 41/72
  • 99. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization MethodologyMulti-objectives optimization As seen before, we have a multi-objective optimization problem (performance/accuracy/computational cost) • We are looking at different strategies: • GA for ρ-operators • approximate a priori criteria by LMI • We would like to show where are the realizationsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 42/72
  • 100. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization MethodologyMethodology – 1 For software implementation, the different parts are (for the moment): best adequation fixed-point algorithm filter architecture parametrized fixed-point filters, realization code Realizations evaluation LPV optimization generation schemes a priori a posteriori measures measuresFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 43/72
  • 101. Realizations Parametrized filters Hardware choices Best fixed-point filter Optimization MethodologyMethodology – 2 For hardware implementation, much more parts are required: best word-length fixed-point optimization filter parametrized fixed-point best filters, realization hardware code Realizations evaluation fixed-point LPV optimization choices generation schemes filter a priori a posteriori measures measuresFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 44/72
  • 102. 4 ConclusionsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 45/72
  • 103. OutlineFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 46/72
  • 104. Conclusions Conclusion We try to answer the following question: For a given controller, how to produce optimal implementation ? The main idea is to propose a global approach: • Model all the equivalent realizations • Propose some analytical robustness criteria • Model the fixed-point implementation (evaluation scheme) • Propose some precision/performance/cost criteriaFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 47/72
  • 105. Perspectives – 1 A lot of work still need to be done: • Look for new realizations (error-feedback, mix ρ and q Direct Form, etc.) • Multi-objectives optimization • Parametrized or LPV controllers • Study different arithmetics (RNS, etc.) • Given a real controller, find the closest controller with fixed-point coefficients • Etc.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 48/72
  • 106. Perspectives – 1 A lot of work still need to be done: • Look for new realizations (error-feedback, mix ρ and q Direct Form, etc.) • Multi-objectives optimization • Parametrized or LPV controllers • Study different arithmetics (RNS, etc.) • Given a real controller, find the closest controller with fixed-point coefficients • Etc. These future work should lead to a tool suite allowing to automatically transform a controller into fixed-point code with controlled numerical behavior → An initial matlab toolbox have been designed: the Finite Wordlength Realization Toolbox (been redesign with Python)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 48/72
  • 107. Perspectives – 2 But also all these questions remain legitimate for floating-point arithmetic: How to produce correctly rounded filters/controllers ?From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 49/72
  • 108. Any questions ?From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 50/72
  • 109. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysis 5 AppendixFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 51/72
  • 110. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisOutline 14 Fixed-point 15 Filters 16 SIF 17 Exemples 18 ρDFIIt 19 a priori Measures 20 Roundoff noise analysisFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 52/72
  • 111. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisFixed-point representation Fixed-point • A real number x is represented by N : signed integer on β bits (2’s complement) N × 2−γ γ : fixed integer (implicit) • The quantization step q = 2−γ is fixed, the dynamic is fixed (and often limited) −2β−γ−1 2β−γ−2 ... 21 20 2−1 ... 2−γ s b1 b0 b−1 b−γ β−γ γ partie entière partie fractionnaire β BackFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 53/72
  • 112. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisFixed-point representation Fixed-point • A real number x is represented by N × 2−γ N : signed integer on β bits (2’s complement) – mantissa γ : fixed integer (implicit) – exponent • The quantization step q = 2−γ is fixed, the dynamic is fixed (and often limited) Example: the 1st bits of π are 011∆ 00100100001111110110101010001000... BackFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 53/72
  • 113. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisFixed-point representation Fixed-point • A real number x is represented by N × 2−γ N : signed integer on β bits (2’s complement) – mantissa γ : fixed integer (implicit) – exponent • The quantization step q = 2−γ is fixed, the dynamic is fixed (and often limited) Example: the 1st bits of π are 011∆ 00100100001111110110101010001000... So, with β = 8, we chooseγ = 5 And then π is approximated by 101.2−5 , and coded on 8 bits by the Back integer 101From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 53/72
  • 114. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisFilters Signals • Continous-time signal: s(t), t ∈ R • Discrete-time signal: s (k), k ∈ Z s (k) s(kTe ), Te sampling periodFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 54/72
  • 115. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisFilters Signals • Continous-time signal: s(t), t ∈ R • Discrete-time signal: s (k), k ∈ Z s (k) s(kTe ), Te sampling period Filter A filter is defined by u(k) y(k) H • its impulse response • its transfer function • its frequency responseFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 54/72
  • 116. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisTransfer function Y (z) H(z) = U(z) where X (z) and Y (z) atre the Z-transform of u(k) and y (k) (H(z) is the Z-transform of the impulse response h(k))From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 55/72
  • 117. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisTransfer function Y (z) H(z) = U(z) where X (z) and Y (z) atre the Z-transform of u(k) and y (k) (H(z) is the Z-transform of the impulse response h(k)) Z-transform It is the discrete equivalent of the Laplace-transform: Dcv → C Z [x(k)] : z → X (z) with ∞ X (z) x(k)z −k k=0From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 55/72
  • 118. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisFrequency response Frequency response: H(e jω ) • for z = e jω , ω ∈ [0, 2π] f • for z = e j2π Fe with 0 f Fe /9+,-:(%&;%< !# !" $%&()*+,-.+/0 # 1 H(z) = z−0.8 " !# H(e jΩ ) !!" " arg H(e jΩ ) !5# 67%8,-.+,&0 !4" !!3# !!2" !1 !! " ! !" !" !" !" =;,>*,?@--.;%+A8,?0 BackFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 56/72
  • 119. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisIntermediate variables The intermediate variables have been introduced to • make explicit all the computations done • show the linking of the computationsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 57/72
  • 120. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisIntermediate variables The intermediate variables have been introduced to • make explicit all the computations done • show the linking of the computations Implicit Form The intermediate variables are computed by: J.T (k + 1) = M.X (k) + N.U(k) with J lower triangular with 1 on diagonal, so • no need to compute J −1 • an intermediate variable can be computed from another intermediate variable that have been previously computed (in the same step) ⇒ is able to express computations such as Y (k) = M1 . M2 ... (Mi Uk )From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 57/72
  • 121. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisOpérateur δ A realization with δ-operator is: δ[X (k)] = Aδ X (k) + Bδ U(k) q−1 δ ∆ Y (k) = Cδ X (k) + Dδ U(k)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 58/72
  • 122. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisOpérateur δ A realization with δ-operator is: δ[X (k)] = Aδ X (k) + Bδ U(k) q−1 δ ∆ Y (k) = Cδ X (k) + Dδ U(k) And it is given by (SIF):       I 0 0 T (k + 1) 0 Aδ Bδ T (k)  − ∆I I 0 X (k + 1) = 0 I 0  X (k) 0 0 I Y (k) 0 Cδ Dδ U(k)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 58/72
  • 123. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisCascad decomposition (1) (2) Xk Xk Uk Tk+1 Yk A1 B1 A2 B2 C1 D1 C2 D2   A1 0 B1  B2 C1 A2 B2 D1  D2 C1 C2 D2 D1       I 0 0 T (k + 1) 0 C1 0 D1 T (k) (1)   0   X (k + 1)  A1 0 B1   X (k)(1)   I   X (k + 1)(2)  = 0 0       − B2 0 A2 0   X (k)(2)  − D2 0 I Y (k) 0 0 C2 0 U(k) BackFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 59/72
  • 124. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisCascad decomposition (1) (2) Xk Xk Uk Tk+1 Yk A1 B1 A2 B2 C1 D1 C2 D2   A1 0 B1  B2 C1 A2 B2 D1  D2 C1 C2 D2 D1       I 0 0 T(k + 1) 0 C1 0 D1 T (k) (1)   0   X (k + 1)  A1 0 B1   X (k)(1)   I   X (k + 1)(2)  = 0 0       − B2 0 A2 0   X (k)(2)  − D2 0 I Y (k) 0 0 C2 0 U(k) BackFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 59/72
  • 125. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisCascad decomposition (1) (2) Xk Xk Uk Tk+1 Yk A1 B1 A2 B2 C1 D1 C2 D2   A1 0 B1  B2 C1 A2 B2 D1  D2 C1 C2 D2 D1       I 0 0 T (k + 1) 0 C1 0 D1 T (k) (1)   0   X (k + 1)  A1 0 B1   X (k)(1)   I   X(k + 1)(2)  = 0 0       −B2 0 A2 0   X (k)(2)  −D2 0 I Y(k) 0 0 C2 0 U(k) BackFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 59/72
  • 126. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisρ-DFIIt – 1 It is possible to re-parametrized the transfer function: b0 z n + b1 z n−1 + . . . + bn−1 z + bn H(z) = z n + a1 z n−1 + . . . + an−1 z + an by β0 0 (z) + β1 1 (z) + . . . + βn−1 n−1 (z) + βn n (z) H(z) = 1 + α1 1 (z) + . . . + αn−1 n−11 (z) + αn n (z) with n z − γi i :z → ρj (z) and ρi : z → ∆i j=i+1 and to use the ρi -operator in a direct form II transposed.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 60/72
  • 127. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisρ-DFIIt – 2 u(k) βn βn−1 βi β1 β0 wn (k) wi (k) w1 (k) ρ−1 ρ−1 ρ−1 ρ−1 + + + + + n i+1 i 1 −αn −αn−1 −αi −α1 y(k)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 61/72
  • 128. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisρ-DFIIt – 2 + z −1 ∆i γi ρ−1 i u(k) βn βn−1 βi β1 β0 wn (k) wi (k) w1 (k) ρ−1 ρ−1 ρ−1 ρ−1 + + + + + n i+1 i 1 −αn −αn−1 −αi −α1 y(k)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 61/72
  • 129. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisρ-DFIIt – 3 Example : a 6th-order Butterworth filter h−h† ∞ We looking at the transfer function relative error h ∞ , with respect to the wordlengths used for the coefficients: • Direct Form I (12 coefs) • ρ-DFIIt (18 coefs) 1 10 DFI 0 !DFIIt 10 −1 10 −2 10 ￿h − h† ￿∞ −3 10 ￿h￿∞ −4 10 −5 10 −6 10 −7 10 −8 10 0 5 10 15 20 25 number of bitsFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 62/72
  • 130. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisρ-DFIIt – 3 Example : a 6th-order Butterworth filter h−h† ∞ We looking at the transfer function relative error h ∞ , with respect to the wordlengths used for the coefficients: • Direct Form I (12 coefs) • ρ-DFIIt (18 coefs) So with equivalent precision area (slices) DFI (18 bits) 1071 ρDFIIt (5 bits) 206 Preliminar results for FPGA implementation (Xilink Virtex4) with Residue Number System B = {2k , 2k − 1, 2k + 1} BackFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 62/72
  • 131. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisρ-DFIIt – 4 It can be expressed with the SIF:   −1 ∆1 β0 ..   . ∆2 0     .. .. .     . . . .       −1 ∆n 0  Z =  −α1 1  γ1 β1   .    −α2 0 . . γ2 β2       . .. .. .   . . 1 . .   . .   −αn 0 γn βn  1 0 ... 0 0 ... ... 0 0 BackFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 63/72
  • 132. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisStatistical approach – 1 An other approach is to consider that the coefficients Z are modified in Z † = Z + ∆Z , where ∆Zij are random independent centered variables, uniformly qZ qZ distributed in − 2ij ∆Zij < 2ij , and qZij are the quantization step of Zij (depends on its fixed-point representation).From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 64/72
  • 133. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisStatistical approach – 1 An other approach is to consider that the coefficients Z are modified in Z † = Z + ∆Z , where ∆Zij are random independent centered variables, uniformly qZ qZ distributed in − 2ij ∆Zij < 2ij , and qZij are the quantization step of Zij (depends on its fixed-point representation). Their order-2 moment is 2 σ∆Zij E (∆Zij )2 2 qZij = δZij 12From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 64/72
  • 134. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisStatistical approach – 2 The idea behind this is that H is changed in H † = H + ∆H, where ∆H is a transfer function with random variables as coefficients. So we define a new measure 2π 2 1 2 σ∆H E ∆H e jω F dω 2π 0From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 65/72
  • 135. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisStatistical approach – 2 The idea behind this is that H is changed in H † = H + ∆H, where ∆H is a transfer function with random variables as coefficients. So we define a new measure 2π 2 1 2 σ∆H E ∆H e jω F dω 2π 0 2 2 ∂H → σ∆H = × ΞZ ∂Z 2 with  −β +1 Z  2 √ ij (ΞZ )ij 3 Zij 2 (δZ )ij if Zij = 0 0 if Zij = 0From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 65/72
  • 136. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisStatistical approach – 3 In a same way, the quantization of the coefficients changes λk in λ† λk + ∆λk . k 2 So we define σ∆|λ| by n 2 σ∆|λ| ωk E (∆ |λk |)2 k=1 BackFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 66/72
  • 137. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisRoundoff noise analysis – 1 e(k) x(k) x (k) x(k) x (k) Q[ ] ≡ + Quantized a signal x(k) is equivalent (under certain conditions) to add a white independent noise e(k) with known moments:From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 67/72
  • 138. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisRoundoff noise analysis – 1 e(k) x(k) x (k) x(k) x (k) Q[ ] ≡ + Quantized a signal x(k) is equivalent (under certain conditions) to add a white independent noise e(k) with known moments: Right-shift of d bits: truncation best roundoff µe E {e(k)} 2−γ−1 (1 − 2−d ) 2−γ−d−1 −2γ −2γ 2 σe E {e(k) e(k)} 2 12 (1 − 2−2d ) 2 12 (1 − 2 −2d )From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 67/72
  • 139. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisRoundoff noise analysis – 2 During the implementation, the algorithm becomes:   J.T (k + 1) ← M.X (k) + N.U(k) X (k + 1) ← K .T (k + 1) + P.X (k) + Q.U(k) Y (k) ← L.T (k + 1) + R.X (k) + S.U(k) From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 68/72
  • 140. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisRoundoff noise analysis – 2 During the implementation, the algorithm becomes:   J.T (k + 1) ← M.X (k) + N.U(k) + ξT (k) X (k + 1) ← K .T (k + 1) + P.X (k) + Q.U(k) + ξX (k) Y (k) ← L.T (k + 1) + R.X (k) + S.U(k) + ξY (k)  The roundoff leads to the add of the noise ξ(k):   ξT (k) ξ(k) ξX (k) ξY (k)From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 68/72
  • 141. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisRoundoff noise analysis – 3 The implemented system is then equivalent to u(k) y(k) H ξ(k) ξ ￿ (k) y ￿ (k) Hξ +From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 69/72
  • 142. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisRoundoff noise analysis – 3 The implemented system is then equivalent to u(k) y(k) H ξ(k) ξ ￿ (k) y ￿ (k) Hξ + The Signal to Quantization Noise ratio is then defined by: 2 σY SQNR = 2 σξFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 69/72
  • 143. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisRoundoff noise analysis – 3 The implemented system is then equivalent to u(k) y(k) H ξ(k) ξ ￿ (k) y ￿ (k) Hξ + The Signal to Quantization Noise ratio is then defined by: 2 σY SQNR = 2 σξ H1 is easily obtained, and σξ = Hξ ϕξ 2 where ϕξ is such 2 2 ψξ = ϕξ ϕξ and ψξ the covariance matrix of ξFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 69/72
  • 144. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysisRoundoff noise analysis – 3 The implemented system is then equivalent to u(k) y(k) H ξ(k) ξ ￿ (k) y ￿ (k) Hξ + The Signal to Quantization Noise ratio is then defined by: 2 σY SQNR = 2 σξ H1 is easily obtained, and σξ = Hξ ϕξ 2 where ϕξ is such 2 2 ψξ = ϕξ ϕξ and ψξ the covariance matrix of ξ ϕξ only depends on implementation choices, whereas Hξ only depends on the choice of the realization.From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 69/72
  • 145. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysis NELink with interval error – 1 W! [e] x(k) x￿ (k) x(k) [x￿ (k)] Q[ ] ≡ + Quantized a signal x(k) is equivalent to add an interval error [e](k):From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 70/72
  • 146. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysis NELink with interval error – 1 W! [e] x(k) x￿ (k) x(k) [x￿ (k)] Q[ ] ≡ + Quantized a signal x(k) is equivalent to add an interval error [e](k): Right-shift of d bits: truncation best roundoff q mid 2 0 q q rad 2 2 with q = 2−γ−dFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 70/72
  • 147. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysis NELink with interval error – 2 W! The implemented system is still equivalent to u(k) y(k) H [ξ](k) [ξ ￿ ](k) [y ￿ ](k) Hξ + with [ξ](k) the interval error added in the systemFrom controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 71/72
  • 148. Fixed-point Filters SIF Exemples ρDFIIt a priori Measures Roundoff noise analysis NELink with interval error – 3 Back W! Interval through a filter Let H be a SISO filter and [u](k) be an interval input, centered in u (constant), with radius rx (constant). [u](k) [y](k) H Then [y ](k) is an interval signal, centered in y (constant), with radius ry such as y = H(0)u, and ry H 1 rx H(0) is the DC-gain of the filter H. ∞ The 1 -norm or H is defined by H 1 k=0 |h(k)|, where h(k) is its impulse response. ∞ If H is a state-space (A, B, C , d ), then H 1 = k=0 CAk B + d .From controller/filter to code: the optimal implementation problem Thibault Hilaire (thibault.hilaire@lip6.fr) 72/72