Forum Discussion

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

Math Function Accelerate

Hi,

Anyone knows how to accelerate the Nios Math Functions such as Sine function other than using floating point custom instruction?

Thanks,

Caridee

1 Reply

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

    For things like that I normally inspect the library code to see if it's possible to offload into hardware. I think the way newlib computes sine and cosine is through lookup tables. There are other ways but I forget the math behind them, some use the Cordic algorithm for computing sine and cosine. Also if you only need a finite number of sine results a lookup table would probably work best. So if you had this: y = sin(a); and you know that you only have a finite input range for the variable 'a' you can just turn that into a lookup table. If you are familar with FFT and other similar algorithms that's what most people use.