Other Parts Discussed in Thread: MIDAS, CONTROLSUITE, C2000WARE, TIDM-1007
Hi,
the function _IQ15div in Midas using ccs6.2 and controlsuite.
The function was working properly.
I used the same code for ccs9.2, and used c2000ware_v2xxx, however the function is not working anymore.
Here is the disassembly.
104 dffw->invout = (ffwd_int16_t) _IQ15div (dffw->num, uout);
C$L3:
083082: C242 MOVL *-SP[2], XAR6
083083: 06E1 MOVL ACC, *+XAR1[4]
083084: 7648B000 LCR $..\src_coff\IQNdiv.asm:245:334$
083086: 1EC1 MOVL *+XAR1[0], ACC
Question 1: Is the function already discontinued? Or is there a new setting in the linker file?
Then I used the following code to replace the function
#define IQ15DIV(x, y) ( (x << 15) / y )
Here is the equivalent disassembly
104 dffw->invout = (ffwd_int16_t)q15_div(dffw->num, uout);
C$L3:
083080: C242 MOVL *-SP[2], XAR6
083081: 06E4 MOVL ACC, *+XAR4[4]
083082: FF3E LSL ACC, 15
083083: 00C83198 FFC XAR7, L$$DIV
083085: 1EC4 MOVL *+XAR4[0], ACC
The new function provides correct computation.
Question 2: Do you see any issue with this code?
Question 3: Is there a better way to implement _IQ15div operation?
Regards,
Kien