tasks.py: adjust yosys script

This commit is contained in:
David Anderson 2024-08-20 19:29:09 -07:00
parent b73a211ec4
commit 5d16ce23aa
1 changed files with 14 additions and 5 deletions

View File

@ -125,16 +125,25 @@ def synth(c, target):
yosys_report = out_yosys / module_name.with_suffix(".stats") yosys_report = out_yosys / module_name.with_suffix(".stats")
yosys_log = out_yosys / module_name.with_suffix(".log") yosys_log = out_yosys / module_name.with_suffix(".log")
yosys_preprocessed = out_yosys / module_name.with_suffix(".v") yosys_preprocessed = out_yosys / module_name.with_suffix(".v")
yosys_preprocessed_rtl = out_yosys / module_name.with_suffix(".rtlil")
yosys_preprocessed_graph = out_yosys / module_name.stem
yosys_compiled = out_yosys / f"{module_name.stem}_compiled.v" yosys_compiled = out_yosys / f"{module_name.stem}_compiled.v"
with open(yosys_script, "w", encoding="UTF-8") as f: with open(yosys_script, "w", encoding="UTF-8") as f:
f.write(dedent(f"""\ f.write(dedent(f"""\
read_verilog -sv -defer {' '.join(str(f) for f in verilog_files)} read_verilog -sv -defer {' '.join(str(f) for f in verilog_files)}
hierarchy -top {module_name} hierarchy -top {module_name}
synth_ecp5 -top {module_name} -run :map_ram design -push-copy
synth_lattice -family ecp5 -abc9 -run :map_ram
opt -full
clean -purge
write_verilog -sv {yosys_preprocessed} write_verilog -sv {yosys_preprocessed}
opt_clean -purge write_rtlil {yosys_preprocessed_rtl}
synth_ecp5 -run map_ram: -json {yosys_json} show -format dot -colors 1 -stretch -viewer none -prefix {yosys_preprocessed_graph}
opt_clean -purge
design -pop
synth_lattice -family ecp5 -abc9 -no-rw-check
clean -purge
write_json {yosys_json}
write_verilog -sv {yosys_compiled} write_verilog -sv {yosys_compiled}
tee -o {yosys_report} stat tee -o {yosys_report} stat
""")) """))
@ -156,7 +165,7 @@ def synth(c, target):
nextpnr_out = out_nextpnr / module_name.with_suffix(".pnr") nextpnr_out = out_nextpnr / module_name.with_suffix(".pnr")
nextpnr_log = out_nextpnr / module_name.with_suffix(".log") nextpnr_log = out_nextpnr / module_name.with_suffix(".log")
nextpnr_timing = out_nextpnr / module_name.with_suffix(".log") nextpnr_timing = out_nextpnr / module_name.with_suffix(".log")
out = c.run(f"nextpnr-ecp5 --85k --detailed-timing-report -l {nextpnr_log} --report {nextpnr_timing} --json {yosys_json} --lpf {pin_map} --package=CABGA381 --textcfg {nextpnr_out}") #, hide='stderr') out = c.run(f"nextpnr-ecp5 --85k --detailed-timing-report -l {nextpnr_log} --report {nextpnr_timing} --json {yosys_json} --lpf {pin_map} --package=CABGA381 --speed=6 --textcfg {nextpnr_out}", hide='stderr')
print_filtered_paragraphs(out.stderr, "Device utilisation", "Critical path", "Max frequency", "Max delay", common_prefix="Info: ") print_filtered_paragraphs(out.stderr, "Device utilisation", "Critical path", "Max frequency", "Max delay", common_prefix="Info: ")
print(f" PNR : {nextpnr_out}") print(f" PNR : {nextpnr_out}")