X. Subcircuit
Syntax:
Xxxx n1 n2 n3... <subckt name>|<string expression> [<parameter>=<expression>]
Subcircuits allow circuitry to be defined and stored in a library for later retrieval by name. Below is an example of defining and calling a voltage divider and invoking it in a circuit.
*
* This calls the circuit
X1 in out 0 divider top=9K bot=1K
V1 in 0 pulse(0 1 0 0.5m 0.5m 0 1m)
*
* This is the subcircuit definition
.subckt divider A B C
R1 A B {top}
R2 B C {bot}
.ends divider
*
.tran 3m
.end
Instead of naming the subcircuit directly, you can use an expression in curly braces that yields a string, for example:
.param name = "divider"
X1 in out 0 {name} top=9K bot=1K
This is useful for parameterizing subcircuit instantiations.
Copyright © 1998–2025 by Analog Devices Inc. All Rights Reserved.