Digital Signal Processing
Finite Word length Effects
PREETHI S
1
10/17/2023
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
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?
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?
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
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:
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:
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:
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
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
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
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 |
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 |
PREETHI S
14
10/17/2023
PREETHI S
15
10/17/2023
How many bits are required to represent :
PREETHI S
16
10/17/2023
How many bits are required to represent :
Answer : 0.0 0011 0011 0011 0011 0011 0011 …….
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 …….
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
PREETHI S
19
10/17/2023
0.000,001
0.000,000,000,1
= 1 * 10 -6
= 1 * 10-10
PREETHI S
20
10/17/2023
0.000,001
= 1 * 10 -6
0.000,000,000,1
= 1 * 10-10
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
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
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
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
PREETHI S
25
10/17/2023
Floating Point Representation: Why we need it?
Assume : M = 2, E = 2, totally 4 bits
size
size
Fixed point
PREETHI S
26
10/17/2023
Floating Point Representation: Why we need it?
Assume : M = 2, E = 2, totally 4 bits
size
size
Fixed point
Calculate for 8 bits: M =4 , E = 4
PREETHI S
27
10/17/2023
Floating Point Representation: Why we need it?
Assume : M = 2, E = 2, totally 4 bits
size
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
PREETHI S
28
10/17/2023
Floating Point Representation: Why we need it?
It Provides Very High Dynamic Range
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.
PREETHI S
30
10/17/2023
PREETHI S
31
10/17/2023
Matlab by default uses Double Precision Floating Point Representation
PREETHI S
32
10/17/2023
PREETHI S
33
10/17/2023
Two operations : Series of Additions and multiplications
PREETHI S
34
10/17/2023
Overflow
.1001
.1001
+
= 0.0010
Fixed point :
Floating point :
PREETHI S
35
10/17/2023
Truncation
.1001
.1001
*
= .01010001
b * b = 2b
To represent 256 : 8 bit is required
.01010001
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
PREETHI S
37
10/17/2023
For this case truncation
Gives Minimum Error
.1001
.1001
*
= .01010001
b * b = 2b
.01010001
.0100
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:
PREETHI S
39
10/17/2023
Mathematical
Error is Bounded by :
.1110 = 14/16
.0001 = 1/16
PREETHI S
40
10/17/2023
PREETHI S
41
10/17/2023
Analog to Digital
PREETHI S
42
10/17/2023
Analog to Digital
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 |
PREETHI S
44
10/17/2023
-
Quantization
Error/ Noise
PREETHI S
45
10/17/2023
Quantization Noise = e(n)
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
PREETHI S
47
10/17/2023
Twos Complement Arithmetic
Truncation
Rounding
PREETHI S
48
10/17/2023
Quantization Noise:
For Uniform PDF:
PREETHI S
49
10/17/2023
Quantization Noise
Uniform PDF: Rounding
Uniform PDF: Truncation
PREETHI S
50
10/17/2023
Quantization Noise:
For Uniform PDF:
PREETHI S
51
10/17/2023
Quantization Noise
For Uniform PDF:
PREETHI S
52
10/17/2023
Quantization Noise
For Uniform PDF:
Increasing ‘b’ , reduces Variance!
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
PREETHI S
54
10/17/2023
PREETHI S
55
10/17/2023
Original Ip + Noise
PREETHI S
56
10/17/2023
Original ip + Noise
Similarly, The Sequence : bo, b1, b2….bN
is also quantized and stored
Co-efficient Quantization
PREETHI S
57
10/17/2023
Product Quantization Error:
Simple Example: 1st Order Filter
Ideal Filter
Since X(n) and e(n) are independent
PREETHI S
58
10/17/2023
Product Quantization Error:
Simple Example: 1st Order Filter
Ideal Filter
Since X(n) and e(n) are independent
PREETHI S
59
10/17/2023
Product Quantization Error:
Simple Example: 1st Order Filter
Ideal Filter
Since X(n) and e(n) are independent
PREETHI S
60
10/17/2023
Product Quantization Error:
Simple Example: 1st Order Filter
Modeled with a Noise Source
PREETHI S
61
10/17/2023
Output mean and output Noise Power
PREETHI S
62
10/17/2023
Output mean and output Noise Power
PREETHI S
63
10/17/2023
Let Impulse response of the filter:
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
PREETHI S
65
10/17/2023
Zero Input Limit Cycle
PREETHI S
66
10/17/2023
Zero Input Limit Cycle
PREETHI S
67
10/17/2023
Zero Input Limit Cycle
n | X(n) | W(n-1) | W(n) |
0 | 7/8 | 0 | 7/8 |
| | | |
| | | |
| | | |
| | | |
| | | |
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 |
| | | |
| | | |
| | | |
| | | |
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 | ½ | ¼ |
| | | |
| | | |
| | | |
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 |
| | | |
| | | |
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 |