Forum Discussion
Altera_Forum
Honored Contributor
15 years agoAnother way is to directly use the math libraries that your HDL supports. Usually this already comes with Quartus. For example, in VHDL you could simply add the math_real library, and call arctan(). Probably the Cordic method provides better/faster results, but I guess this is the simplest way if you just want to add an arctan function.
use ieee.math_real.all;
...
variable x:real:=0.0;
variable n:integer:=0;
...
/* some manipulation on x */
...
n:=integer(arctan(x));