Add directives, remove vestigial main

This commit is contained in:
Byron Lathi
2025-01-26 22:05:57 -08:00
parent b64f161284
commit f80f059d9b

View File

@@ -11,6 +11,23 @@ def build_nonprj(cfg):
top = cfg["design_info"]["top_module"]
part = cfg["device_info"]["device"]
synth_directive = "default"
opt_directive = "default"
place_directive = "default"
route_directive = "default"
if "synthesis_options" in cfg.keys():
if "synth_directive" in cfg["synthesis_options"]:
synth_directive = cfg["synthesis_options"]["synth_directive"]
if "opt_directive" in cfg["synthesis_options"]:
opt_directive = cfg["synthesis_options"]["opt_directive"]
if "pnr_options" in cfg.keys():
if "place_directive" in cfg["pnr_options"]:
place_directive = cfg["pnr_options"]["place_directive"]
if "route_directive" in cfg["pnr_options"]:
route_directive = cfg["pnr_options"]["route_directive"]
with open("build.tcl", "w") as f:
f.write(f"set outputDir ./nonprojectflow\n")
f.write(f"file mkdir $outputDir\n")
@@ -22,21 +39,19 @@ def build_nonprj(cfg):
f.write(f"read_xdc {' '.join(xdc_sources)}\n")
f.write(f"synth_ip [get_ips *]\n")
f.write(f"synth_design -top {top}\n")
f.write(f"synth_design -top {top} -directive {synth_directive}\n")
f.write(f"write_checkpoint -force $outputDir/post_synth.dcp\n")
f.write(f"report_utilization -file $outputDir/post_synth_util.rpt\n")
f.write(f"opt_design\n")
f.write(f"place_design\n")
f.write(f"opt_design -directive {opt_directive}\n")
f.write(f"place_design -directive {place_directive}\n")
f.write(f"write_checkpoint -force $outputDir/post_place.dcp\n")
f.write(f"route_design\n")
f.write(f"route_design -directive {route_directive}\n")
f.write(f"write_checkpoint -force $outputDir/post_route.dcp\n")
f.write(f"report_utilization -file $outputDir/post_impl_util.rpt\n")
f.write(f"report_timing -file $outputDir/timing.rpt\n")
f.write(f"write_bitstream -force $outputDir/{top}.bit\n")
f.write(f"exit\n")
os.system(f"vivado -mode tcl -source build.tcl")
os.remove("build.tcl")
if __name__ == "__main__":
main()
os.remove("build.tcl")