# HSPICE - Probing Current of an Element Defined By SUBCKT

For a regular resistor model, to plot I-V curve, I write:
R1 m0 m1 1
.probe DC i(R1)
Then, I open CSCOPE. i(R1) is listed. By selecting it, I can see its I-V behavior.

Now, I have a device that is defined with .subckt:
.subckt device m0 m1 param=p
Then, I instantiate it and probe it by:
x1 m0 m1 device
.probe DC i(X1)
However, when I open CSCOPE, i(x1) is not listed, so I cannot see the diagram.

Does anyone know the reason?

• I don't know HSPICE, but, for example, in LTspice, there's an option in the settings, to save, or not, subcircuit voltages and currents (checkboxes). Maybe there's something similar in HSPICE? – a concerned citizen May 3 '18 at 5:42
• @aconcernedcitizen, thanks for your response. I don't work with the GUI, so don't know about that. There may be a command for it. I came up with a solution, I connected a resistor with 0 value in series with my device, and plotted its current. – Shabnam May 3 '18 at 17:10
• Oh, I thought you want the current inside the subcircuit. Well, ma' bad. I'll post an answer, maybe it helps. – a concerned citizen May 3 '18 at 17:18
• Try .PROBE DC ISUB(X1.port) where port is the name of the terminal. – HKOB May 3 '18 at 20:16

If you want the current through a block defined by a subcircuit, then the current is defined as Ix, followed by the part's designator, a colon, and the pin as defined internally.

For example:

.subckt xxx 1 2
R1 1 2 1
.ends xxx


This subcircuit is a simple resistor, and its pins are named 1 and 2. But the symbol that uses this subcircuit can have its pins named differently.

If they are named A and B, and if the designator is U1, then the current through pin 1 would be: Ix(U1:A).

If the pins are named similarly, 1 and 2, and the same designator, then the current would be Ix(U1:1).

If the designator would be SpecialPart13, and the pins similarly named, then the current would be Ix(SpecialPart:1).

If you look at the netlist, the block is defined as X1 ..., that is the x in Ix. If you would work with a GUI and you would see U1, most likely the netlist will show XU1 ....

So, for your case, if the netlist shows X1, and the pin is named 1, then the current through that pin would be Ix(1:1). If the name of the pin is IN, then it's Ix(1:IN).