Hello all, I have been trying to sweep through the width of a transistor to see the effects if has on Id, I read in the ngspice manual, section 17.5.58 that a reset command is needed after any alterparam command, but when I run this simulation I get the error below. I am just a little unsure of how to fix this as it says w is undefined, but I thought I defined W properly in the code section.
🌍 1
s
Stefan Schippers
11/04/2022, 1:51 PM
Use
alterparam W=$&w_act
Also add a .
options savecurrents
outside the .control block and a
save all
inside the control block, before the run statement
Stefan Schippers
11/04/2022, 2:18 PM
also remove the 'u' suffix from start_w, stop_w, delta_w, since sky130 scales all numbers by 1e-6. Also add a remzerovec before the write command to remove vectors with no values (I can't be more precise on this, ask ngspice developers why this is needed). Here the test schematic. Sending also the .sch file, save it as
test_sweep_mos_w.sch
The commands:
Copy code
* ngspice commands
.param W=1
.options savecurrents
.dc v2 0 1.8 0.01
.control
let start_w = 1
let stop_w = 90
let delta_w = 5
let w_act = start_w
while w_act le stop_w
alterparam W = $&w_act
reset
save all
run
remzerovec
write test_sweep_mos_w.raw
let w_act = w_act + delta_w
set appendwrite
end
.endc
@Thomas Figura the above example is now part of the
xschem_sky130
test schematics. It is a good starting point if one needs to sweep a device parameter. Much better than starting from scratch, since as you have seen there are some quirks (the remzerovec, the $& prefix ...) I also have spent some time figuring out all these things some time ago.
Linen is a search-engine friendly community platform. We offer integrations with existing Slack/Discord communities and make those conversations Google-searchable.