Running Netgen: Extracting a Netlist From Layout
Layout Versus Schematic (LVS) verification validates that physical layout geometries implement the exact circuit defined in the logical netlist. In digital implementation, the golden reference is the final powered gate-level netlist. This netlist includes clock tree buffers, physical tap cells, decap cells, and ECO sizing modifications. This laboratory exercise extracts a circuit netlist with Magic and verifies equivalence with Netgen.
Step 1: Layout Extraction Using Magic
Magic extracts electrical devices and connectivity by analyzing intersecting polygons and contact cuts:
magic -dnull -noconsole \
-rcfile "$PDK_ROOT/sky130A/libs.tech/magic/sky130A.magicrc" <<'EOF'
gds read runs/uart_full/results/final/gds/uart_top.gds
load uart_top
select top cell
extract do local
extract all
ext2spice lvs
ext2spice -o uart_extracted.spice
quit -noprompt
EOF
Key extraction commands include:
extract all: Identifies standard cell devices and net connectivity across all layout layers.ext2spice lvs: Formats output subcircuits to match gate-level structural conventions.ext2spice -o: Generates the physical SPICE netlist (uart_extracted.spice).
Step 2: Executing Netgen LVS
Netgen compares the extracted layout netlist against the synthesized structural Verilog netlist:
netgen -batch lvs \
"uart_extracted.spice uart_top" \
"runs/uart_full/results/final/verilog/gl/uart_top.v uart_top" \
"$PDK_ROOT/sky130A/libs.tech/netgen/sky130A_setup.tcl" \
uart_lvs.report
The arguments provide cell references, source netlists, and the SkyWater 130nm setup script (sky130A_setup.tcl). The setup script defines pin interchangeability and transistor combination rules.
Interpreting a Passing LVS Report
Inspect the summary section of uart_lvs.report:
Subcircuit summary:
Circuit 1: uart_top |Circuit 2: uart_top
--------------------------------------------|--------------------------------------------
sky130_fd_sc_hd__dfxtp_2 (96) |sky130_fd_sc_hd__dfxtp_2 (96)
sky130_fd_sc_hd__nand2_1 (143) |sky130_fd_sc_hd__nand2_1 (143)
sky130_fd_sc_hd__xor2_4 (1) |sky130_fd_sc_hd__xor2_4 (1)
sky130_fd_sc_hd__buf_6 (1) |sky130_fd_sc_hd__buf_6 (1)
... |...
Number of devices: 1406 |Number of devices: 1406
Number of nets: 1842 |Number of nets: 1842
--------------------------------------------------------------------------------------------
Netlists match uniquely.
Cell pin lists are equivalent.
Device classes uart_top and uart_top are equivalent.
Final result: Circuits match uniquely.
A passing report verifies four conditions:
- Device Totals: Both sources contain identical counts (1,406 devices).
- Cell Distributions: Specific standard cell counts match across all types, including ECO cells (
xor2_4andbuf_6). - Net Totals: Both representations contain identical node counts (1,842 nets).
- Unique Matching: The graph isomorphism algorithm resolves all topologies without ambiguity.
| Verification Scope | Verified by LVS | Verified by Other Tools |
|---|---|---|
| Device and Net Topology | Identical connectivity | N/A |
| Accidental Shorts / Opens | Zero missing connections | N/A |
| Timing Constraints | N/A | Static Timing Analysis (OpenSTA) |
| Geometric Integrity | N/A | Design Rule Checking (Magic) |
| Functional Correctness | N/A | Gate-Level Simulation / Formal Verification |
Extraction Sanity Check
Verify that extraction did not drop subcircuits during processing:
awk '/^\.subckt uart_top/ {on=1; next} /^\.ends/ {on=0} on && /^X/ {n++} END {print n}' \
uart_extracted.spice
The output count must match the 1,406 instances reported in the LVS summary.
Practice Exercise
An LVS run against the final gate-level netlist passes cleanly. However, comparing the final netlist with the initial Module 2 synthesis netlist reveals 80 additional cells, including clock buffers and physical tap cells. Explain why this discrepancy does not indicate an LVS failure.
Solution
LVS evaluates equivalence between the physical layout and the final gate-level netlist. The 80 additional cells represent physical infrastructure added during the flow:
- Clock Tree Synthesis inserted clock distribution buffers.
- Floorplanning inserted well tap cells and decap cells.
- Timing closure inserted ECO buffers and resized gates.
Because the final netlist includes these modifications, the layout matches the netlist. Verifying that these implementation changes preserve functional equivalence is the responsibility of formal verification or gate-level simulation.
LVS confirms that physical geometries match the intended netlist. The next article demonstrates how to diagnose and resolve open circuits and short circuits reported by Netgen.