IQmath
All “IQmath” operations have an equivalent floating-point operation
IQmath
IQmath
Approach
Approach
Targeting Fixed
Targeting Fixed
-
-
Point or Floating
Point or Floating
-
-
Point device
Point device
Compile & Run
using floating-point math on
C3x, C67x,C28x (RTS), PC,..
Compile & Run
using “IQmath” on
C28x
User selects target math type
(in “IQmathLib.h” file)
Y = _IQmpy(M, X) + B;
#if MATH_TYPE == IQ_MATH #if MATH_TYPE == FLOAT_MATH
Y = (float)M * (float)X + (float)B;
Selecting FLOAT_MATH Or IQ_MATH Mode: As was highlighted in the introduction, we
would ideally like to be able to have a single source code that can execute on a floating-point or
fixed-point target device simply by recompiling the code. The "IQmath" library supports this by
setting a mode, which selects either IQ_MATH or FLOAT_MATH. This operation is performed
by simply redefining the function in a header file. For example:
#if MATH_TYPE == IQ_MATH
#define _IQmpy(M , X) _IQmpy(M , X)
#elseif MATH_TYPE == FLOAT_MATH
#define _IQmpy(M , X) (float) M * (float) X
#endif
Essentially, the programmer writes the code using the "IQmath" library functions and the code
can be compiled for floating-point or "IQmath" operations.
C28x - Numerical Concepts & IQmath 8 - 23