Jason Cortell

Fast-float (FFloat) library for 56F83xx and CW

Discussion created by Jason Cortell on Aug 1, 2007
Latest reply on Aug 2, 2007 by Pascal Irrle
Hi,
 
Last fall we found that the built-in software floating point library in CodeWarrior was too slow for our robot project, and that we couldn't make controller code changes fast enough with fixed point - too many bugs.
 
So we wrote our own floating-point package in assembly, kind of like the Fast-Float for the AD Blackfin. It isn't IEEE compliant, it has a 16-bit mantissa (fraction) and 8-bit exponent. Not as much resolution, but much faster. It is written mostly in assembly for the 56F83xx, and uses instructions not recognized by the 56F80x, so probably not compatible without significant rework.
 
Below is a list of the functions so far, and processor cycle counts. (Cycle counts were done using the CW 7 software simulator, with IEEE single float and int for comparison.)  Let me know if there is any interest. I don't know how it would be made available at this point, but if enough people want to use it I'll see what I can do. If you're from Freescale, is there any chance this could be integrated in some way with CodeWarrior? The main problem with it now is that all the operations have to be done as function calls, which gets cumbersome for complicated equations. And, constants have to be pre-converted and written in hex (although macros can help).
 

Function Name     Cycle Count       float cycle count     int cycle count

FFadd                              53                        254                           6

FFsub                              64                        264                           6

FFmult                            41                         230                          8

FFdiv                              87                         335                          40

FFsin                             1061

FFcos                            1050

FFatan                            808

FFgt                                 46                        157                          18

FFgte                               46                        141                          12

FFgtz                               22

FFlt                                 46                        164                            12

FFlte                               46                         148                           12

FFltz                               22

FFeqz                             21

S16int2FFloat                   22

FFloatRnd2S16int             29

FFloatTrunc2S16int           29

S32int2FFloat                    25

U32int2FFloat                   27

IEEE2FFloat                     50

FFloat2IEEE

FFneg                               35

FFabs                               35

Outcomes