diff --git a/edalize/quartus.py b/edalize/quartus.py index f6068ad18..2f8d72301 100644 --- a/edalize/quartus.py +++ b/edalize/quartus.py @@ -184,13 +184,20 @@ def qsys_file_filter(self, f): try: qsysTree = ET.parse(os.path.join(self.work_root, f.name)) try: - tool = qsysTree.find("component").attrib["tool"] - if tool == "QsysPro" and self.isPro: + try: + tool = qsysTree.find("component").attrib["tool"] + except AttributeError: + tool = qsysTree.find(".//{http://www.altera.com/XMLSchema/IPXact2014/extensions}tool").text + if tool == "QsysPro": + if self.isPro: + name = f.name + elif not self.isPro: name = f.name except (AttributeError, KeyError): # Either a component wasn't found in the QSYS file, or it # had no associated tool information. Make the assumption - # it was a Standard edition file + # it is a Standard edition file, as the old formats just + # don't specify. if not self.isPro: name = f.name except (ET.ParseError, IOError): diff --git a/tests/test_quartus.py b/tests/test_quartus.py index 6f34c3bff..861b002f8 100644 --- a/tests/test_quartus.py +++ b/tests/test_quartus.py @@ -10,12 +10,31 @@ description="" tags="" categories="System" - {} + tool="{}" /> """ -qsys_fill = {"Standard": "", "Pro": 'tool="QsysPro"'} +qsys23_file = """ + + Altera Corporation + sdm_mailbox + sdm_mailbox + 1.0 + + + + 1.0 + + + + {} + + + +""" + +qsys_fill = {"Standard": "", "Pro": "QsysPro"} test_sets = { "Standard": { @@ -64,30 +83,31 @@ def test_quartus(make_edalize_test): # Test each edition of Quartus for edition in ["Standard", "Pro"]: for pnr in ["Quartus", "DSE"]: - # Each edition and P&R tool has its own set of representative files - if pnr == "DSE": - _tool_options = {**tool_options, "pnr": "dse"} - else: - _tool_options = {**tool_options} + for qsys_format in [qsys_file, qsys23_file]: + # Each edition and P&R tool has its own set of representative files + if pnr == "DSE": + _tool_options = {**tool_options, "pnr": "dse"} + else: + _tool_options = {**tool_options} - # Ensure we test the edition we intend to, even if quartus_sh is - # present - os.environ["FUSESOC_QUARTUS_EDITION"] = edition + # Ensure we test the edition we intend to, even if quartus_sh is + # not present + os.environ["FUSESOC_QUARTUS_EDITION"] = edition - tf = make_edalize_test( - "quartus", - param_types=["vlogdefine", "vlogparam"], - tool_options=_tool_options, - ref_dir=edition, - ) + tf = make_edalize_test( + "quartus", + param_types=["vlogdefine", "vlogparam"], + tool_options=_tool_options, + ref_dir=edition, + ) - # Each edition performs checks on the QSYS files present, so - # provide a minimal example - with open(os.path.join(tf.work_root, "qsys_file"), "w") as f: - f.write(qsys_file.format(qsys_fill[edition])) + # Each edition performs checks on the QSYS files present, so + # provide a minimal example + with open(os.path.join(tf.work_root, "qsys_file"), "w") as f: + f.write(qsys_format.format(qsys_fill[edition])) - tf.backend.configure() - tf.compare_files(["Makefile", tf.test_name + ".tcl"]) + tf.backend.configure() + tf.compare_files(["Makefile", tf.test_name + ".tcl"]) - tf.backend.build() - tf.compare_files(test_sets[edition][pnr]) + tf.backend.build() + tf.compare_files(test_sets[edition][pnr])