Forum Discussion
Altera_Forum
Honored Contributor
15 years agoMath functions (sine & cosine) latency
Can anyone provide the data about the latency for sine and cosine single precision functions from math.h lib on Cyclone III, possibly Cyclone II, with floating point hardware acceleration (hardware d...
Altera_Forum
Honored Contributor
15 years agoI think i found the same problem as you, however, i've found a workaround.
I am using the NIOS II/f core with custom floating point instructions (with also, hardware divide support) and Quartus/NIOSII EDS 10.0 in linux What i've found is that the linker always uses a generic library libm.a file (for cosf, sinf et al.), no matter what kind of hardware implementation you have. So what i made was to change the generic libm.a contained in altera/10.0/nios2eds/bin/gnu/H-i686-pc-linux-gnu/nios2-elf/lib file with the libm.a contained at altera/10.0/nios2eds/bin/nios2-gnutools/H-i686-pc-linux-gnu/nios2-elf/lib/mcustom-fpu-cfg=60-2 This has made that a system that was operating at 200Hz jumped to 1100 Hz , so the gain in performance is considerable. You can always check the objdump to see in the assembler code generated if the code is calling mulsf3 or custom instructions.....