In this document, text which is provided in typewriter font represents verbatim input to or output from the program. Text enclosed in square brackets ( [text] ) is optional in the given example, as in optional command arguments, whereas other text should be provided as indicated. Text which is italicized should be replaced with the necessary input, as described in the accompanying text.
Input to WRspice consists of ASCII text, using either Unix or Microsoft Windows line termination methods. Input is contained in one or more files. If more than one file name is provided to the source command, the file contents will be concatenated in the order given, and/or split into multiple circuits if .newjob lines are found.
There is provision in the syntax for file inclusions (referencing the content of another file) to arbitrary depth. Once the input files are read, the lines are logically assembled into a ``deck'' for each circuit, and each line is sometimes referred to as a ``card'', teminology reflecting the punched-card heritage of the program.
The first line of a deck is taken as a title line for any circuit described in the deck. If the deck does not define a circuit (it may consist of commands text only), the title line is not used, but with a few exceptions must be present in input. The title line can contain 7-bit ASCII characters only. If a character is found in the title line with the most-significant bit set, the read is aborted, as this is taken as binary input, and attempting to read a binary file would generate a cascade or errors or crash the program. Binary characters can exist elsewhere in the file, if necessary for whatever reason.
One exception to the rule that the first line be a title line is if the first line of text in a file starts with the characters ``#!'', that line will be discarded when the file is read. This enables WRspice input files to be self-executing using the mechanisms of the UNIX shell. For example, if the following line is prepended to an input file
#! wrspiceand the file is made executable, then typing the name of the file will initiate WRspice on the circuit contained in the file.
The remaining lines are either circuit element descriptions, or ``dotcards'', or blocks of text surrounded by dotcards. The circuit element lines define the devices found in the circuit, providing connection points which define the circuit topology, and device parameter values. The dotcards are lines whose initial token is a keyword starting with `.'. These provide various control directives and data for use in simulating the circuit, including device models. Some dotcards, such as .verilog and .control provide blocks of lines in some other format, which is different form the SPICE format and is described separately.
The order of the circuit definition and control lines is arbitrary, except that continuation lines must immediately follow the line being continued, and certain constructs contain blocks of lines, which may be command scripts which must be ordered.
Certain special input file formats are recognized, such as operating range analysis control files, and files generated by the Xic schematic capture front end. Exceptions to the rule of arbitrary line placement will be described in the sections describing these files.
Fields on an element line and most dotcards are delimited by white space, a comma, an equal sign (`='), or left or right parentheses; extra white space is ignored.
A line may be continued to the following line(s) in two ways. If the last character on a line is a backslash character ( \ ), the ``newline'' is effectively hidden, and the text on the following line will be appended to the current line, however leading white space is stripped from the continuing line. If there is more than one backslash at the end of the line, all will be stripped before the line is joined to the following line. The traditional SPICE line continuation is also available, whereby a line may be continued by entering a + (plus) as the first non-white space character of the following line, WRspice will continue reading beginning with the character that follows.
Devices and device models are given names in input for reference. These name fields must begin with a letter and cannot contain any delimiters. Circuit connection points (``nodes') are also given arbitrary names, however these may start with or just be an integer. The ground node must be named ``0'' (zero), however. Note that ``00'' (for example) and "0" are distinct in WRspice, but not in SPICE2. Non-ground node names may have trailing or embedded punctuation (but this is generally not recommended).