X. Subcircuit

Syntax: Xxxx n1 n2 n3... <subckt name> [<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.

 

* calling a subcircuit

*

* This is the circuit

X1 in out 0 divider top=9K bot=1K

V1 in 0 pulse(0 1 0 .5m .5m 0 1m)

 

* This is the subcircuit

.subckt divider A B C

R1 A B {top}

R2 B C {bot}

.ends divider

.tran 3m

.end