Lab 0
Set Up the Tools
Install IIC-OSIC-TOOLS, get the lab files and run your first testbench in both PDKs.
Contents
| Lab 0 at a glance | |
|---|---|
| Goal | Install IIC-OSIC-TOOLS, get the lab files and run your first testbench in both PDKs. |
| Reproduces | Chapter 2 (Sections 2.2–2.5) and the inverter of Figure 1.2 |
| Time | 1–2 hours, most of it downloading the image |
| Files | labs/lab0: inverter_tb.sch per PDK, first_sweep.py; tools/xschem/ch02 |
Steps
- Install and start the container as described in Section 2.2: run the installer, then start it pinned to the release this book uses,
DOCKER_TAG=2026.10 ./start_vnc.sh, and open the desktop in your browser. -
Get the lab files. Open a terminal in the container and download the course files into the shared folder, so that your work survives the container:
cd /foss/designs wget -q https://www.skillsurf.org/art_of_aicd/assets/downloads/art_of_aicd.zip unzip -q art_of_aicd.zip && rm art_of_aicd.zip cd art_of_aicd/labs && ls # lab0 ... lab8, sim.sh, corners.pyThe archive holds the lab files (
labs/) and the Python helpers and figure scripts of the whole course (tools/). On your own computer the same files appear in~/eda/designs/art_of_aicd. Download it again when the course is updated. -
Smoke test in SG13G2, the default PDK of release 2026.10. Run the inverter of Figure 1.2 (Wn = 1 µm, Wp = 2 µm, minimum length) from the terminal:
cd lab0/sg13g2 ../../sim.sh inverter_tb.schIt sweeps the input from 0 to \(V_{DD}\) and prints the peak small-signal gain, the input where it occurs, the switching threshold \(V_M\) (the input at which the output equals the input) and the input range over which the gain exceeds one.
- Repeat in the GUI.
xschem inverter_tb.sch &, press Netlist and Simulate, and at the ngspice prompt typeplot v(out) gain. Then change the PMOS width (double-click the transistor, setw=4u), simulate again and watch \(V_M\) move. -
Switch to SKY130 in the same terminal and run the SKY130 copy:
sak-pdk sky130A cd ../sky130 ../../sim.sh inverter_tb.sch # about 20 s: the SKY130 library is large - Chapter 2’s testbench and script. Open the testbench of Figure 2.3,
tools/xschem/ch02/nmos_tb_sky130.sch(andnmos_tb_sg13g2.schaftersak-pdk ihp-sg13g2), simulate it from the GUI, then run the Python sweep of Section 2.5 fromlabs/lab0:python3 first_sweep.py.
SG13G2 vs SKY130 · Which SKY130 models the labs use
Xschem’s SKY130
cornersymbol loads the combined (continuous) models oflibs.tech/combined, while every SKY130 number in this book comes from the original binned models oflibs.tech/ngspice(Section 3.5). The two agree to within 1 % at the widths the binned models were fitted at, but not everywhere: the inverter of this lab peaks at a gain of 12.88 with the binned set and 11.87 with the combined one. To reproduce the book, the SKY130 lab schematics do not use the corner symbol. TheirMODELSblock holds the.libline itself,.lib /foss/pdks/sky130A/libs.tech/ngspice/sky130.lib.spice ttand a corner is changed by editing its last word (
ss,ff,sf,fs,tt_mm). The SG13G2 schematics use.lib cornerMOSlv.lib mos_ttas in Chapter 2. If you run the netlists outside IIC-OSIC-TOOLS, addset ngbehavior=hsaandset ng_nomodcheckto your~/.spiceinit(the container sets both): withouthsa, ngspice bins a multi-finger SKY130 transistor on its total width instead of its finger width, and the multi-finger devices of Labs 3 to 8 come out wrong. For SG13G2 outside the container, load the PSP model yourself withpre_osdi .../osdi/psp103.osdi, as in Section 2.6.
Checkpoint
Table 18.1. Lab 0 results (tt, 27 °C). The first three rows reproduce Figure 1.2.
| Quantity | SG13G2 | SKY130 |
|---|---|---|
| Peak gain of the inverter, at \(V_{in}\) | 17.19 at 0.616 V | 12.88 at 0.849 V |
| Switching threshold \(V_M\) (\(V_{out} = V_{in}\)) | 0.617 V | 0.870 V |
| Input range with gain > 1 | 0.542–0.692 V | 0.744–0.980 V |
| \(V_M\) with Wp = 1 µm / 4 µm | 0.582 / 0.651 V | 0.838 / 0.906 V |
first_sweep.py: \(I_D\) and \(g_m/I_D\) at \(V_{GS} = V_{DD}/2\) |
196.2 µA, 5.6 V⁻¹ | 106.8 µA, 6.5 V⁻¹ |
| Chapter 2 testbench: \(I_D\) at \(V_{GS} = V_{DS} = V_{DD}\) | 1.28 mA | 1.14 mA (combined models) |
Questions
- Doubling Wp moves \(V_M\) by 34 mV in SG13G2 and 36 mV in SKY130. Use the square law with the \(\mu C_{ox}\) ratios of Table 4.2 to explain the direction, and why the shift is so small.
- Why does the gain collapse on both sides of \(V_M\)? Which transistor leaves saturation first when the input rises?
sim.shrefuses to run a SKY130 schematic whenPDKisihp-sg13g2. Why does Xschem need the PDK setting to netlist a schematic, before any simulation?
Extension
Find the PMOS width that puts \(V_M\) at exactly \(V_{DD}/2\) in your PDK, and compare the ratio Wp/Wn with the ratio of the minimum-length \(\mu C_{ox}\) values of Table 4.2. Then replace the MODELS block of the SKY130 schematic by the corner symbol (from the sky130_fd_pr library) and see how much the peak gain changes.