Example: Same Net — Star Topology¶
File: pics/same_net.pic.yml
What it tests: Three pads all on the same net, connected via two routes through a central hub pad. Tests that Elvis correctly handles multi-branch nets and doesn't flag valid branching as a short.
import tempfile
from pathlib import Path
import elvis
import gdsfactory as gf
from IPython.display import Markdown
from kwasm import Tool, show
gf.gpdk.PDK.activate()
PICS = Path("../pics")
BUILD_GDS = Path("../build/gds")
BUILD_GDS.mkdir(parents=True, exist_ok=True)
PIC = PICS / "same_net.pic.yml"
Schematic¶
pad2 sits at the center, connected to both pad1 and pad3. The triangular arrangement forms a star net — all three pads on the same net.
{'same_net': {'instances': {'pad1': {'component': 'pad', 'settings': {}},
'pad2': {'component': 'pad', 'settings': {}},
'pad3': {'component': 'pad', 'settings': {}}},
'routes': {'bundle1': {'links': {'pad2,e4': 'pad1,e2'},
'routing_strategy': 'route_bundle_electrical',
'settings': {'allow_layer_mismatch': False,
'allow_type_mismatch': False,
'allow_width_mismatch': False}},
'bundle2': {'links': {'pad2,e4': 'pad3,e2'},
'routing_strategy': 'route_bundle_electrical',
'settings': {'allow_layer_mismatch': False,
'allow_type_mismatch': False,
'allow_width_mismatch': False}}},
'ports': {},
'placements': {'pad1': {'x': 0,
'y': 0,
'dx': -281.78,
'dy': -140,
'rotation': 0,
'mirror': False},
'pad2': {'x': 0,
'y': 0,
'dx': 28.02,
'dy': 128.78,
'rotation': 0,
'mirror': False},
'pad3': {'x': 0,
'y': 0,
'dx': 268.59,
'dy': -145.57,
'rotation': 0,
'mirror': False}}}}
Build from schematic¶
gds_path = BUILD_GDS / "same_net.gds"
c = gf.read.from_yaml(schematic["same_net"])
c.write_gds(gds_path)
show(gds_path, netlist=PIC, tools=[Tool.RULER, Tool.CLEAR_ALL, Tool.INSTANCE_PORTS])
Inspect the Simplified Netlist¶
simplified = elvis.simplify(schematic, remove_twoports="all")
print("Simplified instances:", list(simplified["instances"].keys()))
print("\nNets (after routing collapse):")
for net in simplified.get("nets", []):
print(f" {net['p1']} — {net['p2']}")
Simplified instances: ['pad1', 'pad2', 'pad3']
Nets (after routing collapse):
pad2,e4 — pad1,e2
pad2,e4 — pad3,e2
LVS Results¶
rdb = elvis.lvs_rdb(
gds_path,
schematic,
short_layers=[(49, 0)],
equivalent_ports={"pad": ["pad", "e1", "e2", "e3", "e4"]},
)
lyrdb = Path(tempfile.gettempdir()) / "same_net.lyrdb"
rdb.save(str(lyrdb))
show(
gds_path,
lyrdb=lyrdb,
netlist=PIC,
tools=[Tool.SELECT, Tool.RULER, Tool.CLEAR_ALL],
)
flags used
The above LVS function is called with the following flags
- short_layers=[(49, 0)]
- equivalent_ports={'pad': ["pad", "e1", "e2", "e3", "e4"]}
this can also be pre-configured.
No errors:
print(f"ok={rdb.num_items() == 0}, error_count={rdb.num_items()}")
Markdown(elvis.error_summary(rdb))
ok=True, error_count=0
| cell | error type | description |
|---|---|---|
Elvis Behavior Highlighted¶
Branching net vs. short¶
When pad2 connects to both pad1 and pad3, Elvis merges them into one net: {pad1, pad2, pad3}. This is not a short — it's intentional multi-connection. A short would be two different nets accidentally meeting.
Elvis's short detection is net-aware: overlapping polygons on the same net are ignored; overlapping polygons from different nets trigger a short_error.
Why it matters¶
Elvis distinguishes a star net (multiple connections on the same net) from a short (two different nets accidentally merged). A branching net is valid topology; a short is a defect. Getting this right matters for power distribution networks, common-ground connections, and any multi-port signal that fans out to several components — Elvis confirms these are correct without false positives.