The .param directive allows the creation of userdefined variables. This is useful for associating a name with a value for the sake of clarity and parameterizing subcircuits so that abstract circuits can be saved in libraries.
The .param statement can be included inside a subcircuit definition to limit the scope the parameter value to that subcircuit.
To invoke parameter substitution and expression evaluation, enclose the expression in curly braces. The enclosed expression will be replaced with the floatingpoint value.
Below is a example using both a .param statement and directly passing parameters on the subcircuit invocation line.
*
* This is the circuit definition
.params x=y y=z z=1k*tan(pi/4+.1)
X1 a b 0 divider top=x bot=z
V1 a 0 pulse(0 1 0 .5µ .5µ 0 1µ)
* this is the definition of the subcircuit
.subckt divider n1 n2 n3
r1 n1 n2 {top}
r2 n2 n3 {bot}
.ends
*
.tran 3µ
.end
The parameter substitution scheme is a symbolic declarative language. The parameters are not passed to the subcircuit as evaluated values, but by the expressions and relations themselves. When curly braces are encountered, the enclosed expression is evaluated on the basis of all relations available at the scope and reduced to a floating point value.
The following functions and operations are available:
Function Name 
Description 
abs(x) 
Absolute value of x 
acos(x) 
Real part of the arc cosine of x, e.g., acos(5) returns 3.14159, not 3.14159+2.29243i 
arccos(x) 
Synonym for acos() 
acosh(x) 
Real part of the arc hyperbolic cosine of x, e.g., acosh(.5) returns 0, not 1.0472i 
asin(x) 
Real part of the arc sine of x, e.g., asin(5) returns 1.57080, not 1.57080+2.29243i 
arcsin(x) 
Synonym for asin() 
asinh(x) 
Arc hyperbolic sine 
atan(x) 
Arc tangent of x 
arctan(x) 
Synonym for atan() 
atan2(y, x) 
Four quadrant arc tangent of y/x 
atanh(x) 
Arc hyperbolic tangent 
buf(x) 
1 if x > .5, else 0 
cbrt(x) 
Cube root of (x) 
ceil(x) 
Integer equal or greater than x 
cos(x) 
Cosine of x 
cosh(x) 
Hyperbolic cosine of x 
exp(x) 
e to the x 
fabs(x) 
Same as abs(x) 
flat(x) 
Random number between −x and x with uniform distribution 
floor(x) 
Integer equal to or less than x 
gauss(x) 
Random number from Gaussian distribution with sigma of x. 
hypot(x,y) 
sqrt(x**2 + y**2) 
if(x,y,z) 
If x > .5, then y else z 
int(x) 
Convert x to integer 
inv(x) 
0. if x > .5, else 1. 
limit(x,y,z) 
Intermediate value of x, y, and z 
ln(x) 
Natural logarithm of x 
log(x) 
Alternate syntax for ln() 
log10(x) 
Base 10 logarithm 
max(x,y) 
The greater of x or y 
mc(x,y) 
A random number between x*(1+y) and x*(1y) with uniform distribution. 
min(x,y) 
The smaller of x or y 
pow(x,y) 
Real part of x**y, e.g., pow(.5,1.5) returns 0., not 0.353553i 
pwr(x,y) 
abs(x)**y 
pwrs(x,y) 
sgn(x)*abs(x)**y 
rand(x) 
Random number between 0 and 1 depending on the integer value of x. 
random(x) 
Similar to rand(), but smoothly transitions between values. 
round(x) 
Nearest integer to x 
sgn(x) 
Sign of x 
sin(x) 
Sine of x 
sinh(x) 
Hyperbolic sine of x 
sqrt(x) 
Real part of the square root of x, e.g., sqrt(1) returns 0, not 0.707107i 
table(x,a,b,c,d,...) 
Interpolate a value for x based on a look up table given as a set of pairs of points. 
tan(x) 
Tangent of x. 
tanh(x) 
Hyperbolic tangent of x 
u(x) 
Unit step, i.e., 1 if x > 0., else 0. 
uramp(x) 
x if x > 0., else 0. 
The following operations are grouped in reverse order of precedence of evaluation:
Operand 
Description 
& 
Convert the expressions to either side to Boolean, then AND. 
 
Convert the expressions to either side to Boolean, then OR. 
^ 
Convert the expressions to either side to Boolean, then XOR. 


> 
True if expression on the left is greater than the expression on the right, otherwise false. 
< 
True if expression on the left is less than the expression on the right, otherwise false. 
>= 
True if expression on the left is less than or equal the expression on the right, otherwise false. 
<= 
True if expression on the left is greater than or equal the expression on the right, otherwise false. 


+ 
Floating point addition 
 
Floating point subtraction 


* 
Floating point multiplication 
/ 
Floating point division 


** 
Raise left hand side to power of right hand side, only real part is returned, e.g., 2**1.5 returns zero, not 2.82843i 
All parameter substitution evaluation is done before the simulation begins.