UP

XSCHEM SKY130 INTEGRATION


To use Xschem with the Google-Skywater 130nm process (here: Sky130) The following items must be followed:



PDK_ROOT and PDK environment variables

Xschem (via the xschemrc file) looks for a PDK_ROOT environment variable that points to the installed pdk to use. This is expecially useful if multiple or different versions of the pdk are installed. If the pdk is installed in /usr/local/share/pdk PDK_ROOT should be set to /usr/local/share/pdk. For Sky130 another variable PDK tells the process variant to use (currently sky130A) or sky130B). If PDK is unset the default sky130A will be used. If no PDK_ROOT variable is defined xschem will look into the following locations and pick the first existing found in the order listed below:

  1. /usr/share/pdk
  2. /usr/local/share/pdk
  3. ~/share/pdk

If no pdk is found a warning message is displayed on the xschem launching terminal.

Simulating a circuit with sky130 devices

The best way to quickly set up a simulation with Xschem is to look at some of the provided examples. If you descend into the test_inv component you see a working circuit ready for simulation.



One line is needed in the spice netlist to load the spice models:

.lib /usr/local/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt 

The exact path depends on the install location of the pdk as explained above. In the picture above the TT_MODELS component takes care of generating the .lib line in the netlist. the tt at the end of the .lib line is the process corner (tt = typical n, typical p transistors). You can change the corner to ss, sf, fs, ff to verify your design across process variations.

You see in the circuit a COMMANDS2 component. This component allows to enter text to specify the simulation to run, giving simulator commands and options. You place this component by pressing the Insert or i key, browsing into the standard xschem devices directory and placing code_shown.sym or code.sym into the schematic.



Once placed in the schematic, you may click the component, press q to edit its attributes, set the Edit attr. listbox on the right to value and enter the simulator commands to run the simulation. You can give a reference name to this component by setting the Edit attr. listbox to name and give it a name that will be diplayed in the schematic. (COMMANDS2 in the example).



Note in above commands a write test_inv_ngspice.raw command. This example runs simulation with both Xyce and ngspice so the output raw file is differentiated. If you just plan to use one simulator a good suggestion is to write a raw file with the same name as the circuit, so write test_inv.raw.

If you select the TT_MODELS component and press q you see the reference to the PDK top library SPICE file. The path is specified using TCL variables that have been generated by xschem when the pdk installation was looked up. This allows to have portable schematics, no absolute path is hardcoded in the schematic files.



If everything is set up correctly pressing the Netlist button or hitting the n key will produce a spice netlist of the circuit. The netlist location is by default set to your home directory: ~/.xschem/simulations


schippes@mazinga:~/x/test_open_pdks$ ls -ltr ~/.xschem/simulations/
...
...
-rw-r--r-- 1 schippes schippes      3266 ott 18 15:26  test_inv.spice 

You can then simulate the circuit. Select the simulator to use by clicking menu Simulation->Configure simulators and tools and selecting (for this example) ngspice



Press the Simulation button and see the ngspice running in a terminal:



The default terminal used by xschem to run the simulator is xterm. I strongly suggest you to install xterm (on ubuntu/debian Linux: sudo apt-get install xterm) since it is a very small package and is not a broken terminal like most Gnome/KDE/LXDE stuff. You can however use any terminal editor by specifying the one to use in your xschemrc. If not specified xschem defaults to xterm

## set terminal xterm
set terminal gnome-terminal

After completing simulation you can add into the schematic a graph (Simulation->Add waveform graph) and a waveform reload launcher (Simulation->Add waveform reload launcher). The launcher has a tclcommand attribute that loads the simulator data file (test_inv.raw) and specifies the type of analysis (op, dc, ac, tran)



See the manual for details