Determining Fixed-Point Formats using the Worst-Case Peak Gain - - PowerPoint PPT Presentation

determining fixed point formats using the worst case peak
SMART_READER_LITE
LIVE PREVIEW

Determining Fixed-Point Formats using the Worst-Case Peak Gain - - PowerPoint PPT Presentation

Determining Fixed-Point Formats using the Worst-Case Peak Gain measure Anastasia Volkova , Thibault Hilaire, Christoph Lauter Sorbonne Universit es, University Pierre and Marie Curie, LIP6, Paris, France ASILOMAR 49 November 10, 2015 1/18


slide-1
SLIDE 1

Determining Fixed-Point Formats using the Worst-Case Peak Gain measure

Anastasia Volkova, Thibault Hilaire, Christoph Lauter

Sorbonne Universit´ es, University Pierre and Marie Curie, LIP6, Paris, France

ASILOMAR 49 November 10, 2015

1/18

slide-2
SLIDE 2

Motivation

0 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 1 1

Filter implementation flow:

2/18

slide-3
SLIDE 3

Motivation

0 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 1 1

Filter implementation flow: Transfer function generation

2/18

slide-4
SLIDE 4

Motivation

0 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 1 1

Filter implementation flow: Transfer function generation State-space, DFI, DFII, . . .

2/18

slide-5
SLIDE 5

Motivation

0 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 1 1

Filter implementation flow: Transfer function generation State-space, DFI, DFII, . . . Software or Hardware implementation

2/18

slide-6
SLIDE 6

Motivation

0 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 1 1

Filter implementation flow: Transfer function generation

! Coefficient quantization

State-space, DFI, DFII, . . . Software or Hardware implementation

2/18

slide-7
SLIDE 7

Motivation

0 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 1 1

Filter implementation flow: Transfer function generation

! Coefficient quantization

State-space, DFI, DFII, . . .

! Large variety of structures with no common quality criteria

Software or Hardware implementation

2/18

slide-8
SLIDE 8

Motivation

0 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 1 1

Filter implementation flow: Transfer function generation

! Coefficient quantization

State-space, DFI, DFII, . . .

! Large variety of structures with no common quality criteria

Software or Hardware implementation

! Constraints: power consumption, area, error, speed, etc.

2/18

slide-9
SLIDE 9

Motivation: Automatized filter implementation flow

3/18

slide-10
SLIDE 10

Motivation: Automatized filter implementation flow

Focus on Fixed-Point realization.

3/18

slide-11
SLIDE 11

Motivation: Automatized filter implementation flow

Focus on Fixed-Point realization. Optimization of wordlengths: Take more - pay more Take less - overflow risk What we want in the end: Rigorous algorithm for Fixed-Point Formats (FxPF) determination Integration into automatized code generator for filters Multiple wordlength paradigm

3/18

slide-12
SLIDE 12

LTI filters

H := (A, B, C, D) is a Bounded Input Bounded Output LTI filter in state-space representation: H x(k + 1) = Ax(k) + Bu(k) y(k) = Cx(k) + Du(k) with q inputs, n states and p outputs and state matrices

4/18

slide-13
SLIDE 13

Basic brick: interval through filter

The Worst-Case Peak Gain theorem

Time Amplitude

8k, |u(k)| ≤ ¯ u Input u(k)

5/18

slide-14
SLIDE 14

Basic brick: interval through filter

The Worst-Case Peak Gain theorem

H

y(k) u(k)

amplification/attenuation

Time Amplitude

8k, |u(k)| ≤ ¯ u Input u(k)

5/18

slide-15
SLIDE 15

Basic brick: interval through filter

The Worst-Case Peak Gain theorem

Time Amplitude

Output y(k) H

y(k) u(k)

amplification/attenuation

Time Amplitude

8k, |u(k)| ≤ ¯ u Input u(k)

5/18

slide-16
SLIDE 16

Basic brick: interval through filter

The Worst-Case Peak Gain theorem

Time Amplitude

Output y(k) 8k, |y(k)| ≤ hhHii ¯ u H

y(k) u(k)

amplification/attenuation

hhHii = |D| + P∞

k=0 |CAkB|

Worst-Case Peak Gain

Time Amplitude

8k, |u(k)| ≤ ¯ u Input u(k)

5/18

slide-17
SLIDE 17

Two’s complement Fixed-Point arithmetic

m + 1 −ℓ s w −2m 20 2−1 2m−1 2ℓ

t = −2mtm +

m−1

  • i=ℓ

2iti Wordlength: w Most Significant Bit position: m Least Significant Bit position: ℓ := m − w + 1

6/18

slide-18
SLIDE 18

Two’s complement Fixed-Point arithmetic

m + 1 −ℓ s w −2m 20 2−1 2m−1 2ℓ

t = −2mtm +

m−1

  • i=ℓ

2iti quantization step: 2ℓ t represented by integer T = t · 2ℓ T ∈ [−2m; 2m − 2ℓ] ∩ Z

6/18

slide-19
SLIDE 19

Two’s complement Fixed-Point arithmetic

m + 1 −ℓ s w −2m 20 2−1 2m−1 2ℓ

t = −2mtm +

m−1

  • i=ℓ

2iti y(k) ∈ R wordlength w bits minimal Fixed-Point Format (FPF) is the least m: ∀k, y(k) ∈ [−2m; 2m − 2m−w+1]

6/18

slide-20
SLIDE 20

Problem statement

Let H := (A, B, C, D) be a LTI filter: H x(k + 1) = Ax(k) + Bu(k) y(k) = Cx(k) + Du(k) Given wordlength constraints wx and wy for each state and output variable input domain ¯ u we need to determine the minimal FPF for all variables of filter H, i.e. find the least mx and my such that ∀k, xi(k) ∈ [−2mxi; 2mxi − 2mxi−wxi+1] ∀k, yi(k) ∈ [−2myi; 2myi − 2myi−wyi+1].

7/18

slide-21
SLIDE 21

Modification of H

Let ζ(k) := x(k) y(k)

  • be a vertical concatenation of state and
  • utput vectors.

8/18

slide-22
SLIDE 22

Modification of H

Let ζ(k) := x(k) y(k)

  • be a vertical concatenation of state and
  • utput vectors.

Then the state-space takes the following form: Hζ    x(k + 1) = Ax(k) + Bu(k) ζ(k) = I C

  • x(k)

+ D

  • u(k)

8/18

slide-23
SLIDE 23

Modification of H

Let ζ(k) := x(k) y(k)

  • be a vertical concatenation of state and
  • utput vectors.

Then the state-space takes the following form: Hζ    x(k + 1) = Ax(k) + Bu(k) ζ(k) = I C

  • x(k)

+ D

  • u(k)

We seek to determine the least mζ such that ∀k, |ζi(k)| 2mζi − 2mζi−wi+1.

8/18

slide-24
SLIDE 24

Computing the MSB using the WCPG theorem

Applying the WCPG theorem on filter Hζ gives ∀k, |ζi(k)| ( Hζ ¯ u)i

9/18

slide-25
SLIDE 25

Computing the MSB using the WCPG theorem

Applying the WCPG theorem on filter Hζ gives ∀k, |ζi(k)| ( Hζ ¯ u)i Therefore, the smallest mζi satisfying ( Hζ ¯ u)i 2mζi − 2mζi−wi+1, will satisfy the wordlength constraints.

9/18

slide-26
SLIDE 26

Computing the MSB using the WCPG theorem

Applying the WCPG theorem on filter Hζ gives ∀k, |ζi(k)| ( Hζ ¯ u)i Therefore, the smallest mζi satisfying ( Hζ ¯ u)i 2mζi − 2mζi−wi+1, will satisfy the wordlength constraints. We can compute mζi with mζi =

  • log2 (

Hζ ¯ u)i − log2

  • 1 − 21−wζi

.

9/18

slide-27
SLIDE 27

Taking the quantization errors into account

The exact filter Hζ is: Hζ    x (k + 1) = Ax (k) + Bu(k) ζ (k) = I C

  • x

+ D

  • u(k)

10/18

slide-28
SLIDE 28

Taking the quantization errors into account

The actually implemented filter H♦

ζ is:

Hζ♦    x♦(k + 1) = ♦mx

  • Ax♦(k) + Bu(k)
  • ζ♦(k)

= ♦mζ I C

  • x♦(k) +

D

  • u(k)
  • where ♦m is some operator ensuring faithful rounding:

|♦m(x) − x| 2m−w+1.

10/18

slide-29
SLIDE 29

Taking the quantization errors into account

The actually implemented filter H♦

ζ is:

Hζ♦    x♦(k + 1) = ♦mx

  • Ax♦(k) + Bu(k)
  • ζ♦(k)

= ♦mζ I C

  • x♦(k) +

D

  • u(k)
  • where ♦m is some operator ensuring faithful rounding:

|♦m(x) − x| 2m−w+1. It holds H♦

ζ

   x♦(k + 1) = Ax♦(k) + Bu(k) + εx(k) ζ♦(k) = I C

  • x♦(k) +

D

  • u(k) +

εx(k) εy(k)

  • with

|εx(k)| 2mx−wx+1 and |εy(k)| 2my−wy+1.

10/18

slide-30
SLIDE 30

Implemented filter decomposition

ζ♦(k) u(k)

H♦

ζ 11/18

slide-31
SLIDE 31

Implemented filter decomposition

ζ♦(k) u(k)

H♦

ζ 11/18

slide-32
SLIDE 32

Implemented filter decomposition

ζ♦(k) u(k)

H♦

ζ

q−1 X(k + 1) X(k) A

11/18

slide-33
SLIDE 33

Implemented filter decomposition

ζ♦(k) u(k)

H♦

ζ

q−1 X(k + 1) X(k) A

Hζ H∆

ζ♦(k) u(k) ζ(k) ∆ζ(k)

  • εx(k)

εy(k)

  • 11/18
slide-34
SLIDE 34

Implemented filter decomposition

ζ♦(k) u(k)

H♦

ζ

q−1 X(k + 1) X(k) A

Hζ H∆

ζ♦(k) u(k) ζ(k) ∆ζ(k)

  • εx(k)

εy(k)

! Filter H∆ depends on the MSBs of filter Hζ

11/18

slide-35
SLIDE 35

Implemented filter decomposition

ζ♦(k) u(k)

H♦

ζ

q−1 X(k + 1) X(k) A

Hζ H∆

ζ♦(k) u(k) ζ(k) ∆ζ(k)

  • εx(k)

εy(k)

! Filter H∆ depends on the MSBs of filter Hζ

11/18

slide-36
SLIDE 36

Implemented filter decomposition

ζ♦(k) u(k)

H♦

ζ

q−1 X(k + 1) X(k) A

Hζ H∆

ζ♦(k) u(k) ζ(k) ∆ζ(k)

  • εx(k)

εy(k)

! Filter H∆ depends on the MSBs of filter Hζ

11/18

slide-37
SLIDE 37

Two step approach

Step 1 Determine the MSBs mζ for the exact filter Hζ, applying the WCPG theorem; Step 2 Compute the error-filter, induced by the format mζ and deduce the FPF of the implemented filter H♦

ζ Hζ H∆

ζ♦(k) u(k) ζ(k) ∆ζ(k)

εx(k) εy(k)

Hζ H∆

ζ♦(k) u(k) ζ(k) ∆ζ(k)

εx(k) εy(k)

12/18

slide-38
SLIDE 38

MSB computation error analysis

mζi =

  • log2 (h

hHζi i ¯ u)i + log2

  • 1 − 21−wi

13/18

slide-39
SLIDE 39

MSB computation error analysis

mζi =

  • log2 (h

hHζi i ¯ u)i + log2

  • 1 − 21−wi

| {z } \ hhHζii + εW CP G

13/18

slide-40
SLIDE 40

MSB computation error analysis

mζi =

  • log2 (h

hHζi i ¯ u)i + log2

  • 1 − 21−wi

| {z } \ hhHζii + εW CP G c mζi =

  • log2 (h

hHζi i ¯ u)i + log2

  • 1 − 21−wi

+ log2

  • 1 + (εW CP G · ¯

u)i (h hHζi i ¯ u)i

  • 13/18
slide-41
SLIDE 41

MSB computation error analysis

mζi =

  • log2 (h

hHζi i ¯ u)i + log2

  • 1 − 21−wi

| {z } \ hhHζii + εW CP G c mζi =

  • log2 (h

hHζi i ¯ u)i + log2

  • 1 − 21−wi

+ log2

  • 1 + (εW CP G · ¯

u)i (h hHζi i ¯ u)i

  • = mζi + d. . .e

|{z}

∈{0,1}

13/18

slide-42
SLIDE 42

MSB computation error analysis

mζi =

  • log2 (h

hHζi i ¯ u)i + log2

  • 1 − 21−wi

| {z } \ hhHζii + εW CP G c mζi =

  • log2 (h

hHζi i ¯ u)i + log2

  • 1 − 21−wi

+ log2

  • 1 + (εW CP G · ¯

u)i (h hHζi i ¯ u)i

  • = mζi + d. . .e

|{z}

∈{0,1}

Adjust error term εWCPG in order to be at most off by one.

13/18

slide-43
SLIDE 43

Algorithm

Step 1 Determine the MSBs mζ for the exact filter Hζ, applying the WCPG theorem; Step 2 Compute the error-filter H∆, induced by the format mζ and deduce the MSB m♦

ζ of the

implemented filter; Step 3 If m♦

ζi == mζi then return m♦ ζi

  • therwise mζi ← mζi + 1 and go

to Step 2.

Hζ H∆

ζ♦(k) u(k) ζ(k) ∆ζ(k)

  • εx(k)

εy(k)

Hζ H∆

ζ♦(k) u(k) ζ(k) ∆ζ(k)

εx(k) εy(k)

14/18

slide-44
SLIDE 44

Numerical examples

Example: Random filter with 6 states, 1 input, 3 outputs ¯ u = 3.7776, wordlengths set to 7 bits

mζ = (4, 4, 4, 4, 2, 3, 6, 5, 5) m♦

ζ = (4, 5, 4, 4, 2, 3, 6, 5, 5)

15/18

slide-45
SLIDE 45

Numerical examples

Example: Random filter with 6 states, 1 input, 3 outputs ¯ u = 3.7776, wordlengths set to 7 bits

mζ = (4, 4, 4, 4, 2, 3, 6, 5, 5) m♦

ζ = (4, 5, 4, 4, 2, 3, 6, 5, 5)

m♦

ζ = (4, 5, 5, 4, 3, 4, 6, 5, 5)

After 3 iterations:

15/18

slide-46
SLIDE 46

Numerical examples

¯ x2 x♦

2 (k)

x2(k) ¯ x♦

2

After 3 iterations:

16/18

slide-47
SLIDE 47

Conclusion and Perspectives

Conclusion Rigorous procedure for Fixed-Point Formats determination Filter computation errors are taken into account, ensuring that no overflow occurs Multiple-wordlength paradigm Perspectives Integrate into optimization procedures in automatic workflow Solve off-by-one problem

17/18

slide-48
SLIDE 48

Thank you! Questions?

18/18