# LTspice MOSFET width sweep

I am trying to simulate the transfer characteristics of a CMOS inverter using LTspice. I want to sweep the MOSFET width and length and observe the effects on rise and fall times of the CMOS inverter. Is there any way of setting up a sweep of MOSFET width and length ?

• I am not really sure what you want, can you provide a minimal .asc file of what you got so far? I think something like .step nmos NMOS(w) 1u 10u 1u will do what you need... – PlasmaHH Feb 23 '15 at 14:17

LTspice uses the .step command to accomplish up to 3 nested sweep, to do two nested sweeps add directives like this:

.step param width 1u 10u 1u
.step param length 1u 10u 1u


LTspice measure for rise time and fall time:

 .MEAS TRAN tr1 WHEN V(out)=V(vdd)*0.1 RISE=1
.MEAS TRAN tr2 WHEN V(out)=V(vdd)*0.9 RISE=1
.MEAS TRAN tr PARAM (tr2-tr1)
.MEAS TRAN tf1 WHEN V(out)=V(vdd)*0.9 FALL=1
.MEAS TRAN tf2 WHEN V(out)=V(vdd)*0.1 FALL=1
.MEAS TRAN tf PARAM (tf2-tf1)


You will find the output of the measure commands in the log (Ctrl-L).

If you are drawing the transistors you may need to wrap the parameters in {}-brackets.

If you write the netlist yourself you need a .param directive, e.g.:

 .param width=1u length=1u
Mnmos1 D G S B model w={width} l={length}


Below is a working example:

After running it hit Ctrl-L or use the menu item 'spice error log' to see the measure results. For simpler measure setups you cant plot the results by right clicking in the 'spice error log' window, but it didn't work in this case so you need to process it in another program.

• my MOSFET model is defined as : Mnmos@0 output input gnd gnd NMOS L=0.4U W=2U Mpmos@0 vdd input output vdd PMOS L=0.4U W=2U how do i change the L and W for both Mnmos@0 and Mpmos@0 ? – ironstein Feb 21 '15 at 16:44
• No problem for the answer so far, but I just realized I'm out of time, so I will have too come back to do a full example (maybe later today). – HKOB Feb 21 '15 at 17:03