Case Study · DRC

Chat Case Study: Catching and Fixing a DRC Violation with klink

Three requests, three real tool calls: draw a layout with a planted spacing problem, run DRC through klink to catch it, then fix it and confirm clean.

This is a real chat transcript. Every user request below is the kind of thing a real user would say; for each one, klink's AI agent actually called the listed klink tools, drew geometry in a live, running KLayout, and ran real DRC -- the screenshot and violation count after each step are KLayout's actual results at that moment.
User
Draw two parallel metal traces, deliberately only 0.1um apart -- I want to see if DRC can catch a spacing violation.
klink agent

Opening a disposable tab and drawing two 20um-long metal lines on layer 20/0: one at y=[0,2], the other at y=[2.1,4.1] -- exactly a 0.1um gap.

view.new_tab(cell_name="DRC_CHAT_DEMO") layer.ensure(layer=20, datatype=0) shape.insert_boxes(cell, layer_index=2, boxes_um=[[0,0,20,2],[0,2.1,20,4.1]]) → inserted=2, bbox_dbu=[0,0,20000,4100]
Two metal lines 0.1um apart, nearly touching at this scale
The two lines are drawn -- the gap is only 0.1um, barely visible at this scale.
User
Run DRC with a minimum spacing rule of 0.5um.
klink agent

Writing a minimal DRC deck that runs a space(0.5.um) check on layer 20/0, executed through drc.run on KLayout's native DRC engine:

drc.run(code = ''' report("chat_drc_space", $output_rdb) m = input(20, 0) m.space(0.5.um).output("M_SPACE", "metal-to-metal space < 0.5 um") ''', output_rdb=..., result_mode="full") → rdb_summary.total_items = 1 → categories: [{name: "M_SPACE", count: 1}] → exception = null

Caught it -- real result: 1 spacing violation (category M_SPACE). To make the violation location visible in the screenshot too, I drew a highlight box on marker layer 66/0 over that 0.1um gap (the blue hatched region -- coordinates taken from the actual gap we drew, not fabricated):

layer.ensure(layer=66, datatype=0) shape.insert_boxes(cell, layer_index=..., boxes_um=[[-1,1.9,21,2.2]])
DRC violation marker: blue hatched highlight box over the 0.1um gap between the two metal lines
DRC result: 1 violation (M_SPACE). The blue hatched box is the agent's violation-location marker.
User
Move one of them out to 1um spacing and rerun DRC to confirm it's clean.
klink agent

Deleting the violation marker and the old top trace, then redrawing it at y=[3.0,5.0] -- that makes the gap 3.0−2.0 = 1.0um. Rerunning the same deck:

shape.delete(cell, layer_index=..., bbox_um=[-1,1.9,21,2.2]) # clear the violation marker shape.delete(cell, layer_index=2, bbox_um=[0,2.1,20,4.1]) # clear the old trace shape.insert_boxes(cell, layer_index=2, boxes_um=[[0,3.0,20,5.0]]) drc.run(code=<same 0.5um space deck>, result_mode="full") → rdb_summary.total_items = 0 → categories: [{name: "M_SPACE", count: 0}] → exception = null

Confirmed clean: 0 violations. A 1um gap satisfies the 0.5um minimum-space rule.

Two metal lines with 1um spacing, DRC rerun shows 0 violations
Fixed layout: 1um spacing, DRC rerun → 0 violations.

Full DRC/LVS capability → Guide · DRC · LVS.

Honest recap: the geometry, layer numbers (20/0 for traces, 66/0 for the violation marker), and DRC deck on this page are all synthesized for the demo and contain no real process or customer data; the three drc.run/shape.* calls and their reported violation counts (1 → 0) were all executed for real against a live KLayout (dedicated session, port 8766), and the screenshots are the actual render output of that run. The disposable tab used for this work was closed at the end, and the original tab was restored as the active view.