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

Cortex M4 FPU against fixed point math

Note: This was originally posted on 1st March 2012 at http://forums.arm.com

Hi,
I'm working on 3 cortex, a STM32F027, cortex M3, a TI Cortex M4 and an Infineon Cortex M4.
I would like to move from a TI C2000 TMS320F2810 (fixed point 32bit core) to an M4 to control a 3 phase power bridge.
My algorithms nowadays work in fixed point math, IQ22, and are based for 98% on simple multiplications and some sine/cosine calculations: PI, PID, Pll, low pass filter, notch, ..
I ported the algorithm in the cortex mainly redifining the IQmpy, moltiplication, and the IQsin, sine calculation first in fixed point then in floating point.
I was expencitng to have a speed improvment running in floating because every multiplication in fixed math requires a shift while in floating I don't need the shift but I'm exeriencing a dramatic slow down of the algorithm running in floating point.
I'm doing my test in IAR.
I checked the assembler and I verified the compiler is using the floating point.
My only explenation is that the FPU doesn't have, as far as I know, direct access to the CPU registers so every multiplication in FPU requires 2 loads to the FPU registers and another load to move the result to the CPU register.
Is there anybody that can confirm me that?
Thank you very much
michele
Parents
  • Note: This was originally posted on 1st March 2012 at http://forums.arm.com

    dear joseph,
    I'll post a couple of example with the assembler.
    In my case I'm completely switching all my code from IQ22 to float and I verified it is using the floating point.
    Let's me make a "simple" question: is it true that the FPU doesn't have direct access to the core registers so to perform an operation in the FPU I have to load the data from the CPU registers to the FPU and back?
    I check the manual but I'm not sure if I understood right: in the assembler it seems to me to see some load operations.
    Thank you very much for your help
    michele
Reply
  • Note: This was originally posted on 1st March 2012 at http://forums.arm.com

    dear joseph,
    I'll post a couple of example with the assembler.
    In my case I'm completely switching all my code from IQ22 to float and I verified it is using the floating point.
    Let's me make a "simple" question: is it true that the FPU doesn't have direct access to the core registers so to perform an operation in the FPU I have to load the data from the CPU registers to the FPU and back?
    I check the manual but I'm not sure if I understood right: in the assembler it seems to me to see some load operations.
    Thank you very much for your help
    michele
Children
No data