Practice
Hands-On Labs
Nine labs that move the course's numbers from the page into your own runs: a first S-parameter, lines and matching, RF transistors, on-chip inductors, then the blocks of the course radio and the radio itself. Every lab runs in IIC-OSIC-TOOLS and analyses its results in Python with scikit-rf.
Contents
How the labs work
Each lab is one page with the same parts:
- At a glance: the goal, the chapters it uses, the time it takes and its files.
- Hand calculation: a few lines of arithmetic to do before you simulate, so that you know what number to expect.
- Steps: commands to copy and paste. Each step names the file it runs and what to look at in its output.
- Checkpoint: a table of the numbers you should get, with a tolerance, next to the chapter’s own value where the chapter has the same quantity.
- Questions: for thinking, not for simulating.
- Extension: where you leave the prepared path and change something.
The files of lab N live in the course files under tools/labs/labN/. They are of three kinds:
- Netlists (
*.cir) that you can run on their own withngspice -b. They write their results into the folderout/: Touchstone files (.s2p) for S-parameters, text files for noise parameters, and a log. - Python scripts that run those netlists and analyse the results with scikit-rf. They print the checkpoint numbers, save their plots as PNG files in
out/, and store the numbers inlab_numbers.json. lab_numbers.json, the checkpoint numbers as our own runs of the scripts printed them. Your run overwrites it, so compare before you rerun, or keep a copy.
All labs share two helpers in tools/labs/common/. labkit.py runs ngspice, reads its Touchstone and noise files into a scikit-rf Network, and saves numbers and figures; read it once, because every script uses it. iic.sh runs a command in the container from your own computer (see the next section).
Why scikit-rf
The chapters use the course’s own small helpers in
tools/rfic, written to show the maths. The labs use scikit-rf [30, 215] instead: a mature, tested package that reads Touchstone files, converts between S, Y, Z and ABCD parameters, computes gains, stability and noise parameters, builds transmission-line media, de-embeds and fits rational models. Seeing the same numbers come out of a second, independent code is itself a check, and scikit-rf is what you will use after the course.
The environment
Every lab runs in IIC-OSIC-TOOLS release 2026.10 [193], the Docker image used throughout the course. Lab 0 installs it. The image holds everything the labs need:
| Tool | Version in 2026.10 | Used in |
|---|---|---|
| ngspice | 47 | every lab: op, dc, sp with noise, LTRA lines, fitted subcircuits |
| Palace and IHP’s gds2palace | as in the image | Lab 3 (optional EM step) |
| Python | 3.12 | every lab |
| scikit-rf | 2.1.0 | every lab |
| NumPy, SciPy, Matplotlib | 2.5, 1.18, 3.11 | every lab |
| python-control | 0.10.2 | available for the loop analyses of the later labs |
| Xyce, KLayout | 7.10, as in the image | the later labs |
You can run the commands of a lab in two ways, with the same result.
Inside the container. Open a terminal on the container’s desktop (or attach a shell with docker exec). The course files sit in the shared folder, /foss/designs/rfic-design, so that they survive the container:
cd /foss/designs/rfic-design/tools/labs/lab0
python3 lab0.py
From your own computer. With Docker installed, run each command through tools/labs/common/iic.sh. It starts the image, mounts the course folder at /foss/designs/rfic-design, runs the command in the folder you are in, and removes the container again:
cd ~/eda/designs/rfic-design/tools/labs/lab0 # wherever you unpacked the course files
../common/iic.sh python3 lab0.py
The script is a short wrapper around one docker run; written out, the command above is
docker run --rm -i -v ~/eda/designs/rfic-design:/foss/designs/rfic-design \
-w /foss/designs/rfic-design/tools/labs/lab0 --entrypoint /bin/bash \
hpretl/iic-osic-tools:2026.10 -lc "python3 lab0.py"
The login shell (-lc) sets up the tools’ paths as the container’s own terminal does. On Linux, iic.sh also passes your user ID, so the files the labs write belong to you. On Windows, run it from WSL.
How checkpoints are judged
Every value in a checkpoint table is what the lab’s own scripts printed in IIC-OSIC-TOOLS 2026.10, and is stored in the lab’s lab_numbers.json. The simulations are deterministic, so in the same image your run should give the same numbers. Each table gives a tolerance:
- Simulated values carry the tolerance of the rounding: the digits in the table, ±1 in the last digit. A larger difference means the run is not the one in the table: a changed netlist or parameter, a model line pointing elsewhere, or another release of the image.
- Hand calculations are judged against the simulation with the tolerance the table states, usually a few per cent. The point is to know why they differ.
- Electromagnetic results of your own Palace run (Lab 3) are judged against the provided Touchstone file with the tolerance the lab states.
Where a chapter quotes the same quantity, the table puts the chapter’s value beside the lab’s. In Labs 0–3 every one of them agrees; if a lab ever disagrees with its chapter, the lab says so and explains why. If your number differs from the table by more than the tolerance, stop and find out why before you go on: that habit is the main thing the labs teach.
The labs
Table L.1. The nine labs, the chapters each one uses and the time to set aside (reading the chapter not included).
| Lab | Topic | Chapters | Time |
|---|---|---|---|
| Lab 0 | Tools and a first S-parameter: the container, the course files, ngspice sp, Touchstone and scikit-rf |
1, 2 | 1–2 h, most of it downloading the image |
| Lab 1 | Lines, the Smith chart, matching and de-embedding | 3, 7, 8 | 3 h |
| Lab 2 | RF transistors: fT, fmax, MAG/MSG, stability and noise parameters | 6 | 2–3 h |
| Lab 3 | On-chip inductors: EM, L, Q and SRF, a π model and vector fitting | 7, 18 | 2 h, plus 15–20 min for the optional EM run |
| Lab 4 | The course LNA at 2.4 GHz | 9 | 3 h |
| Lab 5 | The course I/Q mixer | 10 | 3 h |
| Lab 6 | The VCO and the PLL around it | 11, 12 | 2 × 3 h |
| Lab 7 | The power amplifier | 16 | 3 h |
| Lab 8 | Capstone: the transceiver budget, block by block | 5, 19 | 2 × 3 h |
Labs 0–3 build the tools and the components, and Labs 4–8 use them on the blocks of the course radio. Take Labs 0–3 in order. The Course Plan spreads all nine over fourteen weeks; it runs the matching part of Lab 1 after Chapter 8 and the vector-fitting part of Lab 3 after Chapter 18.
Getting the course files
The labs, the chapter scripts and the course’s Python helpers come as one folder, rfic-design. Put it in the container’s shared folder, so that it survives the container:
cd /foss/designs
ls rfic-design/tools/labs # common lab0 lab1 ... lab8
The folder holds tools/ (the labs in tools/labs/, the chapter scripts in tools/figs/, the electromagnetic layouts and results in tools/em/, the helpers in tools/rfic/) and the licence.
Python packages
Table L.2. What the labs use from each package.
| Package | What the labs use it for |
|---|---|
| scikit-rf [30] | Network (Touchstone files, S/Y/Z/ABCD, stability, max_gain, max_stable_gain, unilateral_gain, noise parameters), media (DefinedGammaZ0, DistributedCircuit, MLine), calibration.deembedding (Open, OpenShort), vectorFitting.VectorFitting |
| NumPy [31] | arrays, eigenvalues of ABCD matrices, interpolation |
| SciPy [178] | optimize.least_squares (π-model fit), optimize.brentq (stub lengths) |
| Matplotlib [179] | the plots, in the course’s style (tools/rfic/style.py) |
| python-control [180] | transfer functions and loop analysis, where a later lab needs them |
| gds2palace [206], gdspy | Lab 3: layout and EM model of a spiral for Palace [197] |
None of them needs to be installed: they are all in the image. Run the labs in the container, even if your own computer has Python: the netlists load the SG13G2 models from the container’s /foss/pdks, and the checkpoint tables hold for the image’s versions.