In this Topic Hide
The main circuit refers to the circuit definition which begins with the title statement, which is the first line in the input file, and ends with the .END statement, which is the last significant line in the input file. Any number of subcircuits can be defined within the main circuit. The subcircuits can also be nested within other subcircuits. As many as 20 levels of nesting are allowed. A typical group of statements defining a subcircuit definition duplicates the following pattern of statements:
Obviously, the "Start Subcircuit Statement" and the "End Subcircuit Statement" must be the first and the last statements, respectively, in the definition of a subcircuit. Between these start and end statements, the comment statements, device statements, model statements, subcircuit definitions, and control statements can appear in any order or sequence without any effect on the reading of the input file.
When a subcircuit named "AAA" is defined in a general circuit named "BBB", then the subcircuit "AAA" is considered the child of the general circuit "BBB" and the general circuit "BBB" is considered the parent of the subcircuit "AAA". Each subcircuit can have only one parent and each general circuit can have zero, one, or more children. The main circuit is the ancestor of all subcircuits defined in the entire input file and it does not have a parent.
In this section, a brief description of the .SUBCKT statement is given. The format of the .SUBCKT statement is defined as:
.SUBCKT sname n1 n2 n3 ... |
.SUBCKT | is the seven-character keyword ".SUBCKT" signifying the start of the subcircuit definition |
sname | is a legal subcircuit name as explained in Model Names and Subcircuit Names. A subcircuit name must be unique within a general circuit. If a name is used as a subcircuit name in a general circuit, it cannot be used as a model name in the same general circuit and vice-versa |
n1 | is the node name of the first external node of the subcircuit |
n2 | is the node name of the second external node of the subcircuit |
n3 | is the node name of the third external node of the subcircuit, and so on |
In this section, a brief description of the .ENDS statement is given. The format of the .ENDS statement is defined as:
.ENDS [sname] |
.ENDS | is the five-character keyword ".ENDS" signifying the end of one or more subcircuits |
sname | is the name of a subcircuit whose definition has not been terminated. The subcircuit name may be omitted to form the special case of the non-specific .ENDS statement. |
Subcircuits are normally terminated with a .ENDS statement in the .ENDS [sname] , or specific form. If a subcircuit has not been terminated with this form of .ENDS statement, the non-specific form of the .ENDS statement:
.ENDS |
Example 5.1
.SUBCKT SUB113 |
R1 1 2 1K |
C1 2 3 1U IC=1 |
X1 2 3 SUB2 |
.SUBCKT SUB2 101 103 |
R2 101 102 1K |
C2 102 103 1U IC=1 |
X2 102 103 SUB3 |
.SUBCKT SUB3 201 203 |
R3 201 202 1K |
C3 202 203 1U IC=1 |
.ENDS |
Example 5.2
.SUBCKT SUB113 |
R1 1 2 1K |
C1 2 3 1U IC=1 |
X1 2 3 SUB2 |
.SUBCKT SUB2 101 103 |
R2 101 102 1K |
C2 102 103 1U IC=1 |
X2 102 103 SUB3 |
.SUBCKT SUB3 201 203 |
R3 201 202 1K |
C3 202 203 1U IC=1 |
.ENDS SUB2 |
|