1 of 71

Digital Signal Processing

Finite Word length Effects

PREETHI S

1

10/17/2023

2 of 71

Finite Word(Register) Length Effects

PREETHI S

2

10/17/2023

Language of computer or

Digital processor is : -----

Can’t You hear what I am saying?

Speak in My language

3 of 71

PREETHI S

3

10/17/2023

000

0

001

1

010

2

011

3

100

4

101

5

110

6

111

7

Consider 3 bit processor :

Positive Integers only

Range : 0 - 7

Can we Store Sequence as it is : 0,1,2,3,4,5,6,7,8,9,10 ?

Can we Store sequence as it is : 0.25, 0.75, 1.6?

Can we Store sequence as it is: -2 , -1 , 0 ,1?

4 of 71

PREETHI S

4

10/17/2023

0.00

0

0.01

1

0.10

2

0.11

3

1.00

-0

1.01

-1

1.10

-2

1.11

-3

Consider 3 bit processor :

Positive and Negative Integers

Range : -3 to 3

Can we Store sequence as it is: -2 , -1 , 0 ,1?

5 of 71

PREETHI S

5

10/17/2023

.000

.0

.001

0.125

.010

0.250

.011

0.375

.100

0.5

.101

0.625

.110

0.750

.111

0.875

Consider 3 bit processor : Rational

6 of 71

PREETHI S

6

10/17/2023

.000

.0

.001

0.125

.010

0.250

.011

0.375

.100

0.5

.101

0.625

.110

0.750

.111

0.875

Consider 3 bit processor

Fixed Point Representation:

7 of 71

PREETHI S

7

10/17/2023

.000

.0

.001

0.125

.010

0.250

.011

0.375

.100

0.5

.101

0.625

.110

0.750

.111

0.875

Consider 3 bit processor

Fixed Point Representation:

8 of 71

PREETHI S

8

10/17/2023

.000

.0

.001

0.125

.010

0.250

.011

0.375

.100

0.5

.101

0.625

.110

0.750

.111

0.875

Consider 3 bit processor

Fixed Point Representation:

9 of 71

PREETHI S

9

10/17/2023

0.00

0

0.01

¼

0.10

2/4

0.11

¾

1.00

-0

1.01

-1/4

1.10

-2/4

1.11

-3/4

Range : 1-2-b

Representing Negative Numbers:

Sign and Magnitude

10 of 71

PREETHI S

10

10/17/2023

0.00

0

0.01

¼

0.10

2/4

0.11

¾

1.00

-0

1.01

-1/4

1.10

-2/4

1.11

-3/4

Representing Negative Numbers:

Sign and Magnitude

Two Ways of representing zeros

11 of 71

PREETHI S

11

10/17/2023

0.00

0

0.01

¼

0.10

2/4

0.11

¾

1.00

-0

1.01

-1/4

1.10

-2/4

1.11

-3/4

0.00

0

0.01

¼

0.10

2/4

0.11

¾

1.00

1.01

-2/4

1.10

-1/4

1.11

0

Ones Complement for -ve:

Complement bits to the right of

Binary point

12 of 71

PREETHI S

12

10/17/2023

0.00

0

0.01

¼

0.10

2/4

0.11

¾

1.00

-0

1.01

-1/4

1.10

-2/4

1.11

-3/4

Ones Complement

0.00

0

0.01

¼

0.10

2/4

0.11

¾

1.00

1.01

-2/4

1.10

-1/4

1.11

0

13 of 71

PREETHI S

13

10/17/2023

0.00

0

0.01

¼

0.10

2/4

0.11

¾

1.00

1.01

-2/4

1.10

-1/4

1.11

0

0.00

0

0.01

¼

0.10

2/4

0.11

¾

1.00

-0

1.01

-1/4

1.10

-2/4

1.11

-3/4

0.00

0

0.01

¼

0.10

2/4

0.11

¾

1.00

-1

1.01

-3/4

1.10

-2/4

1.11

-1/4

14 of 71

PREETHI S

14

10/17/2023

15 of 71

PREETHI S

15

10/17/2023

How many bits are required to represent :

16 of 71

PREETHI S

16

10/17/2023

How many bits are required to represent :

Answer : 0.0 0011 0011 0011 0011 0011 0011 …….

17 of 71

PREETHI S

17

10/17/2023

How many bits are required to represent :

We need “Infinite” precision to store 0.1

0.1 * 2 = 0.2

0.2 * 2 = 0.4

0.4 * 2 = 0.8

0.8 * 2 = 1.6

0.6 * 2 = 1.2

0.2 * 2 = 0.4

Answer : 0.0 0011 0011 0011 0011 0011 0011 …….

18 of 71

PREETHI S

18

10/17/2023

How many bits do we need ?

x =123,000,000,000,0, 000,000,000,0

10100110101100100011001010001111111100111010011000110000000000000000000000

74 bit

19 of 71

PREETHI S

19

10/17/2023

0.000,001

0.000,000,000,1

= 1 * 10 -6

= 1 * 10-10

20 of 71

PREETHI S

20

10/17/2023

0.000,001

= 1 * 10 -6

0.000,000,000,1

= 1 * 10-10

21 of 71

PREETHI S

21

10/17/2023

0.000,001

0.000,000,000,1

M is the mantissa (Fraction or Significand) = Precision

E is the characteristic or exponent = range (Big or small)

= 1 * 10 -6

= 1 * 10-10

22 of 71

PREETHI S

22

10/17/2023

0.000,001

0.000,000,000,1

M is the mantissa (Fraction or Significant ) = Precision

E is the characteristic or exponent = range (Big or small)

= 1 * 10 -6

= 1 * 10-10

0.125 = 1.25 × 10-1

5,000,000 = 5.0 × 106

23 of 71

PREETHI S

23

10/17/2023

Floating Point Representation

We call this floating point, guess why?

5,123,000 = 5.123 × 106

5,123,000 = 51.23 × 105

5,123,000 = 512.3 × 104

Move the decimal point and change the exponent correspondingly!

Many Representation of Same Number

Normalize

24 of 71

PREETHI S

24

10/17/2023

Floating Point Representation: Why we need it?

Assume : M = 2, E = 2, totally 4 bits

M

E

Value

00

00

0

01

00

1

10

00

2

11

00

3

M

E

Value

10

01

4

11

01

6

Step size is 2

Step size is 1

M

E

Value

10

10

8

11

10

12

Step size is 4

M

E

Value

10

11

16

11

11

24

Step size is 8

Compute Next one

25 of 71

PREETHI S

25

10/17/2023

Floating Point Representation: Why we need it?

Assume : M = 2, E = 2, totally 4 bits

  • # of bits : 4
  • Range : 0 to 24
  • Non-uniform Step

size

  • # of bits : 4
  • Range : 0 to 16
  • Uniform Step

size

Fixed point

26 of 71

PREETHI S

26

10/17/2023

Floating Point Representation: Why we need it?

Assume : M = 2, E = 2, totally 4 bits

  • # of bits : 4
  • Range : 0 to 24
  • Non-uniform Step

size

  • # of bits : 4
  • Range : 0 to 16
  • Uniform Step

size

Fixed point

Calculate for 8 bits: M =4 , E = 4

27 of 71

PREETHI S

27

10/17/2023

Floating Point Representation: Why we need it?

Assume : M = 2, E = 2, totally 4 bits

  • # of bits : 4
  • Range : 0 to 24
  • Non-uniform Step

size

  • # of bits : 4
  • Range : 0 to 16
  • Uniform Step

size

Fixed point

Calculate for 8 bits: M =4 , E = 4

Range : 0 to 28 = 0 to 255

(1111) * 21111 = 16 * 216

= 0 to 1048576

28 of 71

PREETHI S

28

10/17/2023

Floating Point Representation: Why we need it?

It Provides Very High Dynamic Range

29 of 71

Example: Express -3.75 as a floating point number using IEEE single precision.

PREETHI S

29

10/17/2023

First, let’s normalize according to IEEE rules:

-3.75 = -11.112 = -1.111 x 21

The bias is 127, so E = 128 = (10000000) in binary

This equates to:

-(1).1112 x 2 (128 – 127) = -1.1112 x 21 = -11.112 = -3.75.

30 of 71

PREETHI S

30

10/17/2023

31 of 71

PREETHI S

31

10/17/2023

Matlab by default uses Double Precision Floating Point Representation

32 of 71

PREETHI S

32

10/17/2023

33 of 71

PREETHI S

33

10/17/2023

Two operations : Series of Additions and multiplications

34 of 71

PREETHI S

34

10/17/2023

Overflow

.1001

.1001

+

= 0.0010

Fixed point :

Floating point :

35 of 71

PREETHI S

35

10/17/2023

Truncation

.1001

.1001

*

= .01010001

b * b = 2b

To represent 256 : 8 bit is required

.01010001

36 of 71

PREETHI S

36

10/17/2023

Rounding

.01010001

if 1’s follows aft nth and Anywhere else position: Round up

if 0’s follows immediately aft nth position: Round down

if All 0’s aft nth position: ties to even

.0100

37 of 71

PREETHI S

37

10/17/2023

For this case truncation

Gives Minimum Error

.1001

.1001

*

= .01010001

b * b = 2b

.01010001

.0100

38 of 71

PREETHI S

38

10/17/2023

Mathematical

1 . (b+1) bits

2 . b1 Bits before Truncation , b bits aft truncation, So Error is

Aft truncation, magnitude is Less or equal bef truncation:

Error is maximum If discarded bits are all 1’s :

Error is Bounded by :

For a Positive Numbers:

39 of 71

PREETHI S

39

10/17/2023

Mathematical

Error is Bounded by :

.1110 = 14/16

.0001 = 1/16

40 of 71

PREETHI S

40

10/17/2023

41 of 71

PREETHI S

41

10/17/2023

Analog to Digital

42 of 71

PREETHI S

42

10/17/2023

Analog to Digital

43 of 71

PREETHI S

43

10/17/2023

Analog to Digital

(3 bit signed)

.000

.0

.001

0.125

.010

0.250

.011

0.375

.100

0.5

.101

0.625

.110

0.750

.111

0.875

44 of 71

PREETHI S

44

10/17/2023

-

Quantization

Error/ Noise

45 of 71

PREETHI S

45

10/17/2023

Quantization Noise = e(n)

46 of 71

PREETHI S

46

10/17/2023

Quantization Noise e(n) is stationary random process

Quantization Noise e(n) is Uncorrelated to x(n)

Quantization Noise e(n) PDF is Uniform

Characterize it as Random Process:

Probability density function of roundoff error

Probability density function of truncation error

47 of 71

PREETHI S

47

10/17/2023

Twos Complement Arithmetic

Truncation

Rounding

48 of 71

PREETHI S

48

10/17/2023

Quantization Noise:

For Uniform PDF:

49 of 71

PREETHI S

49

10/17/2023

Quantization Noise

Uniform PDF: Rounding

Uniform PDF: Truncation

50 of 71

PREETHI S

50

10/17/2023

Quantization Noise:

For Uniform PDF:

51 of 71

PREETHI S

51

10/17/2023

Quantization Noise

For Uniform PDF:

52 of 71

PREETHI S

52

10/17/2023

Quantization Noise

For Uniform PDF:

Increasing ‘b’ , reduces Variance!

53 of 71

PREETHI S

53

10/17/2023

Quantization Noise: SNR

Input Signal Power:

Noise Signal Power :

SNR

For every additional bit, SNR increases by 6 dB

54 of 71

PREETHI S

54

10/17/2023

55 of 71

PREETHI S

55

10/17/2023

Original Ip + Noise

56 of 71

PREETHI S

56

10/17/2023

Original ip + Noise

Similarly, The Sequence : bo, b1, b2….bN

is also quantized and stored

Co-efficient Quantization

57 of 71

PREETHI S

57

10/17/2023

Product Quantization Error:

Simple Example: 1st Order Filter

Ideal Filter

Since X(n) and e(n) are independent

58 of 71

PREETHI S

58

10/17/2023

Product Quantization Error:

Simple Example: 1st Order Filter

Ideal Filter

Since X(n) and e(n) are independent

59 of 71

PREETHI S

59

10/17/2023

Product Quantization Error:

Simple Example: 1st Order Filter

Ideal Filter

Since X(n) and e(n) are independent

60 of 71

PREETHI S

60

10/17/2023

Product Quantization Error:

Simple Example: 1st Order Filter

Modeled with a Noise Source

61 of 71

PREETHI S

61

10/17/2023

Output mean and output Noise Power

62 of 71

PREETHI S

62

10/17/2023

Output mean and output Noise Power

63 of 71

PREETHI S

63

10/17/2023

Let Impulse response of the filter:

64 of 71

PREETHI S

64

10/17/2023

A Little Complex: 4th Order Filter

We can calculate total response of the

Filter by summing individual response

For each noise source

65 of 71

PREETHI S

65

10/17/2023

Zero Input Limit Cycle

66 of 71

PREETHI S

66

10/17/2023

Zero Input Limit Cycle

67 of 71

PREETHI S

67

10/17/2023

Zero Input Limit Cycle

n

X(n)

W(n-1)

W(n)

0

7/8

0

7/8

68 of 71

PREETHI S

68

10/17/2023

Zero Input Limit Cycle

n

X(n)

W(n-1)

W(n)

0

7/8

0

7/8

1

0

7/8

4/8

69 of 71

PREETHI S

69

10/17/2023

Zero Input Limit Cycle

n

X(n)

W(n-1)

W(n)

0

7/8

0

7/8

1

0

7/8

4/8

2

0

½

¼

70 of 71

PREETHI S

70

10/17/2023

Zero Input Limit Cycle

n

X(n)

W(n-1)

W(n)

0

7/8

0

7/8

1

0

7/8

4/8

2

0

½

¼

3

0

¼

1/8

71 of 71

PREETHI S

71

10/17/2023

Zero Input Limit Cycle

n

X(n)

W(n-1)

W(n)

0

7/8

0

7/8

1

0

7/8

4/8

2

0

½

¼

3

0

¼

1/8

4

0

1/8

1/8

5

0

1/8

1/8