IQmath
C2000 Microcontroller Workshop - Numerical Concepts
8 - 21
IQmath Approach
Multiply Operation
Y = ((i64) M * (i64) X) >> Q + B;
_IQmpy(M,X) == ((i64) M * (i64) X) >> Q
Redefine the multiply operation as follows:
Y = _IQmpy(M,X) + B;
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 “_IQmpy” intrinsic; assembly code generated:
IQmath Approach
It looks like floating-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++
“IQmath” code is easy to read!
Содержание C2000 Piccolo LaunchPad
Страница 74: ...Interrupts 4 18 C2000 Microcontroller Workshop Reset and Interrupts ...
Страница 100: ...Lab 5 System Initialization 5 26 C2000 Microcontroller Workshop System Initialization ...
Страница 126: ...Lab 6 Analog to Digital Converter 6 26 C2000 Microcontroller Workshop Analog to Digital Converter ...
Страница 218: ...Lab 8 IQmath FIR Filter 8 42 C2000 Microcontroller Workshop Numerical Concepts ...
Страница 236: ...Lab 9 Servicing the ADC with DMA 9 18 C2000 Microcontroller Workshop Direct Memory Access Controller ...
Страница 260: ...Lab 10 CLA Floating Point FIR Filter 10 24 C2000 Microcontroller Workshop Control Law Accelerator ...
Страница 331: ...C2000 Microcontroller Workshop Appendix A Experimenter s Kit A 1 Appendix A Experimenter s Kit ...
Страница 334: ...F28069 controlCARD A 4 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 ...
Страница 336: ...F28035 controlCARD A 6 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 SW3 ...
Страница 338: ...F28335 controlCARD A 8 C2000 Microcontroller Workshop Appendix A Experimenter s Kit LD1 LD2 LD3 SW1 ...