diff --git a/src/finn/custom_op/fpgadataflow/hlscustomop.py b/src/finn/custom_op/fpgadataflow/hlscustomop.py index c337398ebb82ecf75cf25386f354c29a925858a1..9978ab0c7138aa6846a1427cd346c5257e4f8728 100644 --- a/src/finn/custom_op/fpgadataflow/hlscustomop.py +++ b/src/finn/custom_op/fpgadataflow/hlscustomop.py @@ -111,21 +111,13 @@ class HLSCustomOp(CustomOp): "inFIFODepth": ("i", False, 2), "outFIFODepth": ("i", False, 2), "output_hook": ("s", False, ""), - # HLS version to be used for IP synthesis - "hls_version": ("s", False, "vitis_hls", {"vivado_hls", "vitis_hls"}), } def get_verilog_top_module_name(self): "Return the Verilog top module name for this node." node = self.onnx_node - hls_version = self.get_nodeattr("hls_version") - if hls_version == "vivado_hls": - prefixed_top_name = "%s_%s" % (node.name, node.name) - elif hls_version == "vitis_hls": - prefixed_top_name = node.name - else: - raise Exception("Unknown hls_version: %s" % hls_version) + prefixed_top_name = node.name return prefixed_top_name @@ -317,25 +309,16 @@ class HLSCustomOp(CustomOp): self.code_gen_dict.clear() def ipgen_default_directives(self): - """Return list of default HLS synthesis directives, which differ - slightly between vivado_hls and vitis_hls""" - - hls_version = self.get_nodeattr("hls_version") - default_directives = { - "vivado_hls": [ - "config_compile -ignore_long_run_time -disable_unroll_code_size_check", - "config_interface -m_axi_addr64", - "config_rtl -auto_prefix", - ], - "vitis_hls": [ - "set_param hls.enable_hidden_option_error false", - "config_compile -disable_unroll_code_size_check -pipeline_style flp", - "config_interface -m_axi_addr64", - "config_rtl -module_auto_prefix", - "config_rtl -deadlock_detection none", - ], - } - return default_directives[hls_version] + """Return list of default HLS synthesis directives""" + + default_directives = [ + "set_param hls.enable_hidden_option_error false", + "config_compile -disable_unroll_code_size_check -pipeline_style flp", + "config_interface -m_axi_addr64", + "config_rtl -module_auto_prefix", + "config_rtl -deadlock_detection none", + ] + return default_directives def ipgen_extra_directives(self): "Return a list of extra tcl directives for HLS synthesis." @@ -345,8 +328,7 @@ class HLSCustomOp(CustomOp): """Builds the bash script for IP generation using the CallHLS utility.""" node = self.onnx_node code_gen_dir = self.get_nodeattr("code_gen_dir_ipgen") - hls_version = self.get_nodeattr("hls_version") - builder = CallHLS(backend=hls_version) + builder = CallHLS() builder.append_tcl(code_gen_dir + "/hls_syn_{}.tcl".format(node.name)) builder.set_ipgen_path(code_gen_dir + "/project_{}".format(node.name)) builder.build(code_gen_dir) @@ -500,15 +482,10 @@ compilation transformations? sim.io.ap_clk = 0 def hls_sname(self): - """Get the naming convention used by chosen HLS version for stream signals, - decided by the hls_version node attribute. - Example: the TDATA for a stream called "out" would be out_V_V_TDATA - in vivado_hls and out_V_TDATA in vitis_hls. + """Get the naming convention used by Vitis HLS for stream signals + Example: the TDATA for a stream called "out" would be out_V_TDATA. """ - hls_version = self.get_nodeattr("hls_version") - sname_dict = {"vivado_hls": "V_V", "vitis_hls": "V"} - sname = sname_dict[hls_version] - return sname + return "V" def rtlsim(self, sim, inp, inp2=None): """Runs the pyverilator simulation by passing the input values to the simulation, @@ -593,7 +570,7 @@ compilation transformations? def rtlsim_multi_io(self, sim, io_dict): "Run rtlsim for this node, supports multiple i/o streams." - # signal naming differs slightly between vivado_hls/vitis_hls + # signal name sname = "_" + self.hls_sname() + "_" trace_file = self.get_nodeattr("rtlsim_trace") diff --git a/src/finn/util/hls.py b/src/finn/util/hls.py index fb23af046b1fc0b1d8d47aed5c3e2f435dfb5f5d..52ed121a43ea416d99930245e6986fe23399ce4d 100644 --- a/src/finn/util/hls.py +++ b/src/finn/util/hls.py @@ -34,18 +34,13 @@ from finn.util.basic import which class CallHLS: - """Call either vivado_hls or vitis_hls to run HLS build tcl scripts.""" + """Call vitis_hls to run HLS build tcl scripts.""" - def __init__(self, backend="vivado_hls"): + def __init__(self): self.tcl_script = "" self.ipgen_path = "" self.code_gen_dir = "" self.ipgen_script = "" - assert backend in [ - "vivado_hls", - "vitis_hls", - ], "Unrecognized backend for CallHLS" - self.backend = backend def append_tcl(self, tcl_script): """Sets the tcl script to be executed.""" @@ -59,14 +54,14 @@ class CallHLS: """Builds the bash script with given parameters and saves it in given folder. To guarantee the generation in the correct folder the bash script contains a cd command.""" - assert which(self.backend) is not None, "%s not found in PATH" % self.backend + assert which("vitis_hls") is not None, "vitis_hls not found in PATH" self.code_gen_dir = code_gen_dir self.ipgen_script = str(self.code_gen_dir) + "/ipgen.sh" working_dir = os.environ["PWD"] f = open(self.ipgen_script, "w") f.write("#!/bin/bash \n") f.write("cd {}\n".format(code_gen_dir)) - f.write("%s %s\n" % (self.backend, self.tcl_script)) + f.write("vitis_hls %s\n" % (self.tcl_script)) f.write("cd {}\n".format(working_dir)) f.close() bash_command = ["bash", self.ipgen_script]