There are several built-in source functions, which are based on and extend the source specifications in SPICE2. These generally produce time-dependent output for use in transient analysis. For brevity, these functions are referred to as ``tran functions''.
The tran functions are listed in the table below. If parameters other than source amplitudes are omitted, default values will be assumed. The tran functions, which require multiple space or comma separated arguments in a particular order, are:
exp() exponential specification gauss() gaussian specification interp() interpolation specification pulse() pulse specification pwl() piecewise-linear specification sffm() single frequency fm specification sin() sinusoidal specification spulse() sinusoidal pulse specification table() reference to a .table specification
Unlike the math functions, the tran functions have variable-length argument lists. If arguments are omitted, default values are assumed. In cases of a name clash between these functions and math functions (sin, exp, gauss), the argument list is examined to determine which is correct.
The tran functions implicitly use time as an independent variable, and generally return 0 in dc analysis. Exceptions are the pwl() and interp() forms, which implicitly uses the value of ``x'' which is context-specific. In dependent sources, this is the controlling value of the source rather than time. The table() function takes its input directly from the second argument.
The tran functions can also be used in regular vector expressions. They generate a vector corresponding to the current scale, which must exist, be real, and monotonically increasing. The length of the returned vector is equal to the length of the scale.
For example:
(do a tran analysis to establish a reasonable scale)The construct can be used like any other token in a regular vector expression.
let a = pulse(0 1 10n 10n 10n 20n)
plot a (plots a pulse waveform)
The tran functions (other than table() and interp()) take constant expressions as arguments. The argument list consists of comma or space separated expressions. Arguments are parsed as follows:
There is no provision for a unary `+', thus, func(a, +b) is taken as func(a+b). Parenthesis can be added to enforce precedence. The minus sign handling implies that func(a, -b) and func(a -b) are taken as func((a), (-b)), whereas f(a-b), f(a- b), f(a - b), etc are taken as func((a)-(b)).
In addition to the built-in functions, expressions used in sources can include user defined functions, which must have been defined previously with the define command. These may be useful for encapsulating the tran functions.
Recall that a line in the deck starting with ``*@" will be executed before the deck is parsed.
title line
*@ define mypulse(delay, width) pulse(0 1 delay 1n 1n width)
v1 1 0 mypulse(5n, 10n)
r1 1 0 100
.end
The following paragraphs describe the tran functions in detail.