Skip to content
Snippets Groups Projects
Commit 61c15258 authored by Lucian Petrica's avatar Lucian Petrica
Browse files

Added debug flag to vitis builds - adds chipscope to ALL kernel interfaces

parent 357f1572
No related branches found
No related tags found
No related merge requests found
...@@ -177,11 +177,15 @@ class VitisLink(Transformation): ...@@ -177,11 +177,15 @@ class VitisLink(Transformation):
ModelProto's metadata_props field with the XCLBIN full path as value. ModelProto's metadata_props field with the XCLBIN full path as value.
""" """
def __init__(self, platform, f_mhz=200, strategy=VitisOptStrategy.PERFORMANCE): def __init__(
self, platform, f_mhz=200, strategy=VitisOptStrategy.PERFORMANCE,
enable_debug=False
):
super().__init__() super().__init__()
self.platform = platform self.platform = platform
self.f_mhz = f_mhz self.f_mhz = f_mhz
self.strategy = strategy self.strategy = strategy
self.enable_debug = enable_debug
def apply(self, model): def apply(self, model):
_check_vitis_envvars() _check_vitis_envvars()
...@@ -258,6 +262,11 @@ class VitisLink(Transformation): ...@@ -258,6 +262,11 @@ class VitisLink(Transformation):
with open(link_dir + "/gen_report_xml.tcl", "w") as f: with open(link_dir + "/gen_report_xml.tcl", "w") as f:
f.write(gen_rep_xml) f.write(gen_rep_xml)
debug_commands = []
if self.enable_debug:
for inst in list(instance_names.values()):
debug_commands.append("--dk chipscope:%s" % inst)
# create a shell script and call Vitis # create a shell script and call Vitis
script = link_dir + "/run_vitis_link.sh" script = link_dir + "/run_vitis_link.sh"
working_dir = os.environ["PWD"] working_dir = os.environ["PWD"]
...@@ -267,12 +276,13 @@ class VitisLink(Transformation): ...@@ -267,12 +276,13 @@ class VitisLink(Transformation):
f.write( f.write(
"v++ -t hw --platform %s --link %s" "v++ -t hw --platform %s --link %s"
" --kernel_frequency %d --config config.txt --optimize %s" " --kernel_frequency %d --config config.txt --optimize %s"
" --save-temps -R2\n" " --save-temps -R2 %s\n"
% ( % (
self.platform, self.platform,
" ".join(object_files), " ".join(object_files),
self.f_mhz, self.f_mhz,
self.strategy.value, self.strategy.value,
debug_commands,
) )
) )
f.write("cd {}\n".format(working_dir)) f.write("cd {}\n".format(working_dir))
...@@ -309,13 +319,16 @@ class VitisBuild(Transformation): ...@@ -309,13 +319,16 @@ class VitisBuild(Transformation):
"""Best-effort attempt at building the accelerator with Vitis.""" """Best-effort attempt at building the accelerator with Vitis."""
def __init__( def __init__(
self, fpga_part, period_ns, platform, strategy=VitisOptStrategy.PERFORMANCE self, fpga_part, period_ns, platform,
strategy=VitisOptStrategy.PERFORMANCE,
enable_debug=False
): ):
super().__init__() super().__init__()
self.fpga_part = fpga_part self.fpga_part = fpga_part
self.period_ns = period_ns self.period_ns = period_ns
self.platform = platform self.platform = platform
self.strategy = strategy self.strategy = strategy
self.enable_debug = enable_debug
def apply(self, model): def apply(self, model):
_check_vitis_envvars() _check_vitis_envvars()
...@@ -363,7 +376,8 @@ class VitisBuild(Transformation): ...@@ -363,7 +376,8 @@ class VitisBuild(Transformation):
# Assemble design from kernels # Assemble design from kernels
model = model.transform( model = model.transform(
VitisLink( VitisLink(
self.platform, round(1000 / self.period_ns), strategy=self.strategy self.platform, round(1000 / self.period_ns), strategy=self.strategy,
enable_debug=self.enable_debug
) )
) )
# set platform attribute for correct remote execution # set platform attribute for correct remote execution
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment