formatting bits to better implement signal processing
play

Formatting bits to better implement signal processing algorithms - PowerPoint PPT Presentation

Context and Objectives Bits Formatting Conclusion Formatting bits to better implement signal processing algorithms Benoit Lopez - Thibault Hilaire - Laurent-St ephane Didier PECCS 2014 January 9 th 2014 1/20 Context and Objectives Bits


  1. Context and Objectives Bits Formatting Conclusion Formatting bits to better implement signal processing algorithms Benoit Lopez - Thibault Hilaire - Laurent-St´ ephane Didier PECCS 2014 January 9 th 2014 1/20

  2. Context and Objectives Bits Formatting Conclusion Outline Context and Objectives 1 Bits Formatting 2 Conclusion 3 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 ] y [ n ] x [ n ] y [ n ] b 1 + + + b 0 b 1 a 1 z − 1 z − 1 z − 1 z − 1 b 2 a 2 + + b 1 − a 1 P n i =0 b i z − i h ( z ) = z − 1 z − 1 z − 1 z − 1 1 + P n i =1 a i z − i a 3 b 3 + + b 2 − a 2 z − 1 z − 1 z − 1 z − 1 b 3 − a 3 Signal Processing LTI filters: FIR or IIR Its transfer function Algorithmic relationship used to compute output(s) from input(s), for example: n n � � y ( k ) = b i u ( k − i ) − a i y ( k − i ) i =0 i =1 4/20

  6. Context and Objectives Bits Formatting Conclusion On the other hand... A target − γ 2 . . . 0 2 . . . γ α − 2 2 ± s β α 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. − 2 m 2 m − 1 2 0 2 − 1 2 ℓ X − 1 X ℓ X m X 0 w Representation : X . 2 ℓ with X = X m X m − 1 ... X 0 ... 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. − 2 m 2 m − 1 2 0 2 − 1 2 ℓ X − 1 X ℓ X m X 0 w Representation : X . 2 ℓ with X = X m X m − 1 ... X 0 ... 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 ) = b 0 + b 1 z − 1 + · · · + b n z − n ∀ z ∈ C . (1) 1 + a 1 z − 1 + · · · + a n z − n , 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 ) = b 0 + b 1 z − 1 + · · · + b n z − n ∀ z ∈ C . (1) 1 + a 1 z − 1 + · · · + a n z − n , This filter is usually realized with the following algorithm n n � � y ( k ) = b i u ( k − i ) − a i y ( k − i ) (2) i =0 i =1 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 ) = b 0 + b 1 z − 1 + · · · + b n z − n ∀ z ∈ C . (1) 1 + a 1 z − 1 + · · · + a n z − n , This filter is usually realized with the following algorithm n n � � y ( k ) = b i u ( k − i ) − a i y ( k − i ) (2) i =0 i =1 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 n y † ( k ) = � � a i y † ( k − i ) + e ( k ) . b i u ( k − i ) − (3) i =0 i =1 7/20

  12. Context and Objectives Bits Formatting Conclusion Filter u ( k ) y ( k ) H y † ( k ) e ( k ) ∆ y ( k ) + H e ∆ y ( k ) � y † ( k ) − y ( k ) can be seen as the result of the error through the filter H e : 1 H e ( z ) = 1 + a 1 z − 1 + · · · + a n z − n , ∀ z ∈ C . 8/20

  13. Context and Objectives Bits Formatting Conclusion Filter u ( k ) y ( k ) H y † ( k ) e ( k ) ∆ y ( k ) + H e ∆ y ( k ) � y † ( k ) − y ( k ) can be seen as the result of the error through the filter H e : 1 H e ( z ) = 1 + a 1 z − 1 + · · · + a n 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 ] : e + e | H e | DC − e − e ∆ y = � H e � ℓ ∞ 2 2 e + e | H e | DC + e − e ∆ y = � H e � ℓ ∞ 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 Context and Objectives 1 Bits Formatting 2 Conclusion 3 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 n � � s = c i · x i = p i i =1 i =1 where c i are known constants and x i 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 f s Context A sum of N terms ( p i ) 1 ≤ i ≤ N with different formats, and the known FPF of final result ( s f ), less than total wordlength ( s ). 12/20

  19. Context and Objectives Bits Formatting Conclusion Formatting s s s s s s s s s f s Context A sum of N terms ( p i ) 1 ≤ i ≤ N with different formats, and the known FPF of final result ( s f ), 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 f s 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 p i s, in format ( M , L ). If s is known to have a final MSB equals to m f with m f < M , then:   m f +1 m f � � 2 j p i , j s =   1 ≤ i ≤ n j = L s s s s s s s s s f M s L m f 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 p i s, in format ( M , L ). If s is known to have a final MSB equals to m f with m f < M , then:   m f +1 m f � � 2 j p i , j s =   1 ≤ i ≤ n j = L s s s s s s s s s s s f M s L m f 14/20

Recommend


More recommend