aboutsummaryrefslogtreecommitdiff
path: root/knowledge/tooling/pnr.md
diff options
context:
space:
mode:
authorLouis <louis@dnge.de>2026-11-11 10:32:51 +0100
committerLouis <louis@dnge.de>2026-11-11 10:32:51 +0100
commita59e8e99243a895197a30d6cd6dd8d744dd606de (patch)
tree8910cc7476ff1317932257dfc8497a0f9ffc29f7 /knowledge/tooling/pnr.md
parent6f2bbe1f94e4321c329f92ec3420f6d32fd7b26d (diff)
downloadhw-toolchain-main.tar.gz
Keep only the current router: drop the Python router, router-rs -> routerHEADmain
The sequential Python/C router (pcbroute.py, pipeline.py, astar.c) is gone. The Rust crate takes its place at tools/router/, next to the KiCad I/O scripts it uses (dump_board.py, write_board.py, plot_routes.py). knowledge/tooling/router.md is now the Rust router's reference; the small Python venv for plots and 3D checks moves to tools/.venv (tools/requirements.txt). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'knowledge/tooling/pnr.md')
-rw-r--r--knowledge/tooling/pnr.md19
1 files changed, 10 insertions, 9 deletions
diff --git a/knowledge/tooling/pnr.md b/knowledge/tooling/pnr.md
index 4d2489b..2326cbc 100644
--- a/knowledge/tooling/pnr.md
+++ b/knowledge/tooling/pnr.md
@@ -1,6 +1,6 @@
# Place and route your own board (pnr)
-`tools/pnr.sh` takes a KiCad board with its schematic and gives you routed candidates that KiCad's DRC has checked. It places the parts with the [Placer](placer.md) (simulated annealing, 32 runs), routes every candidate with the [Rust router](rust-router.md) (negotiated congestion), then runs apply → route → write → DRC on the best six and installs the one you choose.
+`tools/pnr.sh` takes a KiCad board with its schematic and gives you routed candidates that KiCad's DRC has checked. It places the parts with the [Placer](placer.md) (simulated annealing, 32 runs), routes every candidate with the [Router](router.md) (negotiated congestion), then runs apply → route → write → DRC on the best six and installs the one you choose.
You can also run only the router on a board you placed yourself. See [Route a placed board](#route-a-placed-board).
@@ -10,8 +10,9 @@ You can also run only the router on a board you placed yourself. See [Route a pl
- On macOS both come from `KiCad.app` and are found automatically.
- On Linux, the distribution package puts `pcbnew` into the system Python.
- Override with `KICAD_PYTHON=...` and `KICAD_CLI=...` ([tools/kicad_env.sh](../../tools/kicad_env.sh)).
-- **Rust** (stable, via rustup). `pnr.sh` builds the placer, and the router crate links into it. Build the router binary yourself once: `cargo build --release --manifest-path tools/router-rs/Cargo.toml`.
-- `python3` (3.8+) for the small JSON summaries.
+- **Rust** (stable, via rustup). `pnr.sh` builds the placer, and the router crate links into it. Build the router binary yourself once: `cargo build --release --manifest-path tools/router/Cargo.toml`.
+- `python3` (3.8+) for the small JSON summaries. For the plots and the 3D/height checks, make a venv once:
+ `python3 -m venv tools/.venv && tools/.venv/bin/pip install -r tools/requirements.txt` (numpy, matplotlib).
- Two-layer boards. The router uses F.Cu and B.Cu only.
## The board directory
@@ -20,7 +21,7 @@ You can also run only the router on a board you placed yourself. See [Route a pl
myboard/
myboard.kicad_pro / .kicad_sch / .kicad_pcb name = directory name
placement.toml what the placer must know (can be almost empty)
- route.toml how to route (see rust-router.md)
+ route.toml how to route (see router.md)
```
The board needs:
@@ -64,7 +65,7 @@ do = "cleanup"
do = "pour" # check the GND pour for islands and join them with vias
```
-That is enough for a first run. The [Placer](placer.md) and [Rust router](rust-router.md) pages list what else there is: groups and regions, decap pin assignments, links, pulls, replicated channels, bundles, escapes, cost zones and per-net settings.
+That is enough for a first run. The [Placer](placer.md) and [Router](router.md) pages list what else there is: groups and regions, decap pin assignments, links, pulls, replicated channels, bundles, escapes, cost zones and per-net settings.
## Run
@@ -97,13 +98,13 @@ Close the board in KiCad first. Both commands refuse while KiCad's lock file is
``` sh
. tools/kicad_env.sh
-R=tools/router-rs/target/release/router
+R=tools/router/target/release/router
$KPY tools/router/dump_board.py myboard.kicad_pcb /tmp/board.json
$R route /tmp/board.json route.toml /tmp/routes.json
$KPY tools/router/write_board.py myboard.kicad_pcb /tmp/routes.json /tmp/routed.kicad_pcb --replace --prune-vias GND
cp myboard.kicad_pro /tmp/routed.kicad_pro
$KC pcb drc --refill-zones /tmp/routed.kicad_pcb
-$KPY tools/router/plot_routes.py /tmp/board.json /tmp/routes.json /tmp/routes.png # needs the router venv
+tools/.venv/bin/python tools/router/plot_routes.py /tmp/board.json /tmp/routes.json /tmp/routes.png
```
The last line of `route` reads `RESULT split=0 failed=0 islands=0 vias=… length=…`. Zeros mean complete. KiCad's DRC is the judge.
@@ -113,8 +114,8 @@ The last line of `route` reads `RESULT split=0 failed=0 islands=0 vias=… lengt
Most failures come from the placement, not the router:
- **A pin that never connects** on every candidate: something walls it in. Look at the plot, then give it a fan-out band, keep a corridor free, or raise the net's `priority` in `route.toml`.
-- **Interface lines of a block** with one pad each: add `[[escape]]` lines (see the [Rust router](rust-router.md) page), or complete boards will wall them in.
+- **Interface lines of a block** with one pad each: add `[[escape]]` lines (see the [Router](router.md) page), or complete boards will wall them in.
- **Fine-pitch parts off the 0.05 mm grid**: put fixed parts' origins on multiples of 0.05 mm.
- **Placer cost does not predict routability.** Route more candidates (`RUNS=64`) rather than tuning the cost weights.
-See [Placement for routing](../topics/placement-for-routing.md) for the rules behind this. The [Rust router](rust-router.md) page has the lessons that came out of real boards.
+See [Placement for routing](../topics/placement-for-routing.md) for the rules behind this. The [Router](router.md) page has the lessons that came out of real boards.