From b0126a7d161c3fe487e3729621f63d07d12d3732 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 13 Sep 2024 11:41:32 -0700 Subject: [PATCH] flake.nix: grab the GUI version of nextpnr --- flake.nix | 2 +- tasks.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 3100b9d..9eb1ea4 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,7 @@ gotools gtkwave imagemagick - nextpnr + nextpnrWithGui openfpgaloader picocom (python3.withPackages (py-pkgs: [ diff --git a/tasks.py b/tasks.py index 6e06c99..24de213 100644 --- a/tasks.py +++ b/tasks.py @@ -137,7 +137,7 @@ def build(c, target): return verilog_files @task -def synth(c, target): +def synth(c, target, gui=False): target = resolve_synth_target(target) out_info, out_verilog, out_bsc, out_yosys, out_nextpnr = ensure_build_dirs(target, "info", "verilog", "bsc", "yosys", "nextpnr") @@ -193,10 +193,15 @@ def synth(c, target): else: print(f"WARNING: no pin map at {pin_map}, executing place&route with no constraints") pin_map_arg = f"--lpf-allow-unconstrained --lpf=lib/ulx3s_v20.lpf --freq 100" + nextpnr_out_json = out_nextpnr / f"{module_name.stem}_routed.json" nextpnr_out = out_nextpnr / module_name.with_suffix(".pnr") nextpnr_log = out_nextpnr / module_name.with_suffix(".log") nextpnr_timing = out_nextpnr / module_name.with_suffix(".timing.log") - out = c.run(f"nextpnr-ecp5 --85k --detailed-timing-report -l {nextpnr_log} --report {nextpnr_timing} --json {yosys_json} --package=CABGA381 {pin_map_arg} --speed=6 --textcfg {nextpnr_out}", hide='stderr') + if gui: + cmd = f"nextpnr-ecp5 --85k --detailed-timing-report --report {nextpnr_timing} --json {yosys_json} --gui --gui-no-aa --package=CABGA381 {pin_map_arg} --speed=6 --textcfg {nextpnr_out}" + else: + cmd = f"nextpnr-ecp5 --85k --detailed-timing-report -l {nextpnr_log} --report {nextpnr_timing} --json {yosys_json} --write {nextpnr_out_json} --package=CABGA381 {pin_map_arg} --speed=6 --textcfg {nextpnr_out}" + out = c.run(cmd) print_filtered_paragraphs(out.stderr, "Device utilisation", "Critical path", "Max frequency", "Max delay", common_prefix="Info: ") print(f" PNR : {nextpnr_out}")