Tool/software: Code Composer Studio
Hi TI experts,
I am working on a project with both floating point and fixed point mathematics. The fixed point part is from an old project, and I do not want to change it.
The problem I am facing at the moment is that I found that by implementing fastRTS and copying FPUTables into RAM. The floating point calculation is quite fast. However, at one point, I do need to convert floating point to fixed point, or vice versa, during the transition part between floating and fixed point code.
I find that the following 3 lines take 1000 cycles.
modgen_dq.Ta, modgen_dq.Tb, modgen_dq.Tc are IQ24, while others are float32.
modgen_dq.Ta = _IQ(2*dq_to_abc.va/Vbus_float);
modgen_dq.Tb = _IQ(2*dq_to_abc.vb/Vbus_float);
modgen_dq.Tc = _IQ(2*dq_to_abc.vc/Vbus_float);
The following, however, only takes 100 cycles.
temp1 = 2*dq_to_abc.va/Vbus_float;
temp1 = 2*dq_to_abc.vb/Vbus_float;
temp1 = 2*dq_to_abc.vc/Vbus_float;
Why it takes so long to convert from floating point to IQ? Am I doing it properly? I also copied IQmath and IQmathTables into RAM. It does not make much difference.
Thank you in advance.