fastroute README

项目的 README,来自 github.com/parisxmas/fastroute。合并为一个 markdown 文件:README.md。

fastroute

Sponsor Open Collective License: GPL v3

PCB autorouter for KiCad and Specctra DSN — a Rust port of the Freerouting PCB autorouter. (Not related to the FastRoute global router for IC design used in OpenROAD.)

Same algorithms, same input/output (Specctra .dsn → .ses), same command line — without Java, several times faster and with a fraction of the memory.

What is different from Freerouting

The bug fixes and routing improvements are on by default; --no-enhancements switches them off (the DSN parser fixes stay), --parity gives byte-identical Freerouting results. The new features are used when asked for (an option, or a rule in the KiCad board). Details, measurements and the reasoning for each change: docs/IMPROVEMENTS.md.

Bugs fixed

Freerouting behaviour fastroute
The optimizer never runs after the autorouter stopped itself: the stop request stays set, so every optimizer candidate fails to route The router's own stop is withdrawn before the optimizer
When the stagnation rule stops the autorouter, the final tail removal is skipped and unused fanout escapes (via + stub) stay on the board Tails are removed in every case
The optimizer's score is clamped at 0; on boards whose score is below 0 (e.g. DAC2020_bm01) no candidate can ever be accepted Unclamped scores are compared (bm01: −182 → 107)
A connection that ends in a via into its net's plane layer is rejected ("layers disabled"), so plane nets only reach the plane through fanout Such connections are accepted
ignore_net_classes is honoured by the autorouter but not by the fanout, which still adds stubs to the ignored nets No fanout on ignored classes
A failing connection rips its whole net on every failure from the second on; unroutable connections make large nets (GND, 3V3) oscillate Only once per net
Class-pair clearances from the DSN only reach the clearance classes named after the net classes, not the pin/SMD classes of the same nets Applied to all item classes of both net classes
Nets with a pad on or outside the board edge (edge connectors, castellated pads, headers across Edge.Cuts) ignore the outline completely, so their traces can run outside the board anywhere The area outside the outline is a keepout except right around those pads
DSN lexer: non-ASCII letters dropped from names, desynchronisation on some quoted strings, a pin token swallowing a character of the next pin Parsed correctly

Routing and optimizer improvements

New features

KiCad plugin

The plugin (integrations/kicad) exports the board, fills the gaps of KiCad's Specctra export and imports the result:

Build and run

cargo build --release -p fastroute          # or scripts/build-pgo.sh (~15 % faster)
target/release/fastroute -de board.dsn -do board.ses

The session file (-do) is rewritten with the best board so far whenever routing or optimizing improves, so a run that is stopped or killed still leaves its best result. Ctrl+C, SIGTERM and Ctrl+Break stop the run and write the best result (a second signal exits at once). fastroute --help lists the options and the common --router.* settings.

Windows x64 build (cross-compiled with MinGW-w64): scripts/build-windows.sh → dist/windows/fastroute.exe. Windows ARM64 build (clang-cl + lld-link with the MSVC SDK from xwin): scripts/build-windows-arm64.sh → dist/windows-arm64/fastroute.exe. Linux x64 and arm64 builds (cargo-zigbuild, glibc 2.17): scripts/build-linux.sh → dist/linux-*/fastroute. The KiCad package can bundle several platforms: integrations/kicad/package.sh --bin <macos binary> macos-arm64 --bin dist/windows/fastroute.exe windows-x64 --bin dist/windows-arm64/fastroute.exe windows-arm64 --bin dist/linux-x64/fastroute linux-x64 ....

Freerouting's options are accepted: -mp <passes>, --router.<path>=<value> (e.g. --router.optimizer.enabled=false, --router.scoring.via_costs=80); GUI/API options such as --gui.enabled are ignored. fastroute adds:

Option Meaning
--parity Exact Freerouting results: java-compatible optimizer, count-based time limits
--optimizer-mode=java-compat|parallel Optimizer strategy (default: parallel if more than one thread)
--time-limit-mode=wall|count|disabled, --time-limit-factor=N How Freerouting's internal time limits are evaluated
--router.min_trace_width_um=<w> Never neck traces down below this width
--multi-start=N Rerun the autorouter with N−1 shuffled orders in parallel if connections remain unrouted (default 4)
--no-enhancements Freerouting's behaviour without fastroute's routing/optimizer improvements (see docs/IMPROVEMENTS.md)
--router.autorouter.max_threads=N Threads of the parallel autorouting pass (default: all cores; 1 = sequential pass)
--tune=FILE Length matching after routing: groups of nets matched with meanders (see fastroute --help)
--layer-heights=MM,.. Height of each copper layer (stackup), so that vias count in length matching
--pairs=FILE Differential pairs: routed first, the second net following the first at the pair gap
--no-neckdown-classes=A,B Keep the full trace width of these classes at pins (controlled impedance)
--max-time=SECONDS Stop after this time and write the best result so far
--router.autorouter.min_passes=N The stagnation rules do not stop the autorouter before N passes (for long runs bounded by --max-time)
--initial-session=FILE Start from the wiring of a session file (e.g. a checkpoint of an earlier run) and continue routing and optimizing it
--live[=PORT] Watch the routing live in the web browser (http://127.0.0.1:7878 by default, opened automatically): traces and airlines as they change, pass progress, unrouted connections per pass, log, and a Stop button. Results are unaffected
--report=FILE Write a JSON summary: statistics, timings, every unrouted connection and clearance violation
--diagnose With --report: route each unrouted connection alone on the loaded board, classifying it as congestion (other traces in the way) or blocked (geometry or rules)
-V, --version Print the version
-v Verbose progress

Performance

Full pipeline (autorouter + optimizer), exact mode, 20 benchmark boards (docs/PERFORMANCE.md):

Freerouting (Java) fastroute fastroute + PGO
Sum of 20 boards 2102 s 510 s 420 s
DAC2020_bm01 960 s 380 s 310 s
CM5_MINIMA_3 410 s 23 s 20 s
Peak memory (typical) 1–2 GB 20–300 MB

The parallel optimizer mode is another 1.5–3× faster on most boards.

Layout

Crate Contents
fr-dsn Specctra S-expression reader and typed DSN model
fr-geom Planar geometry (port of geometry.planar)
fr-jcompat Bit-exact emulation of the Java library behaviour the router depends on
fr-settings Router settings, defaults, CLI/DSN settings sources
fr-engine Board model, search trees, autorouter, pull-tight/shove/optimizer, DRC, scoring, pipeline
fr-io DSN → board loader, post-load processing, SES writer/reader
fastroute Command-line tool

How the port was done and how parity is tested: docs/PORTING.md. The Java reference build and scripts: scripts/java-parity.sh, scripts/parity-route.sh.

Support

fastroute is developed in spare time. If it saves you routing hours or a Java setup, you can support its development through GitHub Sponsors or Open Collective. Bug reports with a board that shows the problem (a .dsn file is enough) are just as welcome.

License

GPL-3.0-or-later (LICENSE). fastroute is a derivative work of Freerouting (GPL-3.0); all credit for the routing algorithms goes to the Freerouting authors. See NOTICE for the attribution, the Freerouting version it is based on, and the third-party crates.

fastroute (parisxmas/fastroute)

正在搜索数据库…

这是什么?fastroute 是一款快速的开源 PCB 自动布线工具,支持 KiCad 和 Specctra DSN 文件。它是 Freerouting 自动布线器的 Rust 移植版,保留了相同的算法,以及相同的 .dsn 到 .ses 输入/输出格式。
这是独立的命令行工具,还是 KiCad 插件?两者皆是:fastroute 是一款命令行自动布线工具,同时附带一个 KiCad 插件(integrations/kicad),可以导出电路板、运行布线器,并将布线结果直接导回 KiCad。
我该如何构建和运行 fastroute?使用提供的脚本从源代码构建:scripts/build-windows.sh(通过 MinGW-w64 交叉编译)生成 dist/windows/fastroute.exe,scripts/build-linux.sh(使用 cargo-zigbuild)生成 Linux x64/arm64 版本的可执行文件;运行 fastroute --help 查看选项。
运行它是否需要 Java,就像 Freerouting 那样?不需要。fastroute 完全去除了对 Java 的依赖,同时接受与 Freerouting 相同的 Specctra DSN 输入和相同的命令行选项,运行更快,内存占用也少得多。
fastroute 是否总能复现 Freerouting 的完全相同的结果?只有在 --parity 模式下才行。该模式会强制使用与 Java 兼容的单线程优化器和基于计数的时间限制,以生成逐字节一致的 .ses 输出。默认情况下,错误修复和功能增强处于开启状态,优化器并行运行;Freerouting 的 GUI/API 参数(如 --gui.enabled)会被直接忽略。
fastroute 可以为哪些平台构建?官方构建脚本面向 Windows x64(通过 MinGW-w64 交叉编译)和 Linux x64/arm64(glibc 2.17);KiCad 插件打包器在打包多个平台时,也会列出 macOS arm64 的二进制文件位置。
fastroute 比 Java 版的 Freerouting 快多少?在 20 块基准测试电路板上,完整的自动布线器加优化器流程,Freerouting 耗时 2102 秒,fastroute 耗时 510 秒(启用 PGO 后为 420 秒),峰值内存从 1-2GB 降至 20-300MB。
实时布线视图显示什么?使用 --live[=PORT] 时,fastroute 会提供一个本地网页,实时显示正在布设和拆除的走线、剩余未布通的飞线、布线进度、间距违规情况,并提供一个停止按钮,无需联网。
差分对和等长匹配是做什么用的?--pairs 会让一个网络与其配对网络以固定间距并行布线,用于差分信号传输;--tune 则会在布线后添加蛇形线,使成组的网络(总线或差分对的偏移)获得匹配的走线长度,并计入叠层中过孔的高度。
我为什么要使用 --multi-start?如果某些连接仍未布通,--multi-start 会以打乱的网络顺序并行重新运行自动布线器(默认 4 次),并保留布通连接数最多的那次结果。
作者
parisxmas
大小
5.7 MB
星标
138
时长
1个月
提交 · 90 天