The Shared Sizing Core — a package walkthrough

circuitgenome/sizer/shared/ — the model-independent core that both the Level-1 (square-law) sizer and the gm/Id pipeline are built on.

Two very different sizers — a card-less square-law analytical sizer and a measured gm/Id LUT pipeline — share one body of code. They can, because of a single idea: the op-amp topology relationships (gain, GBW, phase margin, CMRR) are model-independent. Only the transistor primitives differ. So the primitives hide behind one interface — DeviceModel — with two swappable implementations, and every other file in this package is written against that interface once.

↑ Up to the full sizer overview  ·  → See also: the gm/Id pipeline walkthrough (sizer/gmid/)

The architecture — one interface, two implementations

YAML config tech + spec .yaml loader.py models.py (dataclasses) taxonomy.py — naming rules DeviceModel the interface (Strategy pattern) equations.py Level-1 square law gmid_lut.py gm/Id measured LUT two implementations, one socket preprocess.py model-independent pre-sizing metrics.py metrics from solved sizing both call the interface, never the concrete model spice_sim.py facade → spice/ ngspice verification
One DeviceModel interface, two swappable implementations (square law / LUT). Every consumer is written against the interface, so one codebase serves both sizers. Click any box to open its walkthrough.

All pages

models.py
Plain dataclasses — the typed data vocabulary between stages
foundation
taxonomy.py
Slot/net naming conventions — one source of truth
foundation
equations.py
Level-1 square-law MOSFET + op-amp formulas
primitive
gmid_lut.py
gm/Id LUT + bilinear interpolation (measured BSIM4)
primitive
device_model.py
The keystone — DeviceModel interface unifying both primitives
keystone
loader.py
Load tech params + specs from YAML into typed objects
boundary
preprocess.py
Model-independent pre-sizing: KCL, slots, requirements
shared core
metrics.py
Performance metrics from a solved sizing
shared core
spice_sim.py
Facade over the spice/ ngspice verification subpackage
verification

Generated by the explain-code-with-fig skill · intuition-first walkthroughs with hand-authored SVG figures · light/dark toggle top-right.