用途:为开源 FPGA 目标执行布局布线(P&R),基于 nextpnr 工具链,支持 Lattice iCE40、ECP5 和 Gowin 器件。不支持 Xilinx(用 Vivado)和 Intel(用 Quartus),这两类由 GateFlow 生成 TCL 脚本。
主要能力:检测 nextpnr 工具是否安装;按项目目标(board.yaml 中的 pnr_target)选择对应命令;校验 Yosys 综合输出 synth.json 与约束文件;运行 P&R 并报告时序(Fmax、Slack)与利用率(LUT、FF);成功后生成比特流。
使用方式:先检测工具 which nextpnr-ice40 || which nextpnr-ecp5 || which nextpnr-gowin,未安装时提示 macOS 用 brew install nextpnr,Linux 参考 https://github.com/YosysHQ/nextpnr。iCE40 用 nextpnr-ice40,输出 --asc,约束 --pcf;ECP5 用 nextpnr-ecp5,输出 --textcfg,约束 --lpf/--sdc;Gowin 用 nextpnr-gowin,--device 指定型号,--vopt cst= 为必需约束。比特流:iCE40 用 icepack,ECP5 用 ecppack,Gowin 由 nextpnr-gowin 内置生成。常用参数包括 --freq、--seed/-r、--opt-timing、--report、--timing-allow-fail、--router2-heatmap、--placer heap。
适用场景:iCEBreaker 等 iCE40 板卡、ECP5 与 Gowin 开源流程的布局布线、时序与资源评估。
限制:仅覆盖上述三类器件;利用率超过 80% 易拥塞、超过 95% 可能布线失败;时序违例需通过流水线、--opt-timing 或更换种子改善。约束格式分别为 PCF、LPF、CST。