.FUNC name ( [arglist] ) { body }
name Name of function. Must begin with a letter and not match one of the built in functions.
arglist List of comma separated argument names. May be empty in which case the function may be called without the parentheses. This is useful for creating random variables for Monte Carlo analysis.
body Body of function. This is an expression referring to the names in arglist that defines the operation performed by the function
.FUNC defines a function that can be used in a model or device parameter expression, a parameter defined using .PARAM or in an arbitrary source expression.

In this topic:


.FUNC FREQ(V) { (V)*120K }
.FUNC RV1() { GAUSS(0.1) }
The third example may be called without parentheses as it has no arguments. E.g.:
.PARAM random1 = rv1 random2 = rv1

In the above, random1 and random2 will have different values when run in a Monte Carlo analysis.


Any expression that uses a function defined with .FUNC will be automatically processed by an optimisation algorithm. For more information see Optimisation.

The optimiser attempts to speed simulations by making the expression evaluation more efficient. The optimiser is effective when .FUNC is used to create very complex expressions perhaps to develop a semiconductor device. In simple applications it may not make a noticeable improvement to performance. The optimiser can be enabled for all expressions and can also be disabled completely. To enable for all expressions use:

.OPTIONS optimise=2
To disable:
.OPTIONS optimise=0