Add vivado support
This commit is contained in:
@@ -7,12 +7,13 @@ from rtl_manifest import rtl_manifest
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from .efinity import efinity
|
from .efinity import efinity
|
||||||
|
from .vivado import vivado
|
||||||
|
|
||||||
def build_fpga_main():
|
def build_fpga_main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog="sim",
|
prog="build_fpga",
|
||||||
description="Tool to simulate"
|
description="Tool to automate building fpga images"
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument("yaml")
|
parser.add_argument("yaml")
|
||||||
@@ -24,4 +25,6 @@ def build_fpga_main():
|
|||||||
|
|
||||||
if (cfg["tool"] == "efinity"):
|
if (cfg["tool"] == "efinity"):
|
||||||
efinity.create_project(cfg)
|
efinity.create_project(cfg)
|
||||||
|
elif (cfg["tool"] == "vivado"):
|
||||||
|
vivado.build_nonprj(cfg)
|
||||||
|
|
||||||
|
|||||||
0
src/build_fpga/vivado/__init__.py
Normal file
0
src/build_fpga/vivado/__init__.py
Normal file
42
src/build_fpga/vivado/vivado.py
Normal file
42
src/build_fpga/vivado/vivado.py
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import rtl_manifest
|
||||||
|
import os
|
||||||
|
|
||||||
|
def build_nonprj(cfg):
|
||||||
|
all_sources = rtl_manifest.read_sources(cfg["design_info"]["sources"])
|
||||||
|
|
||||||
|
verilog_sources = list(filter(lambda s: (s.endswith(".v") or s.endswith(".sv")), all_sources))
|
||||||
|
xci_sources = list(filter(lambda s: s.endswith(".xci"), all_sources))
|
||||||
|
xdc_sources = list(filter(lambda s: s.endswith(".xdc"), all_sources))
|
||||||
|
|
||||||
|
top = cfg["design_info"]["top_module"]
|
||||||
|
part = cfg["device_info"]["device"]
|
||||||
|
|
||||||
|
with open("build.tcl", "w") as f:
|
||||||
|
f.write(f"set outputDir ./nonprojectflow\n")
|
||||||
|
f.write(f"file mkdir $outputDir\n")
|
||||||
|
|
||||||
|
f.write(f"set_part {part}\n")
|
||||||
|
|
||||||
|
f.write(f"read_verilog {' '.join(verilog_sources)}\n")
|
||||||
|
f.write(f"read_ip {' '.join(xci_sources)}\n")
|
||||||
|
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"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"write_checkpoint -force $outputDir/post_place.dcp\n")
|
||||||
|
f.write(f"route_design\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"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()
|
||||||
Reference in New Issue
Block a user