next up previous contents index
Next: Batch Mode Option Variables Up: Variables Previous: String Parameters   Contents   Index

Syntax Control Variables

These variables alter the expected syntax of various types of WRspice input. It may, on occasion, be useful or necessary to use one or more of these variables to provide compatibility with SPICE input intended for another simulator, or for compatibility with earlier releases of WRspice.

modelcard
This variable allows the keyword that specifies a model to be reset. If unset, the keyword is ``.model''.

nobjthack
If this boolean is set, bipolar transistors are assumed to have four nodes. Otherwise, three nodes are acceptable. This only affects subcircuit expansion.

pexnodes
When this boolean variable is set, node names in device and subcircuit call lines will be parameter expanded as the circuit is read in. In 4.1.12 and later, node names are not parameter expanded by default, to save processing time and avoid unintended matches causing errors. This variable can be set for backward compatibility, for files that actually used this feature.

plot_catchar
One can specify a fully qualified vector name as input to WRspice, where the default syntax is
plotname.vectorname

The character used to separate the plotname from the vectorname, which defaults to a period (`.'), can be changed with this variable. If this variable is set to a single-character string, then that character becomes the separation character.

spec_catchar
By default, vector names that begin with the character `@' are interpreted as ``special'' vectors that provide the value of a model, device, or circuit parameter. These have forms like

@devicename[paramname] for a device parameter,
@modelname[paramname] for a model parameter, or
@paramname for a circuit parameter.

The character used to indicate a special vector can be changed from the default `@' with this variable. If this variable is set to a single-character string, then that character is used to indicate a special vector.

strictnumparse
When this variable is set, WRspice will not allow trailing characters after a number, unless they are separated from the number with an underscore (`_'). This may prevent errors, for example writing ``1meter'' and expecting it to have a value of 1.

subc_catchar
When WRspice processes an input circuit containing subcircuits, it internally generates a ``flat'' representation of the circuit through subcircuit expansion. All subcircuit calls are replaced with the subcircuit body text, and the node and device names in the subcircuit are given new names that are unique in the overall circuit. One can view this flattened representation with the listing e command.

This variable can be set to a string consisting of a single punctuation character, which will be used as the field separation character in names generated in subcircuit expansion. It should be a character that is not likely to confuse the expression parser. This requirement is rather ambiguous, but basically means that math operators, comma, semicolon, and probably others should be avoided.

In release 3.2.15 and later the default is `.' (period), which is also used in HSPICE, and provides nice-looking listings.

In releases 3.2.5 - 3.2.14, the default was `_' (underscore).

In release 3.2.4 and earlier, and in SPICE3, the concatenation character was `:' (colon).

This variable can appear in a .options line in SPICE input, where is will set the concatenation character used for the circuit. See also the description of the subc_catmode variable below.

subc_catmode
When WRspice processes an input circuit containing subcircuits, it internally generates a ``flat'' representation of the circuit through subcircuit expansion. All subcircuit calls are replaced with the subcircuit body text, and the node and device names in the subcircuit are given new names that are unique in the overall circuit. One can view this flattened representation with the listing e command.

Previous WRspice versions used the SPICE3 algorithm for generating the new node and device names. Release 3.2.15 and later have a new, simpler algorithm as the default, but support for the old algorithm is retained.

This string variable can be set to one of the keywords ``wrspice'' or ``spice3''. It sets the encoding mode for subcircuit node and device names. In 3.2.15 and later, the ``wrspice'' mode is the default. In earlier releases, only the ``spice3'' mode was available.

A detailed discussion of the two mapping modes is provided in the description of subcircuit expansion in 2.6.1.1.

Typically, the user may not know or care about subcircuit mapping details, however in some SPICE input it may be necessary to reference subcircuit nodes in .save lines and elsewhere. In this case knowledge of, and control of, the mapping employed is necessary.

There is also a compatibility issue with older WRspice input files that explicitly reference subcircuit nodes, as both the default renaming algorithm and concatenation character have changed as WRspice evolved. The format of the subcircuit node names depends on the algorithm, so SPICE input that explicitly references subcircuit node names implicitly assuming a certain mapping algorithm will require either changes to the node names, or specification of the matching algorithm and concatenation character. Such files can be easily updated to be compatible with newer WRspice releases, but some familiarity with the renaming modes is needed.

This variable can appear in a .options line in SPICE input, where is will set the name mapping algorithm used for the circuit. Typically, to ``fix'' an old input file, one would add a .options line specifying the spice3 mapping algorithm, and either the colon or underscore (as appropriate) for the concatenation character.

subend
This variable allows the keyword which ends a subcircuit definition to be changed. If unset, the keyword is ``.ends''.

subinvoke
This variable allows the prefix which invokes a subcircuit to be changed. If unset, the prefix is ``x''.

substart
This variable allows the keyword which begins a subcircuit definition to be changed. If unset, the keyword is ``.subckt''. The equivalent ``.macro'' keyword applies whether or not this variable is set.

units_catchar
A ``units string'' can follow numbers given to WRspice, and these units are carried through expressions, simplified, and printed with results. The units string follows a number, separated by a separation character which is most often optional. In releases prior to 3.2.4, this character was hard coded to `_' (underscore), but presently defaults to `#' to avoid conflict with the subcircuit field separator character.

The character used as the units separation character can be changed by setting this variable to a length-one string containing the new character. The character in the single-character string becomes the new separation character. For example,

set units_catchar = "_"
will return to the pre-3.2.4 default.

Further, it is now possible to add ``denominator units'', which was not possible in pre-3.2.4 releases. A second appearance of the separation character, or the first appearance if there was no separation character ahead of the units string, is logically like `/', and units that follow are denominator units.

Examples:

1.0#F#S 1 Farad per second
1.0F#S 1 femtosecond (note that 'F' can be a multiplier or a unit!)
1.0FS 1 femtosecond
1.0#FS 1 Farad-second
1.0S 1 second
1.0#S 1 second
1.0##S 1 Hertz

var_catchar
When expanding shell variables, i.e. replacing forms like ``$var'' in WRspice input with the value that has been assigned to var, it is sometimes useful to use the ``concatenation character'', which defaults to `%', to separate the variable name from surrounding text.

For example, if ``set one = 1'' is active, then ``$one%k'' will expand to ``1k''. Note that it is also possible to use the form ``{$one}k'' to achieve the same objective.

The same applies when expanding parameters in SPICE input, using definitions from a .param line. If one has ``.param one=1'' in scope, then ``one%k'' expands to ``1k''.

This variable allows the default concatenation character `%' to be changed. If this variable is set to a single-character string, then that character becomes the concatenation character.


next up previous contents index
Next: Batch Mode Option Variables Up: Variables Previous: String Parameters   Contents   Index
Stephen R. Whiteley 2017-02-22