.SUBCKT and .ENDS

.SUBCKT subcktname n1 [ n2 ]...
+ [ [params:] param_name1 [=] param_value1
+ [param_name2 [=] param_value2]...]

This statement begins a subcircuit definition.

subcktname Subcircuit name. This must begin with a letter but may contain any legal ASCII character except any whitespace (space, tab) or ' . ' . The name must be unique i.e. no other subcircuits may have the same name.
n1, n2 etc. Node names available externally. Must not be zero.
param_name, param_value Parameter name and value. This sets default values for parameters used within the subcircuit. These values can be overridden for each subcircuit instance. See Using Expressions for more info. Note that it is not compulsory to declare default values for subcircuit parameters.

IMPORTANT: Either the params: specifier or the first '=' may be omitted but not both. If both are omitted it becomes impossible for the netlist scanner to tell the difference between parameter names and node names.

.ENDS [ subcktname ]

Terminates a subcircuit definition. subcktname may be added for clarity but will be ignored by SIMetrix.

A subcircuit consists of a .subckt statement followed by a series of device or model descriptions and terminating in a .ends statement. A subcircuit is a circuit that can be called into the main circuit (or indeed another subcircuit) by reference to its name. The .subckt statement is used to define the subcircuit while a subcircuit call - an 'X' device - is used to create an instance of that subcircuit. Subcircuits have a number of uses:

  • To repeat a commonly used section of circuit.
  • To hide detail from the main circuit to aid circuit readability.
  • To distribute models of integrated devices such as op-amps.
For a detailed discussion see Subcircuits.

Subcircuit definitions usually reside in a text file and are read in as libraries. See User's Manual for further details.