IQmath
IQmath
IQmath
Approach
Approach
Multiply Operation
Multiply Operation
Y = ((i64) M * (i64) X) >> Q + B;
_IQmpy(M,X) == ((i64) M * (i64) X) >> Q
Redefine the multiply operation as follows:
Redefine the multiply operation as follows:
Y = _IQmpy(M,X) + B;
This simplifies the equation as follows:
This simplifies the equation as follows:
MOVL XT,@M
IMPYL P,XT,@X ; P = low 32-bits of M*X
QMPYL ACC,XT,@X ; ACC = high 32-bits of M*X
LSL64 ACC:P,#(32-Q) ; ACC = ACC:P << 32-Q
; (same as P = ACC:P >> Q)
ADDL ACC,@B ; Add B
MOVL @Y,ACC ; Result = Y = _IQmpy(M*X) + B
; 7 Cycles
C28x compiler supports “_
C28x compiler supports “_
IQmpy
IQmpy
” intrinsic; assembly code generated:
” intrinsic; assembly code generated:
IQmath
IQmath
Approach
Approach
It looks like floating
It looks like floating
-
-
point!
point!
float Y, M, X, B;
Y = M * X + B;
Floating-Point
long Y, M, X, B;
Y = ((i64) M * (i64) X + (i64) B << Q)) >> Q;
Traditional
Fix-Point Q
_iq Y, M, X, B;
Y = _IQmpy(M, X) + B;
“IQmath”
In C
iq Y, M, X, B;
Y = M * X + B;
“IQmath”
In C++
Taking advantage of operator overloading feature in C++,
Taking advantage of operator overloading feature in C++,
“
“
IQmath
IQmath
” looks like floating
” looks like floating
-
-
point math (looks natural!)
point math (looks natural!)
C28x - Numerical Concepts & IQmath
8 - 21
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 ...