Christoph Maier
05/22/2024, 10:19 AMsource
, include
, or .lib
from within a ngspice control structure without having to terminate and restart ngspice entirely?Stefan Schippers
05/22/2024, 11:32 AMset appendwrite
)Christoph Maier
05/22/2024, 11:42 AM.lib <model> <corner>
that allows process corner analysis from within a ngspice control structure?Stefan Schippers
05/22/2024, 12:26 PMtt
to ss
or ff
, using alter
/ altermod
/ alterparam
, but I never tried that, expecially with sky130 models that are a black hole of recursively called files. Usually I keep the corner switching as the outermost loop and I simply restart ngspice on the new corner. Not a solution to your problem, though.Christoph Maier
05/22/2024, 2:06 PMStefan Schippers
05/22/2024, 4:06 PMfor c in ss tt ff; do
# replace last 2 chars in .lib lines with $c
sed -i "/^\.lib /s/..\$/$c/" test_nmos.spice
# modify raw file name in write statements (test_nmos_$c.raw)
sed -i "s/^write test_nmos.*/write test_nmos_$c.raw/" test_nmos.spice
ngspice -i test_nmos.spice
done
Christoph Maier
05/22/2024, 6:10 PMLuis Henrique Rodovalho
05/22/2024, 7:23 PMLuke Harold Miles
05/23/2024, 12:20 AMStefan Schippers
05/23/2024, 12:20 AMLuke Harold Miles
05/23/2024, 12:21 AMLuke Harold Miles
05/23/2024, 12:23 AMlet corner = v(dd) * 0 + $corner
in the script. So you either need a node named dd
or can edit script to your conventionLuke Harold Miles
05/23/2024, 12:24 AMMy problem is how to keep python script kiddies off my lawnrip. there's no dependencies though
Luke Harold Miles
05/23/2024, 12:25 AMStefan Schippers
05/23/2024, 12:43 AMxschem load poweramp.sch
set id_list {}
xschem netlist
set id [simulate]
# some delay to allow ngspice to start and read the netlist before changing it
delay 1000
lappend id_list $id
# change VPP, output file name and input signal amplitude
set commands [xschem getprop instance NGSPICE value]
regsub {\.param VPP=50} $commands {.param VPP=30} commands
regsub -all {poweramp\.raw} $commands {poweramp1.raw} commands
xschem setprop instance NGSPICE value $commands
xschem setprop instance V3 value {dc 0 sin 0 0.5 {frequ} 1m}
xschem netlist
set id [simulate]
# some delay to allow ngspice to start and read the netlist before changing it
delay 1000
lappend id_list $id
# change again VPP and output file name
regsub {\.param VPP=30} $commands {.param VPP=25} commands
regsub -all {poweramp1\.raw} $commands {poweramp2.raw} commands
xschem setprop instance NGSPICE value $commands
xschem netlist
set id [simulate]
# some delay to allow ngspice to start and read the netlist before changing it
delay 1000
lappend id_list $id
# poll loop
while {1} {
delay 1000
set busy 0
foreach id $id_list {
set var "execute(cmd,$id)"
if {[info exists $var]} { set busy 1}
}
if {!$busy} { break }
}
puts Done
does exactly that. See video.