flake.nix: grab the GUI version of nextpnr

This commit is contained in:
David Anderson 2024-09-13 11:41:32 -07:00
parent a08fd421fe
commit b0126a7d16
2 changed files with 8 additions and 3 deletions

View File

@ -24,7 +24,7 @@
gotools
gtkwave
imagemagick
nextpnr
nextpnrWithGui
openfpgaloader
picocom
(python3.withPackages (py-pkgs: [

View File

@ -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}")