Forum Discussion
Altera_Forum
Honored Contributor
17 years agoHow to use altfp_sqrt with the Nios II?
Hi, for the reason of data processing I need the NiosII to calculate a floating point square root many times. The calculation without extra hardware block is to slow to meet the timing requirement...
Altera_Forum
Honored Contributor
16 years agoIf you want the square root integrated into the software compilation so that calls to sqrtf() map directly into the hardware you can use something similar to this: http://www.nioswiki.com/custom_floating_point_unit
The compile flag for that is "-mcustom-fsqrts=<x>" where "<x>" is the custom instruction number you map to the processor. This solution only makes sense if you are using square root all over the place in your code. If you are working on vector data you would be better off placing all the inputs for the square root into a buffer, DMAing them through a square root hardware accelerator, and writing the contents back to memory.