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 15 fraction 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 31 s fraction 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 Copyright March 2000, Sally L. Wood Page 1 ELEN 033 Lecture 6 Notes TMS320C3x Extended Precision P4-7 User's Guide exp 39 s fraction 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 Exp bits Sign Fraction Bits 22-0 X*2exp 31-24 bit 23 Decimal 1 2 3 4 5 6 7 8 9 Binary 00001.000 00010.000 00011.000 00100.000 00101.000 00110.000 00111.000 01000.000 01001.000 X 00001.000 00001.000 00001.100 00001.000 00001.010 00001.100 00001.110 00001.000 00001.001 exp 0 1 1 2 2 2 2 3 3 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 0000 0000 0000 0001 0000 0001 0000 0010 0000 0010 0000 0010 0000 0010 0000 0011 0000 0011 0 0 0 0 0 0 0 0 0 000 0000 0000 0000 0000 0000 000 0000 0000 0000 0000 0000 100 0000 0000 0000 0000 0000 000 0000 0000 0000 0000 0000 010 0000 0000 0000 0000 0000 100 0000 0000 0000 0000 0000 110 0000 0000 0000 0000 0000 000 0000 0000 0000 0000 0000 001 0000 0000 0000 0000 0000 1000 0000 11111.000 11110.000 11101.000 11100.000 11011.000 11010.000 11001.000 11000.000 10111.000 11110.000 11110.000 11110.100 11110.000 11110.110 11110.100 11110.010 11110.000 11110.111 -1 0 1 1 2 2 2 2 3 Copyright March 2000, Sally L. Wood 1111 1111 0000 0000 0000 0001 0000 0001 0000 0010 0000 0010 0000 0010 0000 0010 0000 0011 Page 2 Hexadecimal 00 00 00 00 01 00 00 00 01 40 00 00 02 00 00 00 02 20 00 00 02 40 00 00 02 60 00 00 03 00 00 00 03 10 00 00 80 00 00 00 1 1 1 1 1 1 1 1 1 000 0000 0000 0000 0000 0000 000 0000 0000 0000 0000 0000 100 0000 0000 0000 0000 0000 000 0000 0000 0000 0000 0000 110 0000 0000 0000 0000 0000 100 0000 0000 0000 0000 0000 010 0000 0000 0000 0000 0000 000 0000 0000 0000 0000 0000 111 0000 0000 0000 0000 0000 ELEN 033 Lecture 6 Notes FF 80 00 00 00 80 00 00 01 C0 00 00 01 80 00 00 02 E0 00 00 02 C0 00 00 02 A0 00 00 02 80 00 00 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 themulaw codes. Xmuc=16*xmucH+xmucL. Negative values have the same magnitudes. xmucH xmucL 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 .0002 .0005 .0007 .0040 .0045 .0050 .0121 .0131 .0140 .0282 .0302 .0604 .1249 .2538 .5116 .5428 .5741 .6053 .0032 .0034 .0037 .0114 Copyright March 2000, Sally L. Wood .4882 Page 3 .9491 .9803 ELEN 033 Lecture 6 Notes