next up previous contents index
Next: .if, .elif, .else, and Up: Parameters and Expressions Previous: Single-Quoted Expressions   Contents   Index


.param Line

General Form:
.param name = value [name = value] ...
Example:
.param p1 = 1.23 p2 = '2.5*p1'

This assigns the text value to the text token name. If the text string name, delimited by space or one of ,)([]='" but not with `=' to the right is found in the text, it is replaced by its value. The `%' concatenation character is recognized. The concatenation character is used to separate the token from the other text: for example RES%K allows RES to be identified as a token, and if RES is `1' the substitution would yield `1K'. The name token must be surrounded by non-alphanumeric characters.

Substitutions occur on a second pass, so the order of definition and reference is not important (except when used in .if or .elif, described below). Substitutions are not performed in Verilog blocks, but are performed everywhere else. The .param lines always have global scope, meaning that they apply to the entire circuit, whether or not they are located within .subckt blocks.

Values can contain parameter references, i.e., nesting is accepted.

References to parameters outside of any .subckt definition are evaluated before variable expansion. References within .subckt definitions are evaluated after variable substitution, during subcircuit expansion. Parameters defined in a .param line are overridden by those defined in subcircuit definitions or calls in this case.

The value must be a single token, or be enclosed by single or double quotes. If double quotes are used, they are stripped when the substitution is applied. Single quotes are retained in the substitution, as single quotes have significance in delimiting an expression. Parameter substitution is performed whether or not the substitution variable in part of a single or double quoted string.

Parameters can be accessed as vectors through the syntax ``@paramname''. The value of the vector is the numerical value of the parameter-expanded value string. These vectors are read-only, i.e., parameters can not be set through vectors.


next up previous contents index
Next: .if, .elif, .else, and Up: Parameters and Expressions Previous: Single-Quoted Expressions   Contents   Index
Stephen R. Whiteley 2006-10-23