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

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.

Reply
  • 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.

Children