Have you tried using floating point log() in FlexC, compiling and looking at the disassembly? IIRC, FlexC uses the CORDIC unit for floating point math, at least QMUL, QDIV and SQRT. I haven't tested exp() and log(), so far.
No need to look at the disassembly, the source code for __builtin_log2f and __builtin_exp2f are in the FlexProp include/libsys/powers.c file. They're not highly optimized, but I think they work OK.
@bob_g4bby said:
Has anyone come up with a slick way of converting QLOG's fixed point result to SPIN2 floating point format?
You can convert QLOG’s fixed-point output to SPIN2 floating point by using the built-in FlexProp C functions __builtin_log2f and __builtin_exp2f. They handle the math in floating point and can serve directly in SPIN2 via inline C or compiled functions. Alternatively, implementing a simple scaling from Q format to float before applying log() in Spin2 also works.
Comments
Have you tried using floating point log() in FlexC, compiling and looking at the disassembly? IIRC, FlexC uses the CORDIC unit for floating point math, at least QMUL, QDIV and SQRT. I haven't tested exp() and log(), so far.
No need to look at the disassembly, the source code for __builtin_log2f and __builtin_exp2f are in the FlexProp include/libsys/powers.c file. They're not highly optimized, but I think they work OK.
You can convert QLOG’s fixed-point output to SPIN2 floating point by using the built-in FlexProp C functions __builtin_log2f and __builtin_exp2f. They handle the math in floating point and can serve directly in SPIN2 via inline C or compiled functions. Alternatively, implementing a simple scaling from Q format to float before applying log() in Spin2 also works.