Forum Discussion
Altera_Forum
Honored Contributor
14 years agoYou should review the real math functions provided by verilog
--- Quote Start --- Table 17-18—Verilog to C real math function cross-listing Verilog function Equivalent C function Description $ln(x) log(x) Natural logarithm $log10(x) log10(x) Decimal logarithm $exp(x) exp(x) Exponential $sqrt(x) sqrt(x) Square root $pow(x,y) pow(x,y) x**y $floor(x) floor(x) Floor $ceil(x) ceil(x) Ceiling $sin(x) sin(x) Sine $cos(x) cos(x) Cosine $tan(x) tan(x) Tangent $asin(x) asin(x) Arc-sine $acos(x) acos(x) Arc-cosine $atan(x) atan(x) Arc-tangent $atan2(x,y) atan2(x,y) Arc-tangent of x/y $hypot(x,y) hypot(x,y) sqrt(x*x+y*y) $sinh(x) sinh(x) Hyperbolic sine $cosh(x) cosh(x) Hyperbolic cosine $tanh(x) tanh(x) Hyperbolic tangent $asinh(x) asinh(x) Arc-hyperbolic sine $acosh(x) acosh(x) Arc-hyperbolic cosine $atanh(x) atanh(x) Arc-hyperbolic tangent --- Quote End ---