Closed bug report

Router panic (index out of bounds) when a part is left outside the board outline

Andy Engevold · ·closed by John Lauer

Target wiki: adom/adom-aiflow

Versions

  • AI Flow 0.2.47
  • Fusion Bridge 1.13.67
  • Hydrogen on a Windows laptop, WSL Adom-Workspace

What happened

Thanks for the router. It's been really impressive on the boards we've run through it. I wanted to report one crash.

The board is a small 4-layer design with parts on both sides. One part had been left outside the board outline by mistake. Place check and land both passed without flagging that part. Pack did report N-1 of N parts, which in hindsight was the clue. The router then panicked instead of returning an error.

Exact error text

thread 'main' panicked at crates/aiflow-router/src/lib.rs:842:45:
index out of bounds: the len is 105891 but the index is 340656

Steps to reproduce (generic)

  1. Use a 4-layer board with an inner GND plane.
  2. Leave one part outside the board outline.
  3. Run place check and land. Both pass, and pack reports N-1 of N parts.
  4. Run route. The router panics with the message above.

Expected vs actual

  • Expected: Place check, land, or the router stops with a clear error that names the part that is off the board.
  • Actual: No warning shows up before routing, and the router panics with an index-out-of-bounds error.

Workaround

We had AI Flow re-place the part inside the outline, and the router then ran without crashing. Since then we've been running a small checker of our own before routing to catch parts that are off the board. Is there a check you'd recommend running before routing to catch this?

Thanks!

— Andy Engevold

1 Reply

John Lauer ·

Andy, thanks, and your reading of the "N-1 of N" clue was exactly right. Fixed in adom-aiflow 0.2.50.

The cause. place pack found no spot for that part and left it where it was, off the board. place check only looked at the parts it had moved, so it missed it. The router then built its search window from that part's pads, which lay past the edge of its grid, and indexed out of bounds.

The fix.

  • The router never panics on this. Before routing, it sets aside the pads of a part that is outside the outline, and any pad off its grid. It reports them as unrouted, naming the part, for example "R2 is outside the board outline; move it inside". Its windows are also clamped to the grid.
  • The part is named early. place check, place land and route now check every footprint, moved or not. They name any part that's wholly outside the outline, has a pad past the edge, or has a courtyard past it. They say so as a finding and carry on.
  • place pack says what it left out, for example "legal spots for 1 of 2 parts (no spot for R2; left where it is now)".

So your own pre-route checker shouldn't be needed any more: place check before route names the part.

Upgrade: tell your AI "give me the latest adom-aiflow" (or adom-wiki pkg install adom/adom-aiflow); adom-aiflow --version says 0.2.50.

John Lauer closed this ·

Log in to reply.