The circuit to be analyzed is described to ngspice by a set of element
lines, which define the circuit topology and element values, and a set
of control lines, which define the model parameters and the run
controls. The first line in the input file must be the title, and the
last line must be ".END
". The order of the remaining lines is
arbitrary (except, of course, that continuation lines must immediately
follow the line being continued).
Each element in the circuit is specified by an element line that
contains the element name, the circuit nodes to which the element is
connected, and the values of the parameters that determine the
electrical characteristics of the element. The first letter of the
element name specifies the element type. The format for the NGSPICE
element types is given in what follows. The strings XXXXXXX
,
YYYYYYY
, and ZZZZZZZ
denote arbitrary alphanumeric strings.
For example, a resistor name must begin with the letter R
and can
contain one or more characters. Hence, R
, R1
, RSE
,
ROUT
, and R3AC2ZY
are valid resistor names. Details of each
type of device are supplied in a following section.
Fields on a line are separated by one or more blanks, a comma, an
equal (`=
') sign, or a left or right parenthesis; extra spaces are
ignored. A line may be continued by entering a `+
' (plus) in
column 1 of the following line; NGSPICE continues reading beginning with
column 2.
A name field must begin with a letter (A through Z) and cannot contain any delimiters.
A number field may be an integer field (12, -44), a floating point field (3.14159), either an integer or floating point number followed by an integer exponent (1e-14, 2.65e3), or either an integer or a floating point number followed by one of the following scale factors:
T
= 10^12
G
= 10^9
Meg
= 10^6
K
= 10^3
mil
= 25.4^-6
m
= 10^-3
u
= 10^-6
n
= 10^-9
p
= 10^-12
f
= 10^-15
Letters immediately following a number that are not scale factors are ignored, and letters immediately following a scale factor are ignored. Hence, 10, 10V, 10Volts, and 10Hz all represent the same number, and M, MA, MSec, and MMhos all represent the same scale factor. Note that 1000, 1000.0, 1000Hz, 1e3, 1.0e3, 1kHz, and 1k all represent the same number.
Nodes names may be arbitrary character strings. The datum (ground) node must be named `0' (zero). Note the difference in NGSPICE where the nodes are treated as character strings and not evaluated as numbers, thus `0' and `00' are distinct nodes in NGSPICE but not in SPICE2.
NGSPICE needs that the following topological constraints are satisfied: