Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12589 Discussions

Floating-Point calculation in nios

Altera_Forum
Honored Contributor II
1,829 Views

hi everyone, 

i have read the " Using NiosII Floating-Point Custom Instructions Tutorial.pdf", it shows that use Floating-Point Custom Instructions can increase the Floating-Point calculate speed remarkably. 

but i can not find the "custom instructions" page in Qsys14.1. 

 

1. how can i enable the Floating-Point custom instructions in quartus 14.1, is there some new version documents? 

 

2. how can i know how many recources the Floating-Point custom instructions costs? 

 

 

thanks!!!
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
643 Views

1. there is a Floating point Hardware under Processors and Peripherals -> Co-Processors -> Nios II Custom Instructions -> Floating Point Hardware 2 

 

2. after the design has been fitted, the resource usage is shown under "Compilation Hierarchy" in the top left corner of main Quartus window
0 Kudos
Altera_Forum
Honored Contributor II
643 Views

hi, thanks for your reply. 

in the " Using NiosII Floating-Point Custom Instructions Tutorial.pdf", there is a table  

https://www.alteraforum.com/forum/attachment.php?attachmentid=10598  

 

 

the table shows that the nios can do lots of math, including exp log sin ... 

how these math can be done in nois?  

i find in the math.h : 

 

# ifndef _REENT_ONLY 

# ifndef __math_68881 

extern double acos _PARAMS((double)); 

extern double asin _PARAMS((double)); 

extern double atan2 _PARAMS((double, double)); 

extern double cosh _PARAMS((double)); 

extern double sinh _PARAMS((double)); 

extern double exp _PARAMS((double)); 

extern double ldexp _PARAMS((double, int)); 

extern double log _PARAMS((double)); 

extern double log10 _PARAMS((double)); 

extern double pow _PARAMS((double, double)); 

extern double sqrt _PARAMS((double)); 

extern double fmod _PARAMS((double, double)); 

 

 

but i did not find the definition of these functions.
0 Kudos
Altera_Forum
Honored Contributor II
643 Views

keep asking for help!

0 Kudos
Altera_Forum
Honored Contributor II
643 Views

The Floating Point Hardware 2 supports about 17-18 single precision floating points operations only. - add/sub/max/min/div/mul/round/.... 

 

The functions in math.h is implemented using newlib, which is the standard C library. Nios will emulate these functions in software.
0 Kudos
Reply