Elementary devices
Resistors
General form
RXXXXXXX N1 N2 VALUE RXXXXXXX N1 N2 R=VALUE
Examples
R1 1 2 100 RC1 12 17 1K
N1 and N2 are the two element nodes. VALUE is the resistance (in ohms) and may be positive or negative but not zero.
The value may also be written R=value (and a capacitor's or inductor's as C= or L=), which lets it be set by a subcircuit parameter.
Parameters: Resistor
Semiconductor Resistors
General form
RXXXXXXX N1 N2 <VALUE> <MNAME> <L=LENGTH> <W=WIDTH> <TEMP=T>
Examples
RLOAD 2 10 10K RMOD 3 7 RMODEL L=10u W=1u
This is the more general form of the resistor presented in section 6.1, and allows the modeling of temperature effects and for the calculation of the actual resistance value from strictly geometric information and the specifications of the process. If VALUE is specified, it overrides the geometric information and defines the resistance. If MNAME is specified, then the resistance may be calculated from the process information in the model MNAME and the given LENGTH and WIDTH. If VALUE is not specified, then MNAME and LENGTH must be specified. If WIDTH is not specified, then it is taken from the default width given in the model. The (optional) TEMP value is the temperature at which this device is to operate, and overrides the temperature specification on the .OPTION control line.
Parameters: Resistor
Semiconductor Resistor Model (R)
The resistor model consists of process-related device data that allow the resistance to be calculated from geometric information and to be corrected for temperature. The parameters available are:
| name | parameter | units | default | example |
|---|---|---|---|---|
| TC1 | first order temperature coeff. | Ω/°C | 0.0 | - |
| TC2 | second order temperature coeff. | Ω/°C2 | 0.0 | - |
| RSH | sheet resistance | Ω/□ | - | 50 |
| DEFW | default width | meters | 1e-6 | 2e-6 |
| NARROW | narrowing due to side etching | meters | 0.0 | 1e-7 |
| TNOM | parameter measurement temperature | °C | 27 | 50 |
The sheet resistance is used with the narrowing parameter and L and W from the resistor device to determine the nominal resistance by the formula
DEFW is used to supply a default value for W if one is not specified for the device. If either RSH or L is not specified, then the standard default resistance value of 1 kΩ is used. TNOM is used to override the circuit-wide value given on the .OPTIONS control line where the parameters of this model have been measured at a different temperature. After the nominal resistance is calculated, it is adjusted for temperature by the formula:
Parameters: Resistor
Capacitors
General form
CXXXXXXX N+ N- VALUE <IC=INCOND>
Examples
CBYP 13 0 1UF COSC 17 23 10U IC=3V
N+ and N- are the positive and negative element nodes, respectively. VALUE is the capacitance in Farads.
The (optional) initial condition is the initial (time-zero) value of capacitor voltage (in Volts). Note that the initial conditions (if any) apply 'only' if the UIC option is specified on the .TRAN control line.
Parameters: Capacitor
Semiconductor Capacitors
General form
CXXXXXXX N1 N2 <VALUE> <MNAME> <L=LENGTH> <W=WIDTH> <IC=VAL>
Examples
CLOAD 2 10 10P CMOD 3 7 CMODEL L=10u W=1u
This is the more general form of the Capacitor presented in section 6.2, and allows for the calculation of the actual capacitance value from strictly geometric information and the specifications of the process. If VALUE is specified, it defines the capacitance. If MNAME is specified, then the capacitance is calculated from the process information in the model MNAME and the given LENGTH and WIDTH. If VALUE is not specified, then MNAME and LENGTH must be specified. If WIDTH is not specified, then it is taken from the default width given in the model. Either VALUE or MNAME, LENGTH, and WIDTH may be specified, but not both sets.
Parameters: Capacitor
Semiconductor Capacitor Model (C)
The capacitor model contains process information that may be used to compute the capacitance from strictly geometric information.
| name | parameter | units | default | example |
|---|---|---|---|---|
| CJ | junction bottom capacitance | F/meters2 | - | 5e-5 |
| CJSW | junction sidewall capacitance | F/meters | - | 2e-11 |
| DEFW | default device width | meters | 1e-6 | 2e-6 |
| NARROW | narrowing due to side etching | meters | 0.0 | 1e-7 |
The capacitor has a capacitance computed as
CAP = CJ (LENGTH - NARROW) (WIDTH - NARROW) + 2 CJSW (LENGTH + WIDTH - 2 NARROW)
Parameters: Capacitor
Inductors
General form
LYYYYYYY N+ N- VALUE <IC=INCOND>
Examples
LLINK 42 69 1UH LSHUNT 23 51 10U IC=15.7MA
N+ and N- are the positive and negative element nodes, respectively. VALUE is the inductance in Henries.
The (optional) initial condition is the initial (time-zero) value of inductor current (in Amps) that flows from N+, through the inductor, to N-. Note that the initial conditions (if any) apply only if the UIC option is specified on the .TRAN analysis line.
Parameters: Inductor
Coupled (Mutual) Inductors
General form
KXXXXXXX LYYYYYYY LZZZZZZZ VALUE
Examples
K43 LAA LBB 0.999 KXFRMR L1 L2 0.87
LYYYYYYY and LZZZZZZZ are the names of the two coupled inductors, and VALUE is the coefficient of coupling, K, which must be greater than 0 and less than or equal to 1. Using the 'dot' convention, place a 'dot' on the first node of each inductor.
Parameters: Coupled (mutual) inductors
Switches
General form
SXXXXXXX N+ N- NC+ NC- MODEL <ON><OFF> WYYYYYYY N+ N- VNAM MODEL <ON><OFF>
Examples
s1 1 2 3 4 switch1 ON s2 5 6 3 0 sm2 off Switch1 1 2 10 0 smodel1 w1 1 2 vclock switchmod1 W2 3 0 vramp sm1 ON wreset 5 6 vclck lossyswitch OFF
Nodes 1 and 2 are the nodes between which the switch terminals are connected. The model name is mandatory while the initial conditions are optional. For the voltage controlled switch, nodes 3 and 4 are the positive and negative controlling nodes respectively. For the current controlled switch, the controlling current is that through the specified voltage source. The direction of positive controlling current flow is from the positive node, through the source, to the negative node.
Parameters: Voltage-controlled switch, Current-controlled switch
Switch Model (SW/CSW)
The switch model allows an almost ideal switch to be described in SPICE. The switch is not quite ideal, in that the resistance can not change from 0 to infinity, but must always have a finite positive value. By proper selection of the on and off resistances, they can be effectively zero and infinity in comparison to other circuit elements. The parameters available are:
| name | parameter | units | default | switch |
|---|---|---|---|---|
| VT | threshold voltage | Volts | 0.0 | S |
| IT | threshold current | Amps | 0.0 | W |
| VH | hysteresis voltage | Volts | 0.0 | S |
| IH | hysteresis current | Amps | 0.0 | W |
| RON | on resistance | Ω | 1.0 | both |
| ROFF | off resistance | Ω | 1/GMIN* | both |
*(See the .OPTIONS control line for a description of GMIN, its default value results in an off-resistance of 1.0e+12 ohms.)
The use of an ideal element that is highly nonlinear such as a switch can cause large discontinuities to occur in the circuit node voltages. A rapid change such as that associated with a switch changing state can cause numerical roundoff or tolerance problems leading to erroneous results or timestep difficulties. The user of switches can improve the situation by taking the following steps:
First, it is wise to set ideal switch impedances just high or low enough to be negligible with respect to other circuit elements. Using switch impedances that are close to "ideal" in all cases aggravates the problem of discontinuities mentioned above. Of course, when modeling real devices such as MOSFETS, the on resistance should be adjusted to a realistic level depending on the size of the device being modeled.
If a wide range of ON to OFF resistance must be used in the switches (ROFF/RON >1e+12), then the tolerance on errors allowed during transient analysis should be decreased by using the .OPTIONS control line and specifying TRTOL to be less than the default value of 7.0. When switches are placed around capacitors, then the option CHGTOL should also be reduced. Suggested values for these two options are 1.0 and 1e-16 respectively. These changes inform SPICE3 to be more careful around the switch points so that no errors are made due to the rapid change in the circuit.
Parameters: Voltage-controlled switch, Current-controlled switch