You need to use the .param
statements and then assign the values within curly braces. e.g. (case insensitive):
.param x=1.618
M1 3 1 2 NM
.model nm nmos Vto={x}
All .param
statements are evaluated prior to simulation start, and the curly braces tell the engine to evaluate whatever there is enclosed. Since x
is a .param
, it's evaluated before the simulation starts, so the curly braces replace {x}
with its defined value, 1.618
.
As a minor addition, in the comments I mentioned that the MOSFET line can have parameters: width, height, areas. Usually, the areas are calculated from w
and l
, so the line could look like this:
.param y=0.618
M1 3 1 2 NM w=1 l={y}
As it is, w
is predefined and unchanged, while l
can be defined and used with a .step
to see how varying it changes the response. For this particular MOSFET you'll need a hefty workbench.
Thanks, but that leads to use the model only for one mosfet. What if I want to have two mosfets in the circuit each with different VOT, using the same model?
You should have specified this in your OP -- actually, please do so.
You will need to use as many .MODEL
definitions as you have MOSFETs that use that particular change, but there is a shortcut: the ako
(a kind of) keyword. If you already have the .MODEL
defined in the database, then all you need is to rename each MOSFET that needs a change, preferably in an intuitive manner, and then add (assuming you're "impersonating" the 2N7000
, for example):
.model N_3.14 ako:2N7000 vto=3.14
.model N_2.718 ako:2n7000 vto=2.718
...
Then having a MOSFET named N_3.14
will make it behave like a 2N7000
with a 3.14 V threshold; similarly for an N_2.718
. And, just like in the original answer, you can use .PARAM
statements to assign to Vto
.
[edit] Thanks to Ste Kulov's comment, you need to enable either PSpice, or LTspice compatibility for ako
to work [/edit]