Magic, Netgen and KLayout
Yosys and OpenROAD, from the previous article, build things: a netlist, then a placed and routed layout. This article is about the tools whose job is to look at what got built and confirm it is correct and manufacturable. That is a different kind of job and needs different tools.
Magic: the original interactive layout tool
Magic is one of the oldest continuously used pieces of EDA software, and it earns its place by doing three jobs: it is an interactive layout editor (draw, inspect and hand-edit polygons), a DRC engine (check those polygons against a fab’s rules), and a GDS export tool (stream a finished layout out in the format a fab consumes). In this course’s flow Magic runs mostly non-interactively inside OpenLane, but its interactive mode is how a physical designer zooms into a cell and looks at the mask polygons this course keeps referring to.
Launching it against the SKY130 technology file, pointed at a layout:
magic -T sky130A.tech design.mag
What you see is a colour-coded, zoomable canvas, each colour a mask layer per the technology file (polysilicon one colour, diffusion another, metal1 another), with a Tcl console alongside for editing and query commands. This is the tool that makes layer 4 of the abstraction stack, mask polygons, something you can look at.
Netgen: does the layout match the netlist?
A question DRC can never answer: after placement, routing and every other transformation, is the circuit the layout implements still the circuit in the netlist you started with? A layout can be perfectly DRC-clean, every polygon spaced and sized correctly, and still be electrically wrong, if a routing bug shorted two nets or left a connection open.
That is what LVS, layout versus schematic, catches, and Netgen does it in this stack. Netgen extracts a netlist from the layout’s geometry (transistor-level, from the polygons) and compares it, device by device and net by net, against the netlist synthesis produced. A clean LVS result is a strong, independent guarantee that what we asked the tools to build and what got built are the same circuit.
KLayout: a second, independent set of eyes
KLayout is first a fast, general-purpose layout viewer, the tool most people use day to day to look at a GDSII, since it opens large layouts quickly and does not need the full Magic technology setup just to browse. But KLayout also has its own DRC and LVS engine, implemented independently of Magic and Netgen.
That independence is the point. Running DRC through both Magic and KLayout, two separately written rule checkers against the same SKY130 deck, catches a class of error neither can catch alone: a bug in one tool’s own implementation of a rule. If both agree the layout is clean, that is a stronger signoff claim than either result on its own, and if they disagree, the disagreement is worth chasing before tapeout. It is the same principle as two independent reviewers checking a proof. Commercial signoff flows do the analogous thing, often running the vendor’s deck and the fab’s own golden deck before agreeing to tape out. Module 9 puts this into practice: Magic DRC, then an independent KLayout DRC pass, on the same final layout. Treating the two passes as redundant and skipping one once the other is clean defeats the purpose of running either.
Practice Exercise
A layout passes Magic DRC but fails Netgen LVS, reporting a short between two nets that should be separate. Explain why this is not a contradiction: how can a layout be DRC-clean and LVS-broken at the same time?
Solution
DRC and LVS check different properties. DRC asks geometric questions, is every polygon sized, spaced and shaped according to the fab’s rules, with no notion of what the polygons should connect to. LVS asks a connectivity question, does the circuit implemented by this geometry match the intended circuit, and is indifferent to whether the geometry is otherwise well formed. A routing error that puts two correctly shaped, correctly spaced wires in contact when they should not be connected can be legal by every DRC rule (each wire individually obeys width and spacing) while creating a real short between nets that were never meant to touch. DRC structurally cannot see it, because DRC never looks at intent, only geometry.
In the next article we tie Yosys, OpenROAD, Magic, Netgen and KLayout together under the tool that runs them in the right order with the right handoffs: OpenLane.