This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I haven't been able to find explicit benchmarks comparing FPU vs. IQMath, except for this article.
1. For a given clock speed, is FPU MIPS >= IQMath MIPS in all cases? (I'm particularly looking at the TMS320F28335 for my current project.)
So you would always use the FPU if available because it's probably faster and certainly easier to program?
2.A. I see that you should use the FPU Run-Time Support (RTS) library to call optimized functions like sincos and atan rather than use the regular function calls. But does the FPU also speedup addition and multipication of floating point numbers?
B.Is that handled automatically by the compilier and microcontroller? (So if you say "a * b" for two floating-point numbers, it will be handled by the FPU automatically?)
Andrew,
You are right, FPU is generally easier to code, however for cost reasons fixed point has been popular.
Whenever C code is compiled the run time support library ensures the functions like sin, cos, tan are implemented using the C standard however for many applications the full precisions defined by C standard may not be required, so the fast RTS may be used in these applications.
Yes if the variables are declared as float, then the compiler will use the FPU for these variables,
Andrew,
my experiences are that the same algorithm is somewhat slower when running in FPU, comparing to the algo, wrirten using IQMathLib. The system tested had a copule of running (sliding) DFTs (these were particularly affected) and a couple of PIDs. In depth comparison showed that FPU code lost cycles where some data was pased between RAM throu main CPU to FPU and vice versa, so there were a couple of cycles lost. It was not a big difference though.
If your application does not seem to have any tricky parts, and if you are not proficient using IQMathLib, I recommend using FPU, for initial development. When you have the system running it is fairly easy to switch to IQMath (for cost or device availability reasons).
If you do anticipate numerical problems IQMath is a way to go, as you always have precision and range under control, so you can quickly locate areas which will most likely give you headache (precision integrators are most common)
Note that for typical applications where you use 12 ADC and the PWM resolution is also in the same ballpark (10-16 bits). and you only have a couple of transformations and PIDs in between any math will do.
Regards, Mitja
Thanks Manish and Mitja,
after rereading the second page of the article I posted, I see now that it's not always a simple decision. If the program is pure floating point operations, then it appears you would be better off using the FPU for speed (and easier coding). But as Mitja pointed out, if the bottleneck is elsewhere then with the extra execute cycle in the FPU, the IQMath might be slightly faster.
I didn't know about the Fast RTS option either, Manish, I'll have to look into it.
Wish I could verify both your answers! (Edit: I guess I can)