Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Floating-Point calculation in nios

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!!!

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.