https://open-source-silicon.dev logo
Title
h

Hadir Khan

05/14/2023, 4:26 AM
Hi, I am trying to simulate a basic nfet circuit however, I am not sure why nothing happens when I click the Simulate button. I am trying to do transient analysis however nothing happens. I have also attached the spice file. I think it should be importing the .lib file for sky130 transistor models but it is not doing so. I have to do that manually and run ngspice manually from the terminal to make it work.
s

Stefan Schippers

05/14/2023, 7:43 AM
Add a lne in the STIMULI code block:
.lib /path/to/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
You can also add this component (code.sym) in your design, it will add the .lib line automatically using the PDK_ROOT variable. This makes the design more portable.
By nothing happens what do you mean? Does ngspice start and exit with an error? no ngspice process starts? If the
.lib
line is missing in the .spice netlist the expected outcome is an ngspice error (can't find models).
h

Hadir Khan

05/14/2023, 5:40 PM
By nothing I mean no window opens up or no error message box opens up. If I look in the terminal I see "Simulation started"
Also, when I click the netlist button I did not know that xschem saves the spice netlist in a hidden .xschem folder, shouldn't the default behavior be to save the spice file in the folder from where I invoked xschem? Or am I missing some configuration stuff? I don't see it in the tutorial video
I have to then manually invoke ngspice from the command line to start the simulation
s

Stefan Schippers

05/14/2023, 9:44 PM
Ensure you have the xterm terminal emulator program installed (
sudo apt install xterm
) it is a small package and it is a well working terminal emulator. Xschem uses by default
xterm
when launching ngspice. Ngspice is run inside a terminal so after simulation is completed you may give additional commands to ngspice and see the error/warning messages. Of course you can use any terminal emulator with xschem (like gnome-terminal etc, see
terminal
in xschemrc) but since most "modern" desktop environment terminals are half broken I suggest to use xterm. Simulation results are saved by default into
~/.xschem/simulations
, however you can change the location by changing the
netlist_dir
variable in xschemrc. You can also set variable
local_netlist_dir
to 1 (
set local_netlist_dir 1
) so the netlists will be automatically saved into the directory containing the schematic, in a
simulation/
folder. If you use xschem interactively by giving tcl commands you may do something like:
set netlist_dir [xschem get current_dirname]/spice; xschem netlist
to have the netlist saved into a
spice/
folder into the directory containing the current schematic (this directory is not necessarily the current directory, like 'pwd'). You can also add:
set netlist_dir {}
in your xschemrc. This will set it to an empty value, forcing xschem to ask you to choose a netlist directory the first time you want to generate a netlist.
You may also set :
set netlist_dir [pwd]
in xschemrc to force saving netlist and running simulations in the directory where you started xschem.
h

Hadir Khan

05/14/2023, 10:59 PM
@Stefan Schippers Thanks for the detailed help. Upon doing
echo $TERM
I got
xterm-256color
which means I am using xterm
I am trying to do a simple transient analysis and have the two code blocks shown in the schematic. Pressing the Simulate button and Waves button does nothing for me. I also tried doing Simulation -> Edit Netlist but nothing opens up. I have to go to the spice netlist from the terminal to edit it
s

Stefan Schippers

05/16/2023, 10:57 PM
to investigate the issue see the video.