On Cortex-M4F microcontrollers: is fixed point math faster or floating point?

Hi,

I am using S32K14x controllers (Coretx-M4F). It has floating point math unit. I need to perform many mathematical operations as fast as possible. Which will be faster: fixed point q16 or fixed point q32 or single precision (32 bit) floating point?

Regards,

Pramod

Parents
  • Update:

    Tried to perform MAC on q31 and float32 numbers. Used DSP instruction for q31 and FPU instruction for float32 numbers. Used gcc with highest optimization (-O3). The statement

    __SMMLA(a, x, y); // equivalent to a += (x * y);

    requires 9 clock cycles to execute, where a, x and y are local q31 variables.

    Equivalent statement for floating point variables

    f32Var1 += (f32Var2 * f32Var3);

    requires 10 clock cycles to execute, where f32Var1, f32Var2 and f32Var3 are local float variables.

    So fixed point math (using the DSP instructions) is faster than floating point math (using FPU). But the difference is marginal.

  • fixed point math (using the DSP instructions) is faster than floating point math (using FPU). But the difference is marginal

    thanks for the feedback.

    An issue often noted with fixed point is that, aside from the actual calculations, it adds overhead & complexity to the code which needs to supply the input data and/or use the results. So I guess one would need a wider benchmark to see if that tips the balance for the overall system ... ?

    #FloatingVsFixedPoint

  • An issue often noted with fixed point is that, aside from the actual calculations, it adds overhead & complexity to the code which needs to supply the input data and/or use the results.

    I agree.

    Another problem in using fixed point is that code won't be portable due to the use of non-standard intrinsic functions like __SMMLA etc.

    One problem in using float is that it will increase ISR entry and exit times, due to the need of saving and restoring FPU registers.

Reply
  • An issue often noted with fixed point is that, aside from the actual calculations, it adds overhead & complexity to the code which needs to supply the input data and/or use the results.

    I agree.

    Another problem in using fixed point is that code won't be portable due to the use of non-standard intrinsic functions like __SMMLA etc.

    One problem in using float is that it will increase ISR entry and exit times, due to the need of saving and restoring FPU registers.

Children
More questions in this forum