Subcircuit

Overview

A subcircuit- that consists of DR. SPICE elements can be defined and referenced in a fashion similar to device models. The subcircuit is defined in the input file by a grouping of element statements; the program then automatically inserts the group of elements wherever the subcircuit is referenced. There is no limit on the size or complexity of subcircuits, and subcircuits may contain other subcircuits.

A subcircuit definition starts with a .SUBCKT statement. The last statement in a subcircuit definition is the .ENDS statement. All the statements between the .SUBCKT statement and the .ENDS statement define the subcircuit. Control statements may not appear within a subcircuit definition; however, subcircuit definitions may include device models, other subcircuit definitions and subcircuit calls (X statements).

Note that any subcircuit definitions or device models included as part of a subcircuit definition are strictly local (i.e., such definitions are not known outside the subcircuit definition). Also, any element nodes not included on the .SUBCKT statement are strictly local, with the exception of 0 (ground) which is always global.

NOTE: You cannot pass currents or voltages into subcircuits as parameters.

The .SUBCKT Statement

.SUBCKT subnam N1 <N2 N3 ...>
.SUBCKT subnam N1 <N2 N3 ...> <params: [name=value]*>

Examples:

.SUBCKT OP AMP 1 2 3 4
.SUBCKT LPF IN OUT PARAMS: PA=1 PR=10
.SUBCKT MISC I1 I2 PARAMS: PCAP=1P PIND=1U

SUBNAM represents the subcircuit name, and N1, N2,... represent external nodes, which cannot be zero. PARAMS allows the listed parameters and default values to be defined as a unique part of the subcircuit.

Subcircuit Calls (X Statement)

XYYYYYYY N1 <N2 N3 ...> subnam
XYYYYYYY N1 <N2 N3 ...> subnam <params: +[name=value]*>

Examples:

X1 2 4 17 3 1 MULTI
XLPF1 PD L LPF PARAMS: PA=20 PR=795.8K
XTL_IN N1X N1 MISC PARAMS: PCAP={0.91P*PDIST} 
+ PIND={0.00725U/PDIST}

SUBNAM represents the subcircuit name, and N1, N2,... represent external nodes, which cannot be zero. PARAMS allows the listed parameters and default values to be defined as part of the subcircuit.

Return to main menu