This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Floating point performance on Cortex M3

Hi,

I am at the moment testing a Cortex M3 (Evaluation Board with Toshiba TMPM330). I am thinking about realising a controller on it in combination with the RTX-RL OS. This requires massive usage of filters as well as differentiation.

Usually, building this thing in university, I can simply use floating points and everything is fine. Due to the fact that the Cortex M3 only emulates floating point operations, I do wonder if this causes massive performance issues and if there are any other limitation. Using it with usually integers or similiar is not really a great alternative.

Has anyone experience and can recommend me ideas? Is it fine if I just use the floating point code, can I avoid some issues by simple adjustments or do I have to code it in fixed point.

Thank you

Christian

Parents Reply Children
  • I did a quick test for you:

    volatile int i[3] = { 1, 2, 3 };
    volatile float f[3] = ( 1, 2, 3 };
    
    int main(void)
    {
        i[0] = i[1] * i[2];
        f[0] = f[1] * f[2];
    }
    

    The integer multiplication took 7 cycles, of which 4 cycles were used to load operands and 2 cycles - to store the result. The multiplication itself is 1 cycle, in accordance with 'hardware single-cycle multiply' promise of Cortex-M3.
    The float multiplication took 47 cycles with the multiplication itself taking 41 cycles. Keep in mind that the float multiplication execution time depends on the values of operands.