Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

Custom FP sqrt function

Altera_Forum
Honored Contributor I
746 Views

Hi, 

 

The Nios compiler doesn't seem to recognize the -mcustom-fsqrts option. 

I've tried sqrt and sqrtf. 

 

I noticed on this page: 

http://www.alterawiki.com/wiki/single-precision_-mcustom-*_options 

 

that the gcc pattern name is listed as sqrtsf2 

 

but that is not the case for the libm function. 

 

Any suggestions? 

 

Thanks, 

Jonah
0 Kudos
1 Reply
Altera_Forum
Honored Contributor I
53 Views

I assume you have connected the floating point custom instruction hardware (FPH2) to the custom instruction port of the Nios? 

 

The sqrtf function is not directly inferred. You will need to explicitly include the headers into your C code. 

 

# include "altera_nios_custom_instr_floating_point_2.h" 

 

Then you can use sqrtf function normally. You should always include the headers when using the FPH2 module. Also you can check from objdump to re-confirm on the custom instructions being called.
Reply