Is it possible to speed up analog sims in ngspice?...
# sky130
d
Is it possible to speed up analog sims in ngspice? I mean, in particular, I believe the first part takes quite long because it fetches the
.lib /usr/local/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
However in my case I have a relatively small circuit which only uses two types of devices, sky130_fd_pr__nfet_01v8 and sky130_fd_pr__pfet_01v8, so I wonder is it possible to get it to fetch only those devices used in the circuit? Even telling it somehow. That would speed things up a lot, in particular for quick iteration (optimization) over a circuit. Otherwise every time I make a small change on the circuit the sim takes a few minutes to run, which is quite impractical. I'm pretty sure somebody has encountered this issue before. Is there a way to do this, to speed up the simulation cycle speed? Thanks
a
there is opened case in openpdks. There is a workaround that might or might not fit you.
s
@User,just to be sure, did you create a
.spiceinit
file in the directory where ngspice runs with following contents?
Copy code
set ngbehavior=hsa
set ng_nomodcheck
this speeds model file parsing a lot, from several minutes to ~30 seconds on my very old laptop.
d
At the moment I am running ngspice sims in batch mode from the command line. I have just put the
.spiceinit
in the folder where my netlist resides which is the folder from where I launch ngspice (in batch mode from terminal with ngspice -b etc...) and no speed improvement. So, the
.spiceinit
file only helps if I run the sims from Xschem?
s
@User no, the .spiceinit is a ngspice file It should improve model parsing time, either in batch or interactive mode, from xschem or not. What version of ngspice do you have?
d
Version 31 I think it is.
Copy code
darunix@darunix-VirtualBox:~/GitSandboxes/VCO/vco/xschem$ time ngspice -b -o ./mycircuit_tb.log ./mycircuit_tb.spice 
******
** ngspice-31 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Please get your ngspice manual from <http://ngspice.sourceforge.net/docs.html>
** Please file your bug-reports at <http://ngspice.sourceforge.net/bugrep.html>
** Creation Date: Sun Oct 27 09:07:06 UTC 2019
******

Batch mode

Comments and warnings go to log-file: ./mycircuit_tb.log


real	3m43,673s
user	1m47,017s
sys	0m2,693s
s
This is the reason, you must get ngspice from git and build a newer version (35 or newer) https://git.code.sf.net/p/ngspice/ngspice
d
Thanks