AI Flow
Public Made by Adomby adom
Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board.
Routing: signal nets take twice the vias and twice the copper they need
Routing: signal nets take twice the vias and twice the copper they need
Seen on: adom-aiflow 0.2.40 to 0.2.44, the same AM32 ESC built twice (boards and method in #127):
- AI Flow: adom/am32-esc-2s6s-molecule, board-19, full AI Flow run.
- Hands-on: adom/am32-esc-v1, routed by hand.
What happened: "signal" below means every net except ground, battery, phase and the supply rails.
| AI Flow | Hands-on | |
|---|---|---|
| Signal vias | 48 on 16 of 33 signal nets | 25 on 12 of 34 |
| Signal copper | 701 mm | 319 mm |
| Median detour (routed length ÷ minimum spanning tree of the net's pads) | 1.41 | 1.14 |
Worst nets on the AI Flow board:
| Net | AI Flow | Hands-on |
|---|---|---|
| BEMF_A / B / C (back-EMF sense) | 87.5 / 91.8 / 46.7 mm; 2 / 10 / 5 vias | 17.0 / 23.0 / 32.4 mm; 2 / 2 / 2 vias |
| Gate drive, driver to gate (6 lines) | 23 to 47 mm, average 33 mm; worst phase A high side 47 mm | 15 to 29 mm, average 22 mm |
| MCU to driver PWM inputs (INHx / INLx) | 10 to 25 mm, 2 vias on each high-side line | about 2 mm each, 0 vias |
| SWCLK | 24.6 mm, detour 2.3 | 7.6 mm |
Where the signal vias came from:
- 26 from the AI's hand-written power and gate-drive plan
- 18 from AI Flow's grid router
- 4 from the AI's own maze router (
finish.py, which closed the connections the router left open)
Why it matters: each via adds inductance, a stub, a drill hit and a place to fail, and it blocks the other layer. Here most of them, and most of the extra length, are avoidable. Better placement would have removed many: the MCU next to the driver inputs, the back-EMF dividers between the phase contacts and the MCU's comparator pins. Re-ordering or re-layering the traces would have removed others. The router's via cost only trades a via against a few grid steps, one connection at a time; it never asks whether moving a part or an earlier trace would remove the via.
Suggested fix:
- Report vias and detour per signal net in
routeandgate: count, length, detour ratio, worst nets first. Then the AI (and the human, on the timeline) sees "BEMF_B: 10 vias, 92 mm, 2.3× its pad tree" before landing. - A per-net via budget in the spec, defaulted from the signal-priority ranking (0 vias for the top-ranked nets, small budgets below).
routehonours it with rip-up of lower-priority nets, andgatereports nets over budget. - When a net is over budget or over a detour ratio, the hint names placement as the fix: "INHA: 25 mm, 2 vias between U1.21 and U2.22, 14 mm apart; move U2 toward U1 or rotate it (
place pack --wish)". Today the levers listed are more passes, back to placement for parts that failed to route, or take the stage, and none of them fires for a net that routed badly. route --variantsranks on total copper length and via count today. Weight both by the net's priority, so a variant that saves a via on BEMF beats one that saves a via on a test point.
