pcb · placement · evals

Placement hints: telling the placer roughly where things go

2026-10-05 · Dan Newcome

In the last post, designers' placements routed clean and automatic ones mostly did not. The designers were working from the same netlist. What they had that the placers lacked is information the netlist doesn't carry: the USB port goes on this edge, the regulator lives in that corner, this capacitor belongs to that pin. So we built a way to say those things, and measured what it buys.

One board drawn three times beside the hint text. The designer's placement has a connector on the left edge and two chips in the middle; placed from scratch without hints the parts are jumbled and the route has 3 DRC errors; placed with nine hints the layout matches the designer's and routes clean.

01 / The language

The model comes from reladraw, a diagram language where you say where things go without giving coordinates. Positions are relative, a gap is a minimum distance, and statements that cannot all hold are refused. That is how a floorplan is described at a whiteboard, and it is text, so an agent can write it, a person can read it, and it diffs.

group psu: U4 L1 C5 C6          # keep these together
U1    center
J1    on edge left
psu   bottom-left
U2    right of U1  level with U1
C1    near U1.7  within: 2      # a pad, edge-to-edge mm
Y1    near U1    weight: 3
J2    rotate 90

The PCB dialect adds what a diagram has no use for: board edges, regions of the board, a named pad as a target, a pinned rotation, and real footprint sizes. A statement about a part that does not exist, or one that places a part against itself, is an error with a line number.

02 / How the placer uses it

Hints are soft. Each one becomes a term in the placer's cost: the distance, in millimetres, by which it is not met. The placer weighs that against wirelength, and against hard penalties for parts that overlap or leave the board. When it finishes it lists every hint it could not meet and by how much, so a hint that fights the wiring is visible.

The placer itself had to be rewritten for this. The earlier version annealed positions and then picked rotations in a separate pass, with no step to make the result legal. The new one handles position and rotation in one cost, lets parts pass through each other early and not late, and pushes overlapping bodies apart at the end.

03 / The measurement

Writing hints by hand for 52 boards would test our hint-writing. So the hints are derived from each designer's own placement, at three levels of detail:

Every part is then placed from scratch, routed by TraceMaker with a 20-second budget, and judged by KiCad DRC under the board's own rules. The boards are the 52 from our corpus with up to 150 connections and a placement that is legal as designed.

PlacementRoutes cleanConnections routedDRC errors before routingHints per board (met)Big parts: distance from the designer's
Designer's0.6395.9%0–0
No hints0.1591.5%30–26% of the board diagonal
Level 1: anchors0.1992.8%2512 (85%)12%
Level 2: + relations0.2192.9%2616 (80%)11%
Level 3: + near0.1991.5%3034 (83%)12%

04 / What it says

Hints do what they say. A dozen statements per board are enough to halve how far the big parts end up from the designer's floorplan, and four in five are met outright. In the board at the top, nine hints reproduce the designer's arrangement: the connector on the left edge, the two chips side by side.

The routing gain is real but small. With level-2 hints, three boards that failed without hints route clean, and none that passed is lost. Counting connections, hints route more on 12 boards and fewer on 8.

More detail did not help. Level 3 gives the placer 34 hints per board and routes no better than no hints at all. Pinning every small part beside its chip leaves the placer less room to sort out the wiring.

The floorplan is not the bottleneck. Legality is. Only about 11 of the 52 placements have zero DRC errors before any routing, with or without hints. The rest average 25 to 30 errors each, mostly pads too close together on boards where the designer packed parts tighter than our box model allows. A router cannot fix a placement that is already illegal. That is where the remaining distance to the designers' 63% is, and it is the next thing to work on.

Shorter wires are not the goal. Without hints, our placer's wiring is 24% shorter than the designer's, and it routes worse. The designer's longer wiring is paying for something: edge constraints, room around dense parts, legal spacing.

05 / A correction to the last post

The last post said our placer got 1 of 10 medium boards clean. That was the earlier placer, and the number stands for it. Building this one turned up a bug that affected later work: the placer was writing copper pours back into its output, and a router that reads the board file treats a stale pour as solid copper in its way. On boards with pours, that made our placements look almost unroutable. The placement-score figures in that post's update were fitted partly on those results. We re-ran the study and corrected the post: the combined score picks the better-routing placement 79% of the time on held-out boards, not 89%.

06 / Caveats

The language is place_hints.py and the placer is place_kicad.py, both in the pcb-layout skill at punkfab/circuit-skills, with the study and its results under evals/corpus. Thanks to reladraw's author for the model. Have a board that needs placing or routing? Start a project →