7
Built-In Mathematical Functions
This chapter describes the mathematical functions provided by the Cadence® Verilog®-AMS language. These functions include
- Standard Mathematical Functions
- Trigonometric and Hyperbolic Functions
- Controlling How Math Domain Errors Are Handled
Because the simulator uses differentiation to evaluate expressions, Cadence recommends that you use only mathematical expressions that are continuously differentiable. To prevent run-time domain errors, make sure that each argument is within a function’s domain.
Standard Mathematical Functions
These are the standard mathematical functions supported by Verilog-AMS. The operands must be integers or real numbers.
| Function | Description | Domain | Returned Value |
|---|---|---|---|
|
Exponential. See also “Limited Exponential Function”. |
|||
Trigonometric and Hyperbolic Functions
These are the trigonometric and hyperbolic functions supported by Verilog-AMS. The operands must be integers or real numbers. The simulator converts operands to real numbers if necessary.
The trigonometric and hyperbolic functions require operands specified in radians.
| Function | Description | Domain |
|---|---|---|
Controlling How Math Domain Errors Are Handled
To control how math domain errors are handled in Verilog-A modules, you can use the options ahdldomainerror parameter in a Spectre control file. (In Verilog-AMS code, this parameter can be used only in the analog block.) This parameter controls how domain (out-of-range) errors in Verilog-A math functions such as log or atan are handled and determines what kind of message is issued when a domain error is found.
The ahdldomainerror parameter format is
Name options ahdldomainerror=value
where the syntax items are defined as follows.
For example, you might have the following in a Spectre control file to ensure that simulation stops when a domain error occurs.
myoption options ahdldomainerror=error
Return to top