Electronic – How to accomplish parameterized subcircuits in LTSpice

cmosinverterltspicesimulation

I am trying to play around with beta ratio effect of CMOS inverter. To do so I need to have parameterized subcircuit so I can adjust the ratio of PMOS beta over NMOS beta and achieve HI-skewed or LO-skewed inverters.

How do you define parameter x in a sub-circuit?

What I need to do is to define a sub-circuit like this:

.subckt inverter_035_x in out VDD GND
XM1 out in 0 0 NM W={x*1u} L=0.35u
XM2 out in VDD VDD PM W={x*3u} L=0.35u
.ends inverter_035_x

and then set x in every instance of the subcircuit so I can achieve different transistor width per instance.

How to set x and pass it to a sub-circuit instance?

Best Answer

ok I figured it out. Just needed to right click and type 'x=2' in PARAM field from the main block to pass the x set 2 to the sub-circuit.