next up previous contents index
Next: Set and Let Up: Plots, Vectors and Expressions Previous: HSPICE Compatibility Functions   Contents   Index


Expression Lists

Some commands, such as print and plot, take expression lists as arguments. In the simplest form, an expression list is a space-separated list of vectors. In the general form, an expression list is a sequence of expressions involving vectors. The parsing is context dependent, i.e., white space does not necessarily terminate an expression. This leads to ambiguities. For example, the command

plot v(2) -v(3)
can be interpreted as two vectors, or as a single vector representing the difference. WRspice will assume the latter.

There are several ways to ensure that the former interpretation prevails. Double quotes may be used to separate the tokens, but white space must precede the leading quote mark:

plot v(2) "-v(3)"
Parentheses can also be used to enforce precedence, with white space ahead of the opening paren, as:
plot v(2) (-v(3))
In addition, the expression termination character, a semicolon, can be used. This must be hidden from the shell, for example with a backslash:
plot v(2) \ ; -v(3)

There are situations where the name of a vector is so strange that it can't be accessed in the usual way. For example, if a list-type special variable is saved with the save command, the plot may contain a vector with a name like ``@b1[ic,0]''. To access this vector, one can't simply type the name, since the name is an expression which will actually lead to an evaluation error. One has to fool the expression parser into taking the name as a string. This will happen if the name is not the lead in a token and the name is double quoted. If the name is the leading part of a token, it should be backslash-double-double quoted.

To use the double quotes to enforce string interpretation, one should have, for example,

plot v(2) \ ""@b1[ic,0]" \ "
The extra set of quotes is needed only if the string is at the start of a token, thus
plot 2*"@b1[ic,0]"
is ok. This may be a bit confusing, but this feature is seldom used, and a bit of experimentation will illustrate the behavior.

These commands can accept the plotname.vecname notation, where either field may be the wildcard ``all''. If the plotname is all, matching vectors from all plots are specified, and if the vector name is all, all vectors in the specified plots are referenced. The constants plot is never matched by a plot wildcard. Note that you may not use binary operations on expressions involving wildcards - it is not obvious what ``all + all'' should denote, for instance.


next up previous contents index
Next: Set and Let Up: Plots, Vectors and Expressions Previous: HSPICE Compatibility Functions   Contents   Index
Stephen R. Whiteley 2017-10-02