I am trying to run a simple simulation using a call to a subckt. My netlist is below:
X1 Drn Gate gnd gnd nmos1 n=3 m=2 l=2u fw=3u
R1 Drn Drn1 1.0
.subckt nmos1 D G S B n=1 m=1 l=2u fw=2u
.param W={fw*n}
.param L={l}
.param m={m}
M1 D G S B NM m L W
.MODEL NM NMOS VTO=1.0
.ends nmos1
But when I run a sim in ngspice I get the following message:
ngspice 191 -> source test_nmos2.spi
Circuit: *** spice deck for cell test_nmos{sch} from library testgpdk
Error on line 0 : m.x1.m1 drn gate 0 0 x1.nm x1.m l 9.000000000e-06
Unable to find definition of model x1.nm - default assumed
unknown parameter (x1.m)
1.Why is ngspice concatenating the subckt name x1 in front of the subckt call?
2.From the error message, the
.paramW={n*fw}
seems to have evaluated correctly to 9u. This is even more puzzling. Why is one parameter evaluating correctly but model name is not being resolved?
Just for comparison I have another netlist that has a subckt call that works. It is as follows:
The major difference between the two is that the second one that works does not have a .model statement. Could defining a .model somehow be causing the issue?
Is there a problem with my syntax or is this a bug ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you look at the manual, chapt. 11.1, you see the syntax for a MOSFET:
MXXXXXXX nd ng ns nb mname <m=val > < l =val > <w=val >
+ <ad=val > <as=val > <pd=val > <ps=val > <nrd=val >
+ <nrs=val > <of f > < i c =vds , vgs , vbs> <temp=t >
Your MOSFET line has to read
M1 D G S B NM m=m L=L W=W
Holger
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to run a simple simulation using a call to a subckt. My netlist is below:
But when I run a sim in ngspice I get the following message:
ngspice 191 -> source test_nmos2.spi
Circuit: *** spice deck for cell test_nmos{sch} from library testgpdk
Error on line 0 : m.x1.m1 drn gate 0 0 x1.nm x1.m l 9.000000000e-06
Unable to find definition of model x1.nm - default assumed
unknown parameter (x1.m)
1.Why is ngspice concatenating the subckt name x1 in front of the subckt call?
2.From the error message, the
seems to have evaluated correctly to 9u. This is even more puzzling. Why is one parameter evaluating correctly but model name is not being resolved?
Just for comparison I have another netlist that has a subckt call that works. It is as follows:
The major difference between the two is that the second one that works does not have a .model statement. Could defining a .model somehow be causing the issue?
Is there a problem with my syntax or is this a bug ?
There is a bug in your input file.
If you look at the manual, chapt. 11.1, you see the syntax for a MOSFET:
MXXXXXXX nd ng ns nb mname <m=val > < l =val > <w=val >
+ <ad=val > <as=val > <pd=val > <ps=val > <nrd=val >
+ <nrs=val > <of f > < i c =vds , vgs , vbs> <temp=t >
Your MOSFET line has to read
M1 D G S B NM m=m L=L W=W
Holger
Thank you Holger. Your suggestion solved my issue. Your help is much appreciated.