FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
6118 Discussions

Nios Floating Point Hardware 2 and ROM usage.

Honored Contributor II



I am trying to use the Nios Custom Instruction Floating Point Hardware 2 module, and I am targeting a MAX 10 device. 

The MAX 10 allows you to use a large portion of the flash as User Flash Memory if you disable memory initialization. Conversely, if you have memory initialization enabled, it only allows you to use 32KB. 

The Floating Point Hardware 2 module requires three ROM tables for the square root operation, which obviously needs initializing. 


I am contemplating modifying the FP module to comment out the square root feature. 

I am wondering how can I make sure that this change is propagated to the Nios tools, so that they know to do square root in software? 


Many thanks!
0 Kudos
3 Replies
Honored Contributor II

One might ask why sqrt() uses any tables at all - especially if division isn't also using lookup tables. 

If you are generating 1 bit per clock sqrt and divide are very much the same algorythm. 


The C compiler used to have separate command line parameters telling it the custom opcodes for each FP operation. 

Even if it doesn't rebuilding gcc with the sqrt() instruction support removed shouldn'y be hard.
Honored Contributor II

I managed to disable the use of the custom instruction for square root by undefining the square root macro defined by the FP custom instruction header. 


# include "altera_nios_custom_instr_floating_point_2.h" # undef sqrtf
Honored Contributor II

Can I ask how did you know that the module required ROM tables - did you get an error from Quartus when compiling without RAM pre intialisation? 

What did it say? 


I'm wondering if other IP modules might need ROM tables and hence how we see/detect that in a Max 10 build. 

I'm sure some of the DSP IP uses ROM tables.....