From b11ff02ebedf4ec7927d7b9e62036933d5b5abc9 Mon Sep 17 00:00:00 2001 From: gchqdeveloper888 Date: Tue, 22 Jul 2025 13:19:45 +0100 Subject: [PATCH 1/2] Added 2019 support to tools I have licences for Removed debug info --- edalize/modelsim.py | 2 ++ edalize/quartus.py | 10 +++++++++- edalize/rivierapro.py | 2 ++ edalize/templates/vivado/vivado-project.tcl.j2 | 4 ++++ edalize/tools/templates/vivado/vivado-project.tcl.j2 | 5 +++++ edalize/tools/vivado.py | 10 +++++++++- tests/edalize_common.py | 1 + tests/test_rivierapro/edalize_build_rtl.tcl | 1 + 8 files changed, 33 insertions(+), 2 deletions(-) diff --git a/edalize/modelsim.py b/edalize/modelsim.py index f9e7010ac..6f35873b2 100644 --- a/edalize/modelsim.py +++ b/edalize/modelsim.py @@ -145,6 +145,8 @@ def _write_build_rtl_tcl_file(self, tcl_main): args = ["-93"] if f.file_type.endswith("-2008"): args = ["-2008"] + if f.file_type.endswith("-2019"): + args = ["-2019"] else: args = [] diff --git a/edalize/quartus.py b/edalize/quartus.py index 2771654f0..b4cca061e 100644 --- a/edalize/quartus.py +++ b/edalize/quartus.py @@ -141,7 +141,15 @@ def configure_main(self): self.jinja_env.filters["src_file_filter"] = self.src_file_filter self.jinja_env.filters["qsys_file_filter"] = self.qsys_file_filter + #Check VHDL version has_vhdl2008 = "vhdlSource-2008" in [x.file_type for x in src_files] + has_vhdl2019 = "vhdlSource-2019" in [x.file_type for x in src_files] + #Use latest version + if has_vhdl2019: + template_update = {'has_vhdl2019': has_vhdl2019} + else: + template_update = {'has_vhdl2008': has_vhdl2008} + has_qsys = "QSYS" in [x.file_type for x in src_files] escaped_name = self.name.replace(".", "_") @@ -155,8 +163,8 @@ def configure_main(self): "vlogparam": self.vlogparam, "vlogdefine": self.vlogdefine, "generic": self.generic, - "has_vhdl2008": has_vhdl2008, } + template_vars.update(template_update) # Render Makefile based on detected version self.render_template( diff --git a/edalize/rivierapro.py b/edalize/rivierapro.py index 8f01730e9..02f01c009 100644 --- a/edalize/rivierapro.py +++ b/edalize/rivierapro.py @@ -88,6 +88,8 @@ def _write_build_rtl_tcl_file(self, tcl_main): args = ["-93"] if f.file_type.endswith("-2008"): args = ["-2008"] + if f.file_type.endswith("-2019"): + args = ["-2019"] else: args = [] elif f.file_type == "tclSource": diff --git a/edalize/templates/vivado/vivado-project.tcl.j2 b/edalize/templates/vivado/vivado-project.tcl.j2 index 96777bd65..1c1d21d3b 100644 --- a/edalize/templates/vivado/vivado-project.tcl.j2 +++ b/edalize/templates/vivado/vivado-project.tcl.j2 @@ -24,6 +24,10 @@ set_property board_part {{ tool_options.board_part }} [current_project] set_param project.enableVHDL2008 1 {%- endif %} +{% if has_vhdl2019 -%} +set_param project.enableVHDL2019 1 +{%- endif %} + {% if vlogparam -%} set_property generic { {%- for k, v in vlogparam.items() %}{{ k }}={{ v|param_value_str }} {% endfor -%} diff --git a/edalize/tools/templates/vivado/vivado-project.tcl.j2 b/edalize/tools/templates/vivado/vivado-project.tcl.j2 index 96777bd65..9ebc530de 100644 --- a/edalize/tools/templates/vivado/vivado-project.tcl.j2 +++ b/edalize/tools/templates/vivado/vivado-project.tcl.j2 @@ -24,6 +24,11 @@ set_property board_part {{ tool_options.board_part }} [current_project] set_param project.enableVHDL2008 1 {%- endif %} +{% if has_vhdl2019 -%} +#Default since Vivado 2016.1 +set_param project.enableVHDL2019 1 +{%- endif %} + {% if vlogparam -%} set_property generic { {%- for k, v in vlogparam.items() %}{{ k }}={{ v|param_value_str }} {% endfor -%} diff --git a/edalize/tools/vivado.py b/edalize/tools/vivado.py index 3c904cf60..162bc7551 100644 --- a/edalize/tools/vivado.py +++ b/edalize/tools/vivado.py @@ -102,6 +102,7 @@ def setup(self, edam): incdirs = [] edif_files = [] has_vhdl2008 = False + has_vhdl2019 = False has_xci = False unused_files = [] bd_files = [] @@ -127,6 +128,9 @@ def setup(self, edam): if file_type == "vhdlSource-2008": has_vhdl2008 = True cmd += " -vhdl2008" + if file_type == "vhdlSource-2019": + has_vhdl2019 = True + cmd += " -vhdl2019" if f.get("logical_name"): cmd += " -library " + f["logical_name"] elif file_type == "xci": @@ -170,6 +174,10 @@ def setup(self, edam): } ) + if has_vhdl2019: + template_update = {'has_vhdl2019': has_vhdl2019} + else: + template_update = {'has_vhdl2008': has_vhdl2008} self.template_vars = { "name": self.name, "src_files": "\n".join(src_files + sim_files), @@ -180,10 +188,10 @@ def setup(self, edam): "vlogdefine": self.vlogdefine, "generic": self.generic, "netlist_flow": netlist_flow, - "has_vhdl2008": has_vhdl2008, "has_xci": has_xci, "bd_files": bd_files, } + self.template_vars.update(template_update) jobs = self.tool_options.get("jobs", None) self.run_template_vars = { diff --git a/tests/edalize_common.py b/tests/edalize_common.py index 0d4985d7b..0eb6839c4 100644 --- a/tests/edalize_common.py +++ b/tests/edalize_common.py @@ -228,6 +228,7 @@ def _setup_backend( {"name": "vhdl_file.vhd", "file_type": "vhdlSource"}, {"name": "vhdl_lfile", "file_type": "vhdlSource", "logical_name": "libx"}, {"name": "vhdl2008_file", "file_type": "vhdlSource-2008"}, + {"name": "vhdl2019_file", "file_type": "vhdlSource-2019"}, {"name": "xci_file.xci", "file_type": "xci"}, {"name": "xdc_file.xdc", "file_type": "xdc"}, {"name": "bootrom.mem", "file_type": "mem"}, diff --git a/tests/test_rivierapro/edalize_build_rtl.tcl b/tests/test_rivierapro/edalize_build_rtl.tcl index aac796041..1286c6f1b 100644 --- a/tests/test_rivierapro/edalize_build_rtl.tcl +++ b/tests/test_rivierapro/edalize_build_rtl.tcl @@ -7,4 +7,5 @@ vcom -quiet -work work vhdl_file.vhd vlib libx vcom -quiet -work libx vhdl_lfile vcom -2008 -quiet -work work vhdl2008_file +vcom -2019 -quiet -work work vhdl2019_file vlog some vlog_options -sv +define+vlogdefine_bool=1 +define+vlogdefine_int=42 +define+vlogdefine_str=hello +incdir+. -quiet -work work another_sv_file.sv From ae063b689e502dbaa627621c3af30133a5259b92 Mon Sep 17 00:00:00 2001 From: gchqdeveloper888 Date: Thu, 7 Aug 2025 14:37:38 +0100 Subject: [PATCH 2/2] Fixed bug where only one version of vhdl could be used at once --- edalize/rivierapro.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/edalize/rivierapro.py b/edalize/rivierapro.py index 02f01c009..64797f304 100644 --- a/edalize/rivierapro.py +++ b/edalize/rivierapro.py @@ -84,11 +84,11 @@ def _write_build_rtl_tcl_file(self, tcl_main): cmd = "vcom" if f.file_type.endswith("-87"): args = ["-87"] - if f.file_type.endswith("-93"): + elif f.file_type.endswith("-93"): args = ["-93"] - if f.file_type.endswith("-2008"): + elif f.file_type.endswith("-2008"): args = ["-2008"] - if f.file_type.endswith("-2019"): + elif f.file_type.endswith("-2019"): args = ["-2019"] else: args = []