grmbl if I have `m.xx1.xm1.msky130_fd_pr__nfet_g5v...
# analog-design
p
grmbl if I have
m.xx1.xm1.msky130_fd_pr__nfet_g5v0d10v5#body
in ngspice, isn't
@m.xx1.xm1.msky130_fd_pr__nfet_g5v0d10v5[id]
the drain current?
Copy code
save @m.xx1.xm1.msky130_fd_pr__pfet_g5v0d10v5[id]
op
print all
Error(checkvalid): vector @m.xx1.xm1.msky130_fd_pr__pfet_g5v0d10v5[id] is not available or has zero length.
Such a PITA to get any transistor parameters out of this thing
spice:
Copy code
* lvds_tb$basic
.subckt buffered V+ V- VDD_IO GND VDD 10u OUT
XM6 10u 10u GND GND sky130_fd_pr__nfet_01v8 l=0.15 w=7
XM5 W22 10u GND GND sky130_fd_pr__nfet_01v8 l=0.15 w=7
XM10 W26 10u GND GND sky130_fd_pr__nfet_01v8 w=7 l=0.15
XM19 VDD W73 OUT VDD sky130_fd_pr__pfet_01v8 w=7 l=0.15
XM20 VDD OUT W73 VDD sky130_fd_pr__pfet_01v8 w=7 l=0.15
XM17 W73 cmppos GND GND sky130_fd_pr__nfet_01v8 w=7 l=0.15
XM18 OUT cmpneg GND GND sky130_fd_pr__nfet_01v8 w=7 l=0.15
XM9 VDD W26 W49 VDD sky130_fd_pr__pfet_01v8 w=7 l=0.15 m=4
XM15 W49 bufpos cmppos VDD sky130_fd_pr__pfet_01v8 w=7 l=0.15 m=1
XM16 W49 bufneg cmpneg VDD sky130_fd_pr__pfet_01v8 w=7 l=0.15 m=1
XM8 VDD W26 W26 VDD sky130_fd_pr__pfet_01v8 w=7 l=0.15
XM7 W15 VDD W22 GND sky130_fd_pr__nfet_g5v0d10v5 w=10 l=0.5
XM14 cmpneg cmpneg GND GND sky130_fd_pr__nfet_01v8 w=7 l=0.15
XM13 cmpneg cmppos GND GND sky130_fd_pr__nfet_01v8 w=7 l=0.15 m=2
XM12 cmppos cmpneg GND GND sky130_fd_pr__nfet_01v8 w=7 l=0.15 m=2
XM11 cmppos cmppos GND GND sky130_fd_pr__nfet_01v8 w=7 l=0.15
RR1 bufneg GND resistance=1000
RR2 bufpos GND resistance=1000
XM4 VDD_IO W15 W15 VDD_IO sky130_fd_pr__pfet_g5v0d10v5 l=0.5 w=10
XM1 VDD_IO W15 cm VDD_IO sky130_fd_pr__pfet_g5v0d10v5 l=0.5 w=10 m=10
XM3 cm V- bufneg VDD_IO sky130_fd_pr__pfet_g5v0d10v5 l=0.5 w=10 m=100
XM2 cm V+ bufpos VDD_IO sky130_fd_pr__pfet_g5v0d10v5 l=0.5 w=10 m=100
.ends buffered
.lib /usr/local/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice ss
VV2 pos W3 dc=0
XX1 pos neg VDD_IO GND VDD bias_10u output buffered
VV1 neg W3 dc=0 SIN(0 0.1 10k) ac=1
II1 VDD bias_10u dc=100u
VV3 W3 GND dc=1.5 PWL(0 0.1 0.1 2.4)
V1V8 VDD GND dc=1.8
V3V3 VDD_IO GND dc=3.3

.end
wat... seems to work now??
Copy code
ngspice 1 -> save @m.xx1.xm1.msky130_fd_pr__pfet_g5v0d10v5[id]
ngspice 2 -> op
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

 Reference value :  0.00000e+00
No. of Data Rows : 1
ngspice 3 -> print all
all = 7.206575e-04
a
I was wondering the same myself, thanks for posting this! Have you been able to pull out vdsat, gm etc from ngspice? I tried replacing your [id] with [gm] but no luck:(
p
I think
[gm]
should work
a
Ooh that’s cool, I probably should have read the manual as they say. Thanks Pepijn!
p
But it doesn't work you said? Hrmmmm [id] also didn't work at first for me, no idea what changed
a
No no it worked in the end, I was giving ngspice bad commands I was adding a new .save but not re-running the sim correctly (was giving it run instead of op by mistake!) It works fine for me first time it seems. Have you tried the
display
command in ngspice to see what actually saved if you get that error again?
the
show
command also prints all parameters
t
There was once a nice implementation of ngspice called
tclspice
written by my friend and colleague Stefan Jones, which replaced a lot of the horrible ngspice command syntax with straight-up Tcl calls, which made things a lot easier. At some point ngspice development broke tclspice. I spent a day or so looking into whether I could get it working again, but it didn't look particularly easy or straightforward. A modernized, say,
pyngspice
would be nice to have. . .
p
Yea I guess Pyspice is the thing that comes closest, and I do intend to do this kind of stuff in Pyttoreseque & simserver, which is one of the ways I'm running head-first into all these weird ngspice things. I'm still trying to figure out a good way to let the user select which signals to save.
a
@Leonardo Gomes this is probably the thread you're looking for:)
👍 1