Hi <@U01819B63HP> hope you are very well. 1. When...
# xschem
n
Hi @Stefan Schippers hope you are very well. 1. When working with SKY130A I've always done simulations using xschem (draw schematic, generate netlist and simulate files using ngspice), but this time I decided to just write the spice file from scratch and run it (fig 1). However when I do that, an error raises saying that it couldn't find some pdk files (fig 2). According to this I conclude that ngspice is looking for the pdk files from the current path I have my spice file, because when I copy-paste it into my pdk folder (in my case
/home/nelson/cad/share/pdk/sky130A/libs.tech/ngspice/
) it runs without any trouble (fig 3). I installed my pdk using the open_pdks script and also have declared the environment variable
PDK_ROOT
but I think that variable is only used by xschem and not by ngspice (fig 4). Could you give me lights with this issue? 2. Second question has to be with the import of models. When I import SKY130A models, I always use
.lib
command but reading this post in the ngspice forum, I learned that
.include
command is faster that the first one (fig5 ). Do you know another reason to use the latter one rather than the first? Thanks in advance.
s
ngspice does not understand env vars. Just add a line like this in the netlist:
.lib /usr/local/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
also ensure a
.spiceinit
file exists in the directory where ngspice runs, with following content:
set ngbehavior=hsa
set ng_nomodcheck
Also only use the skywater pdk spice models provided by open_pdks, do not directly use the skywater-pdk repository. @Tim Edwards has done a vast amount of fixes to cleanup the models and adapt to ngspice.
For the second question, you can speed up by loading only one single corner instead of using the .lib, however you must provide all the needed lines. This below example works for 'tt' corner:
Copy code
.param mc_mm_switch=0
.param mc_pr_switch=0
.include /home/schippes/share/pdk/sky130A/libs.tech/ngspice/corners/tt.spice
.include /home/schippes/share/pdk/sky130A/libs.tech/ngspice/r+c/res_typical__cap_typical.spice
.include /home/schippes/share/pdk/sky130A/libs.tech/ngspice/r+c/res_typical__cap_typical__lin.spice
.include /home/schippes/share/pdk/sky130A/libs.tech/ngspice/corners/tt/specialized_cells.spice
Of course you need to adjust the paths according to your installation.
n
With respect to add a line similar to
.lib /usr/local/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
well, I added
.lib /home/nelson/cad/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
as you can see in the images in previous messages. For the file `.spiceinit`that file doesn't exist in my system. I run
find
command but it yielded nothing (fig 2) And finally, I don't understand what you refer saying use only the skywater models.
s
You must manually create the
.spiceinit
file, it is not installed by anyone. Use a text editor, write the two lines and save as
.spiceinit
in the directory where ngspice runs (usually
~/.xschem/simulations
) For the '_use only skywater..._' I meant use the skywater spice models by installing
open_pdks
, but looking at your pictures you did exactly that, so you are OK.
n
Well it works running from a different path (fig 1) . I created that file (fig 2) but I was wondering what are all those simulation, and I think come from xschem projects. Is there any problem if I delete them? What those lines are used for?
set ngbehavior=hsa
,
set ng_nomodcheck
s
You can delete everything in ~/.sxchem/simulations, just keep .spiceinit. anytime you create a netlist for a schematic the produced file will go in ~/.xschem/simulations. You can delete these files and re-create later if you need.
ng_nomodcheck will avoidchecking unused model corners, this speeds up loading. ngbehavior=hsa will set hspice compatibility mode (see sec. 16.14 of ngspice user manual).