.SUBCKT Statement
Subcircuits allow you to define reusable circuit blocks with their own local nodes and parameters. They can be instantiated via (X) Subcircuit Instance Statement and are subject to Scopes and Shadowing.
.SUBCKT name <n1 <n2 ...>> <PARAMS: <p1=v1 <p2=v2...>>>
*...
.ENDS
Where:
name- Unique name for the subcircuitn1, n2, ...- Distinct node names (ground0is not allowed)p1=v1, p2=v2, ...- Optional parameters with default values (Constants or Expressions in curly braces)
PARAMS: and curly braces around expressions can be skipped when there is a = sign to separate the first parameter from its default value.
Equal signs can be skipped when curly braces are used around expressions.
.SUBCKT name n1 n2 a=1+2 b=3
...
.ENDS
Examples
.SUBCKT sub1 n1 n2
R n1 n2 1
.ENDS
.SUBCKT sub2 n1 n2 n3 PARAMS: a=1 b={2+3}
R1 n1 n2 1
R2 n2 n3 1
.ENDS