Using ngspice 45.2 and the IHP PDK main branch, simulting the following circuit fails:
V9 net10 GND vdsx
V13 vg_m7 GND Vgs
XM5 net10 vg_m7 GND GND sg13_lv_nmos w=2u l=1u ng=1 m=1
**** begin user architecture code
.lib cornerMOSlv.lib mos_tt
.lib cornerMOShv.lib mos_tt
.param Vgs=1
.param vdsx=1.2
.control
save all
op
print all
.endc
.GLOBAL GND
.end
The error message:
Circuit:
Error on line 3 or its substitute:
v9 net10 0 vdsx
unknown parameter (vdsx)
Simulation interrupted due to error!
When chaning the location of the .lib imports to after the .param statements, the issue disappears, and the following runs through:
V9 net10 GND vdsx
V13 vg_m7 GND Vgs
XM5 net10 vg_m7 GND GND sg13_lv_nmos w=2u l=1u ng=1 m=1
**** begin user architecture code
.param Vgs=1
.param vdsx=1.2
.lib cornerMOSlv.lib mos_tt
.lib cornerMOShv.lib mos_tt
.control
save all
op
print all
.endc
.GLOBAL GND
.end
I would expect both files to be identic. In particular, using xschem, it is difficult to control the location of the .lib statenements compared to .param, so the issue appears and disappears randomly.
I hope you have a title line!
Sure, I didn't copy and paste it, and apparently can't change what I wrote anymore.
It is strongly recommended to put params into braces or single quotes
V9 net10 GND 'vdsx'
V13 vg_m7 GND 'Vgs'
Adding single quotes seems to solve the issue.
I still find the behaviour unexpected. I would expect a parameter be accepted or rejected regardless, if it was definition before or after library imports.
Anyway, from my perspective the issue could be closed.