IQmath
IQmath
IQmath
Approach
Approach
GLOBAL_Q simplification
GLOBAL_Q simplification
#define GLOBAL_Q 18 // set in “IQmathLib.h” file
_iq Y, M, X, B;
Y = _IQmpy(M,X) + B; // all values are in Q = 18
GLOBAL_Q
GLOBAL_Q
User selects “Global Q” value for the whole application
User selects “Global Q” value for the whole application
based on the required dynamic range or resolution, for example:
based on the required dynamic range or resolution, for example:
The user can also explicitly specify the Q value to use:
The user can also explicitly specify the Q value to use:
_iq20 Y, M, X, B;
Y = _IQ20mpy(M,X) + B; // all values are in Q = 20
0.000 000 06
0.000 000 06
-
-
128.000 000 00
128.000 000 00
127.999 999 94
127.999 999 94
24
24
0.000 001
0.000 001
-
-
2048.000 000
2048.000 000
2047.999 999
2047.999 999
20
20
0.000 000 004
0.000 000 004
-
-
8.000 000 000
8.000 000 000
7.999 999 996
7.999 999 996
28
28
Resolution
Resolution
Min Val
Min Val
Max Val
Max Val
GLOBAL_Q
GLOBAL_Q
The basic "IQmath" approach was adopted in the creation of a standard math library for the Texas
Instruments TMS320C28x DSP fixed-point processor. This processor contains efficient hardware
for performing 32x32 bit multiply, 64-bit shifts (logical and arithmetic) and 32-bit add/subtract
operations, which are ideally suited for 32 bit "IQmath".
Some enhancements were made to the basic "IQmath" approach to improve flexibility. They are:
Setting Of GLOBAL_Q Parameter Value:
Depending on the application, the amount of nu-
merical resolution or dynamic range required may vary. In the linear equation example, we used
a Q value of 24 (Q24). There is no reason why any value of Q can't be used. In the "IQmath"
library, the user can set a GLOBAL_Q parameter, with a range of 1 to 30 (Q1 to Q30). All func-
tions used in the program will use this GLOBAL_Q value. For example:
#define GLOBAL_Q 18
Y = _IQmpy(M, X) + B; // all values use GLOBAL_Q = 18
If, for some reason a particular function or equation requires a different resolution, then the user
has the option to implicitly specify the Q value for the operation. For example:
Y = _IQ23mpy(M,X) + B; // all values use Q23, including B and Y
The Q value must be consistent for all expressions in the same line of code.
8 - 22
C28x - Numerical Concepts & IQmath
Summary of Contents for C28 Series
Page 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Page 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Page 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Page 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Page 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Page 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Page 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Page 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Page 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Page 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...