The original fpoint custom instruction distributed with Nios II only supports the 4 arithmetic functions. It misses functions for compare operations (<, <=, >, >=, ==, !=) and for conversion between float and int, which eat up much cpu-time, too.
Nevertheless Altera already provides all these arithmetic functions as altfp_ megafunction-blocks. This FPU implements a wrapper to make the megafunction-blocks available as Nios II custom-instructions.
How to integrate the FPU into your project
Put the files into your project directory or somewhere into your sopc library path.
Add the FPU custom instruction to your CPU (don’t forget to remove the fpoint custom instruction!)
Move the FPU to the top position of the custom instructions: the numbers for the custom instructions below assume that the FPU has the instruction offset 0.
Add the following compiler-flags into your software project. With Quartus II 9.1 the wizard seems to be broken, so add it directly to the makefile at: APP_CFLAGS_USER_FLAGS :=
(They will show up at ‘Properties -> Nios II Application Properties -> User flags’.)