1 scaling of signal levels - isy.liu.se · pdf filelars wanhammar linköping university 17...

18
DSP Integrated Circuits Department of Electrical Engineering [email protected] Lars Wanhammar Linköping University http://www.es.isy.liu.se/ 1 Scaling of Signal Levels “Every little bit helps” Measures must also be taken to prevent overflow from occurring too often, since overflows cause large distortion. The probability of overflow can be reduced by inserting scaling multipli- ers that only affect signal levels inside the filter and not the poles and zeros. Scaling is not required in floating-point arithmetic since the exponent is adjusted so that the mantissa always represents the signal value with full precision. N 1 N 2 x(n) y(n) c c 1/c a v(n) Critical overflow node

Upload: doanhanh

Post on 08-Feb-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits

Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

1

Scaling of Signal Levels

“Every little bit helps”

Measures must also be taken to prevent overflow from occurring toooften, since overflows cause large distortion.

The probability of overflow can be reduced by inserting scaling multipli-ers that only affect signal levels inside the filter and not the poles andzeros.

Scaling is not required in floating-point arithmetic since the exponent isadjusted so that the mantissa always represents the signal value with fullprecision.

N1 N2

x(n) y(n)c

c

1/c

av(n)

Critical overflow node

Page 2: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits

Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

2

An important advantage of using two’s-complement representation fornegative numbers is that temporary overflows in repeated additions can beaccepted if the final sum is within the proper signal range.

The incident signal to a multiplier with a noninteger coefficient must notoverflow, since that would cause large errors.

Safe Scaling

One strategy used to choose the scaling coefficient can be derived in thefollowing way. The signal in the scaling node is given by

v

(

n

) =

f

(

n

) *

x

(

n

)

where

f

(

n

) is the impulse response from the input of the filter to the critical

T

+2 1.375

Critical overflow node

Page 3: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits

Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

3

overflow node. The magnitude of the output signal is bounded by

where

In this scaling approach, we insert a scalingmultiplier(s),

c

, between the input and thecritical overflow node.

The resulting impulse response becomes

Now, we choose

c

so that

v n( ) f k( )x n k–( )k 0=

•Â f k( ) x n k–( ) M f k( )

k 0=

•Â£

k 0=

•Â£=

x n( ) M£

N1 N2

x(n) y(n)c

c

1/c

av(n)

Critical overflow nodef¢¢¢¢ n( ) cf n( )=

f¢¢¢¢ n( ) 1£n 0=

•Â

Page 4: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits

Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

4

The magnitude of the scaled input signal to the multiplier will be equal to,or less than, the magnitude of the input signal of the filter.

The input to the multiplier will never overflow if the input to the filter doesnot overflow.

This scaling policy is therefore called

safe scaling

.

The safe scaling method is generally too pessimistic since it uses the avail-able signal range inefficiently.

The safe scaling method is suitable for short FIR filters because the prob-ability for overflow is high for a filter with a short impulse response.

It is sometimes argued that parasitic oscillations caused by overflow cannot occur if the filter is scaled according to the safe scaling criterion.

However, this is not correct since abnormal signal values can occur due tomalfunctioning hardware—for example, in the memory (delay) elementsdue to external disturbances (e.g., ionic radiation and disturbances fromthe supply lines).

Page 5: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits

Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

5

L

p

-Norms

For a sequence,

x

(

n

), with Fourier transform

X

(

e

j

w

T

), the

L

p

-norm isdefined as

for any real

p

1 such that the integral exists. It can be shown that

L

1

-Norm

For

p

= 1 we have

X ejwT( ) p D p1

2p------ X ejwT( )

pwTd

p–

p

Ú=

X p X q≥ for p q≥

X ejwT( ) 11

2p------ X ejwT( ) wTd

p–

p

Ú=

Page 6: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

6

L2-Norm

The L2-norm is simple to compute by using Parseval’s relation whichstates that the power can be expressed either in the time domain or in thefrequency domain. We get from Parseval’s relation

L••••-Norm

X ejwT( ) 21

2p------ X ejwT( ) 2 wTd

p–

p

Ú=

X 2 x n( )2

n •–=

•Â=

X ejwT( ) • limp •Æ

X ejwT( ) p maxwT

X ejwT( ){ }= =

Page 7: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

7

The values of Lp-norms are illustrated below for the second-order sectionhaving the transfer function

H z( ) 0.5z2 0.4z– 0.5+

z2 1 2z 0.8+,–------------------------------------------- z 0.8>,=

L1 = 0.65093

L2 = 0.79582

L• = 1.9365

1.5

1.0

0.5

| H |

wT

p/2 p

Page 8: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

8

Scaling

The first step in scaling a filter is to determine the appropriate Lp-normthat characterizes the input signal.

Generally, we distinguish between wide-band and narrow-band input sig-nals.

Jackson has derived the following bound on the variance of the signal inthe critical node v

where Fv(ejwT) is the frequency response to the critical node v and Sx(e

jwT)is the power spectrum of the input signal.

sv2 Fv ejwT( ) 2p

2£ Sx ejwT( ) q 1p--- 1

q---+, 1 for p q 1≥,,=

Page 9: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

9

Scaling of Wide-Band Signals

A wide-band input signal is characterized by theL•-norm, .

Hence, and the filter should there-fore be scaled such that , where c £ 1

for all critical nodes.

T

T

T

Ta1i

a2i

b1i

b2i

a0i

Sx •

sv2 Fv ejwT( ) 2p

2£ Sx ejwT( ) q 1p--- 1

q---+, 1 for p q 1≥,,=

q • pfi 1= =Fv 2

c=

Page 10: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

10

Scaling of Narrow Band Signals

The L1-norm, characterizes a sinusoidal or narrow-band signal.

From

we find, with q = 1 and p = •, that the upper bound for the variance of thesignal in the critical node is determined by .

Thus, the filter should be scaled such that the maximum value of

= £ 1 for all critical nodes.

Sx 1

sv2 Fv ejwT( ) 2p

2£ Sx ejwT( ) q 1p--- 1

q---+, 1 for p q 1≥,,=

Fv •

Fv maxFv •

Page 11: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

11

Round-Off Noise

A simple linear model of the quantization operation in fixed-point arith-metic can be used if the signal varies over several quantization levels,from sample to sample, in an irregular way.

The quantization of a product

is modeled by an additive error

where e(n) is a stochastic process.

Normally, e(n) can be assumed to be white noise and independent of thesignal.

The density function for the errors is often approximated by a rectangularfunction.

QXQ(n)

XQ(n) a

a YQ(n)

YQ(n)

e(n)

yQ n( ) axQ n( )[ ]Q

=

yQ n( ) axQ n( ) e n( )+=

Page 12: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

12

However, the density function is a discrete function if both the signalvalue and the coefficient value are binary.

The difference is only significant if only a few bits are discarded by thequantization. The average value and variance for the noise source are

where

m

Qc2

-------Q rounding

Qc 1–

2----------------Q truncation

ÓÔÔÌÔÔÏ

=

se2 ke 1 Qc

2–( )s2=

ke

1 rounding or truncation

4 6p---– magnitude truncation

ÓÔÌÔÏ

=

Page 13: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

13

= Q2/12, Q is the data quantization step, and Qc is the coefficient quan-tization step.

For long coefficient wordlengths—the average value is close to zero forrounding and –Q/2 for truncation.

Correction of the average value and variance is only necessary for shortcoefficient wordlengths, for example, for the scaling coefficients.

A digital filter with M quantization points has a DC offset of

where gi(n) are the impulse responses measuredfrom the noise sources to the output of the filter.

s2

my Gi 1( ) mi

i 1=

M

 m gi n( )n 0=

•Â

i 1=

M

Â= =

Digital Filterx(n) y(n)

ei(n)

gi(n)ai

Page 14: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

14

The noise sources contribute to the noise at the output of the filter. Thevariance at the output, from source i, is

The variance of the round-off noise at the output is equal to the sum of thecontributions from all the uncorrelated noise sources

syi2 si

2 gi n( )2

n 0=

•Â si

2 Gi ejwT( ) 22= =

sytot2 syi

2

i 1=

M

Â=

Page 15: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

15

Coefficient Sensitivity

Consider the LSI network which is described by

We get the transfer function

The transfer function from the input to the multiplier is

and the transfer function from the output of the multiplier to the output of

N

a

X1

X2

X3

Y2

Y1

Y1 AX1 BX2+=

Y2 CX1 DX2+=

X2 aY2 X3+=

HY1X1------

X3 0=A aCB

1 aD–----------------+= =

FY2X1------

X3 0=

C1 aD–----------------= =

Page 16: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

16

the network is

Taking the derivative of the transfer function, H, with respect to the coef-ficient, a, leads to the main result

where F is the transfer function from the input of the filter to the input ofthe multiplier and G is the transfer function from the output of the multi-plier to the output of the filter.

GY1X3------

X1 0=

B1 aD–----------------= =

∂H∂a------- CB

1 aD–( )2------------------------ FG= =

Page 17: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

17

Sensitivity and Round-Off Noise

Fettweis has shown that coefficient sensitivity and round-off noise areclosely related. Jackson has derived the following lower bounds on round-off noise in terms of the sensitivity.

Let Fi be the scaled frequency response from the input of the filter to theinput of the multiplier ai, and Gi the frequency response from the outputof the multiplier to the output of the filter. For a scaled filter we have

= 1 for all critical nodes i = 0, 1, …, n

The round-off noise variance at the output of the filter is

We get, using Hölder’s inequality1, for p = 2

1. Hölders inequality:

Fi p

sye2 si

2 Gi 22

i 0=

n

 si2 Fi p

Gi 22

i 0=

n

Â= =

FG 1 F p G q , £ 1p--- 1

q---+ 1 p q 1≥, ,=

Page 18: 1 Scaling of Signal Levels - isy.liu.se · PDF fileLars Wanhammar Linköping University 17 Sensitivity and Round-Off Noise Fettweis has shown that coefficient sensitivity and round-off

DSP Integrated Circuits Department of Electrical Engineering [email protected] Wanhammar Linköping University http://www.es.isy.liu.se/

18

and

This is a lower bound of the noise variance for a filter scaled for wide-band input signals.

Another lower bound that is valid instead for L•-norm scaling

These two bounds are important, since they show that a structure withhigh sensitivity will always have high round-off noise and requires alonger data wordlength.

sye2 si

2 FiGi 12

i 0=

n

Â≥

sye2 si

2 ∂H∂ai--------

1

2

i 0=

n

Â≥

sye2 s1

2 ∂H∂ai--------

2

2

i 0=

n

Â≥