Spectrum Software
spacer
Industrial Strength Simulation
select:

divider

 

 

divider

 

Subcircuit Variables and Passed Parameters

 

Have you ever needed to plot a macro or subcircuit variable like the voltage several levels deep in a subcircuit or to see the value of a calculated, passed parameter? It's easy and here is how it can be done; access the variable as X1.X2.variable_name, where variable_name is the name you'd use at the normal circuit level.

For instance, suppose you have this circuit.

Nested Macro Circuits


The main circuit calls the XYZ macro and it calls the DEF macro.

V(X1.X2.PINB)

Each reference to a lower level subcircuit or macro use the subcircuit names (X1 X2) and a period to separate them.

X1 is the name of the highest level subcircuit or macro.
X2 is the name of the next lowest level subcircuit or macro.
PINB is the name of the node in the X2 circuit whose voltage we want to plot.

The same method can be applied to other variables, like the resistance of the resistor R1 in X1 would be V(X1.R1).

X1 is the name of the highest level subcircuit or macro.
R1 is the name of a resistor in X1
V(X1.R1) is the voltage across the resistor named R1.

Here, for example, is the capacitance of the capacitor C1 in X2, called from X1.

X1 is the name of the highest level subcircuit or macro.
X2 is the name of the subcircuit or macro called from X1.
C1 is the name of a capacitor C1 in X2.
V(X1.X2.C1) is the voltage across the capacitor C1.

What about passed parameters? Here is how is you'd plot the CIN parameter passed to the X2 macro.

X1 is the name of the highest level subcircuit or macro.
X2 is the name of the subcircuit or macro called from X1.
V(X1.X2.CIN) is the capacitance parameter passed to the X2 macro.

How about locally defined parameters? Here is how is you'd plot the value of the A variable in the X1 macro.

X1 is the name of the highest level subcircuit or macro.
V(X1.A) is the value of the local A parameter in the X1 macro.

Note that there is an A variable defined in the main circuit that is distinct from the A variable defined in the X1 subcircuit. The variables A and X1.A are separate and distinct.

This plot shows the value of several of these variables:

Variables plot

 

Download Spring 2015 Circuit Files

Return to the main Newsletter page