ELEN 33 Introduction to Digital Signal Processing Systems

Lecture 6: Floating Point Notes for TI formats 10 April 2000

Floating Point Representation

Values are written in scientific notation and saved as two numbers. One is the exponent. The other is the magnitude and associated sign of the number.

Normalization to guarantee uniqueness

3.25*104=32.5*103=325000*10-1=0.00325*107

Increase dynamic range

Companding=Compressing and expanding

Use small amplitude steps for low amplitude and larger steps for high amplitude.

Floating Point Formats for TMS320C31:

TMS320C3x - Short
Internal
P4-5 User's Guide
exp / s fraction
15 / 11 / 10 0
The exponent is 4 bit 2's complement.
The mantissa is 12 bit 2's complement with an implied most significant nonsign bit. The implied binary point is between bits 11 and 10. The value is:
0 if e=-8
01.f x 2e if s=0
10.f x 2e if s=1
TMS320C3x - Single Precision
P4-6 User's Guide
exp / s fraction
31 24 / 23 22 / 0
The exponent is 8 bit 2's complement.
The mantissa is 24 bit 2's complement with an implied most significant nonsign bit. The implied binary point is between bits 23 and 22. The value is:
0 if e=-128
01.f x 2e if s=0
10.f x 2e if s=1
TMS320C3x - Extended Precision
P4-7 User's Guide
exp / s fraction
39 32 / 31 30 / 0
The exponent is 8 bit 2's complement.
The mantissa is 32 bit 2's complement with an implied most significant nonsign bit. The implied binary point is between bits 31 and 30. The value is:
0 if e=-128
01.f x 2e if s=0
10.f x 2e if s=1

Examples of 32 bit single precision

Normalized
X*2exp / Exp bits
31-24 / Sign
bit 23 / Fraction Bits 22-0 / Hexadecimal
Decimal / Binary / X / exp
1 / 00001.000 / 00001.000 / 0 / 0000 0000 / 0 / 000 0000 0000 0000 0000 0000 / 00 00 00 00
2 / 00010.000 / 00001.000 / 1 / 0000 0001 / 0 / 000 0000 0000 0000 0000 0000 / 01 00 00 00
3 / 00011.000 / 00001.100 / 1 / 0000 0001 / 0 / 100 0000 0000 0000 0000 0000 / 01 40 00 00
4 / 00100.000 / 00001.000 / 2 / 0000 0010 / 0 / 000 0000 0000 0000 0000 0000 / 02 00 00 00
5 / 00101.000 / 00001.010 / 2 / 0000 0010 / 0 / 010 0000 0000 0000 0000 0000 / 02 20 00 00
6 / 00110.000 / 00001.100 / 2 / 0000 0010 / 0 / 100 0000 0000 0000 0000 0000 / 02 40 00 00
7 / 00111.000 / 00001.110 / 2 / 0000 0010 / 0 / 110 0000 0000 0000 0000 0000 / 02 60 00 00
8 / 01000.000 / 00001.000 / 3 / 0000 0011 / 0 / 000 0000 0000 0000 0000 0000 / 03 00 00 00
9 / 01001.000 / 00001.001 / 3 / 0000 0011 / 0 / 001 0000 0000 0000 0000 0000 / 03 10 00 00
0 / 1000 0000 / 80 00 00 00
-1 / 11111.000 / 11110.000 / -1 / 1111 1111 / 1 / 000 0000 0000 0000 0000 0000 / FF 80 00 00
-2 / 11110.000 / 11110.000 / 0 / 0000 0000 / 1 / 000 0000 0000 0000 0000 0000 / 00 80 00 00
-3 / 11101.000 / 11110.100 / 1 / 0000 0001 / 1 / 100 0000 0000 0000 0000 0000 / 01 C0 00 00
-4 / 11100.000 / 11110.000 / 1 / 0000 0001 / 1 / 000 0000 0000 0000 0000 0000 / 01 80 00 00
-5 / 11011.000 / 11110.110 / 2 / 0000 0010 / 1 / 110 0000 0000 0000 0000 0000 / 02 E0 00 00
-6 / 11010.000 / 11110.100 / 2 / 0000 0010 / 1 / 100 0000 0000 0000 0000 0000 / 02 C0 00 00
-7 / 11001.000 / 11110.010 / 2 / 0000 0010 / 1 / 010 0000 0000 0000 0000 0000 / 02 A0 00 00
-8 / 11000.000 / 11110.000 / 2 / 0000 0010 / 1 / 000 0000 0000 0000 0000 0000 / 02 80 00 00
-9 / 10111.000 / 11110.111 / 3 / 0000 0011 / 1 / 111 0000 0000 0000 0000 0000 / 03 F0 00 00

mu-law and A-law:

Companding using 8 bits to represent values in a manner similar to floating point formats described above. Input values over the range -1 to 1are mapped to 8-bit values with a step size of approximately 0.00025 at the lowest amplitude and a step size of approximately 0.032 at the largest amplitude. There is an algorithm that converts from linear to mu law encoding, and there is a Matlab function that will implement this. This representation is not suitable for computation because it uses so few bits, but it is appropriate for increasing the dynamic range of an audio signal using only 8 bits.

The most significant bit of the mu-law representation is the sign bit, and the exponent is 3 bits. The representation looks more like the other formats if it is bitwise complemented.

xmu=0:255;

xlin=mu2lin(xmu);

xmuc=255-xmu;

The table shows positive values (for the MSB of xmuc=0) represented by 128 of themu-law codes. Xmuc=16*xmucH+xmucL. Negative values have the same magnitudes.

xmucH / 0 / 1 / 2 / 3 / 4 / 5 / 6 / 7
xmucL
0 / .0002 / .0040 / .0121 / .0282 / .0604 / .1249 / .2538 / .5116
1 / .0005 / .0045 / .0131 / .0302 / .5428
2 / .0007 / .0050 / .0140 / .5741
3 / .6053
4
5
6
7
8
9
10
11
12
13 / .0032
14 / .0034 / .9491
15 / .0037 / .0114 / .4882 / .9803
Copyright March 2000, Sally L. Wood / Page 1 / ELEN 033 Lecture 6 Notes