Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 116 lines (92 sloc) 3.808 kB
2a5948d @steveicarus Add va_math.txt based on the README from the va_math submission.
authored
1
2 The following is from the README.va_math that was included with the
3 initial contribution of the va_math module. I've removed the parts
4 that are obviously not applicable, i.e. how to compile the library, to
5 this bundled version of the library.
6
7 --------
8 License.
9 --------
10
11 Verilog-A math library built for Icarus Verilog
12 http://www.icarus.com/eda/verilog/
13
2eb0160 @caryr Remove obsolete VAMS $log function.
caryr authored
14 Copyright (C) 2007-2010 Cary R. (cygcary@yahoo.com)
2a5948d @steveicarus Add va_math.txt based on the README from the va_math submission.
authored
15
16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version.
20
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
25
26 You should have received a copy of the GNU General Public License along
27 with this program; if not, write to the Free Software Foundation, Inc.,
28 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29
30
31 ------------------------------------------
32 Standard Verilog-A Mathematical Functions.
33 ------------------------------------------
34
35 The va_math VPI module implements all the standard math functions provided
36 by Verilog-A as Verilog-D system functions. The names are the same except
37 like all Verilog-D system functions the name must be prefixed with a '$'.
38 For reference the functions are:
39
40 $ln(x) -- Natural logarithm
2eb0160 @caryr Remove obsolete VAMS $log function.
caryr authored
41 $log10(x) -- Decimal logarithm
2a5948d @steveicarus Add va_math.txt based on the README from the va_math submission.
authored
42 $exp(x) -- Exponential
43 $sqrt(x) -- Square root
44 $min(x,y) -- Minimum
45 $max(x,y) -- Maximum
46 $abs(x) -- Absolute value
47 $floor(x) -- Floor
48 $ceil(x) -- Ceiling
49 $pow(x,y) -- Power (x**y)
50 $sin(x) -- Sine
51 $cos(x) -- Cosine
52 $tan(x) -- Tangent
53 $asin(x) -- Arc-sine
54 $acos(x) -- Arc-cosine
55 $atan(x) -- Arc-tangent
56 $atan2(y,x) -- Arc-tangent of y/x
57 $hypot(x,y) -- Hypotenuse (sqrt(x**2 + y**2))
58 $sinh(x) -- Hyperbolic sine
59 $cosh(x) -- Hyperbolic cosine
60 $tanh(x) -- Hyperbolic tangent
61 $asinh(x) -- Arc-hyperbolic sine
62 $acosh(x) -- Arc-hyperbolic cosine
63 $atanh(x) -- Arc-hyperbolic tangent
64
65 The only limit placed on the x and y arguments by the library is that they
66 must be numbers (not constant strings). The underlying C library controls
67 any other limits placed on the arguments. Most libraries return +-Inf or
68 NaN for results that cannot be represented with real numbers. All functions
69 return a real result.
70
71
72 ------------------------------------------
73 Standard Verilog-A Mathematical Constants.
74 ------------------------------------------
75
76 The Verilog-A mathematical constants can be accessed by including the
77 "constants.vams" header file. It is located in the standard include
78 directory. Recent version of Icarus Verilog (0.9.devel) automatically
79 add this directory to the end of the list used to find include files.
80 For reference the mathematical constants are:
81
82 `M_PI -- Pi
83 `M_TWO_PI -- 2*Pi
84 `M_PI_2 -- Pi/2
85 `M_PI_4 -- Pi/4
86 `M_1_PI -- 1/Pi
87 `M_2_PI -- 2/Pi
88 `M_2_SQRTPI -- 2/sqrt(Pi)
89 `M_E -- e
90 `M_LOG2E -- log base 2 of e
91 `M_LOG10E -- log base 10 of e
92 `M_LN2 -- log base e of 2
93 `M_LN10 -- log base e of 10
94 `M_SQRT2 -- sqrt(2)
95 `M_SQRT1_2 -- 1/sqrt(2)
96
97
98 ------------------
99 Using the Library.
100 ------------------
101
102 Just add "-m va_math" to your iverilog command line/command file and
103 `include the "constants.vams" file as needed.
104
105 ------
106 Thanks
107 ------
108
109 I would like to thank Larry Doolittle for his suggestions and
110 Stephen Williams for developing Icarus Verilog.
111
112
113 --------
114 The End.
115 --------
Something went wrong with that request. Please try again.