From ae5c0c9e6799d6ff7f20a4d4d3706b5d0b203094 Mon Sep 17 00:00:00 2001 From: Jeff Ng Date: Tue, 20 Jan 2026 17:32:39 +0000 Subject: [PATCH] Fixed SYNTH_HDL_FRONTEND for rapidus2hp ibex when FLOW_VARIANT is verific black formatting Signed-off-by: Jeff Ng --- .../rapidus2hp/cva6/test/test_params.py | 12 ++++++++++- .../rapidus2hp/ethmac/test/test_params.py | 2 +- .../rapidus2hp/gcd/test/test_params.py | 2 +- .../hercules_idecode/test/test_params.py | 12 ++++++++++- .../hercules_is_int/test/test_params.py | 12 ++++++++++- flow/designs/rapidus2hp/ibex/config.mk | 6 ++++-- .../rapidus2hp/ibex/rules-verific.json | 18 ++++++++-------- .../rapidus2hp/ibex/test/test_params.py | 12 ++++++++++- .../rapidus2hp/jpeg/test/test_params.py | 2 +- .../rapidus2hp/utils/param_test_base.py | 21 ++++++++++++++----- 10 files changed, 76 insertions(+), 23 deletions(-) diff --git a/flow/designs/rapidus2hp/cva6/test/test_params.py b/flow/designs/rapidus2hp/cva6/test/test_params.py index b04c8bc987..22872457f5 100755 --- a/flow/designs/rapidus2hp/cva6/test/test_params.py +++ b/flow/designs/rapidus2hp/cva6/test/test_params.py @@ -19,7 +19,7 @@ class TestParams(ParamTestBase): def setUp(self): """Sets up test variables""" - ParamTestBase.set_up(self, "cva6") + ParamTestBase.setUp(self, "cva6") def get_exp_sdc(self, place_site, pdk_version): """Returns the expected SDC file path""" @@ -92,6 +92,16 @@ def test_pdk_0p3(self): exp_sdc = self.get_exp_sdc(place_site, pdk_version) self.execute_cmd(place_site, pdk_version, front_end, "SDC_FILE", exp_sdc) + def test_flow_variant(self): + """Tests that setting the flow variant uses the right frontend""" + + test_tag = "flow_variant default" + cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND") + self.execute_cmd_int(cmd, test_tag, "slang") + test_tag = "flow_variant verific" + cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND", "verific") + self.execute_cmd_int(cmd, test_tag, "verific") + if __name__ == "__main__": unittest.main() diff --git a/flow/designs/rapidus2hp/ethmac/test/test_params.py b/flow/designs/rapidus2hp/ethmac/test/test_params.py index cbbe764f02..a024b3d317 100755 --- a/flow/designs/rapidus2hp/ethmac/test/test_params.py +++ b/flow/designs/rapidus2hp/ethmac/test/test_params.py @@ -19,7 +19,7 @@ class TestParams(ParamTestBase): def setUp(self): """Sets up test variables""" - ParamTestBase.set_up(self, "ethmac") + ParamTestBase.setUp(self, "ethmac") def get_exp_util(self, place_site, pdk_version): """Returns the expected utilization""" diff --git a/flow/designs/rapidus2hp/gcd/test/test_params.py b/flow/designs/rapidus2hp/gcd/test/test_params.py index 60cb50d929..e79f23ae1f 100755 --- a/flow/designs/rapidus2hp/gcd/test/test_params.py +++ b/flow/designs/rapidus2hp/gcd/test/test_params.py @@ -19,7 +19,7 @@ class TestParams(ParamTestBase): def setUp(self): """Sets up test variables""" - ParamTestBase.set_up(self, "gcd") + ParamTestBase.setUp(self, "gcd") def get_exp_util(self, place_site, pdk_version): """Returns the expected value""" diff --git a/flow/designs/rapidus2hp/hercules_idecode/test/test_params.py b/flow/designs/rapidus2hp/hercules_idecode/test/test_params.py index 93c5f0d4ff..d60fa4aa74 100755 --- a/flow/designs/rapidus2hp/hercules_idecode/test/test_params.py +++ b/flow/designs/rapidus2hp/hercules_idecode/test/test_params.py @@ -19,7 +19,7 @@ class TestParams(ParamTestBase): def setUp(self): """Sets up test variables""" - ParamTestBase.set_up(self, "hercules_idecode") + ParamTestBase.setUp(self, "hercules_idecode") def get_exp_util(self, place_site, front_end): """Returns the expected value""" @@ -98,6 +98,16 @@ def test_pdk_0p3(self): place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util ) + def test_flow_variant(self): + """Tests that setting the flow variant uses the right frontend""" + + test_tag = "flow_variant default" + cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND") + self.execute_cmd_int(cmd, test_tag, "slang") + test_tag = "flow_variant verific" + cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND", "verific") + self.execute_cmd_int(cmd, test_tag, "verific") + if __name__ == "__main__": unittest.main() diff --git a/flow/designs/rapidus2hp/hercules_is_int/test/test_params.py b/flow/designs/rapidus2hp/hercules_is_int/test/test_params.py index 2a54d98df2..4844d65900 100755 --- a/flow/designs/rapidus2hp/hercules_is_int/test/test_params.py +++ b/flow/designs/rapidus2hp/hercules_is_int/test/test_params.py @@ -19,7 +19,7 @@ class TestParams(ParamTestBase): def setUp(self): """Sets up test variables""" - ParamTestBase.set_up(self, "hercules_is_int") + ParamTestBase.setUp(self, "hercules_is_int") def get_exp_util(self, place_site, front_end, pdk_version): """Returns the expected value""" @@ -100,6 +100,16 @@ def test_pdk_0p3(self): place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util ) + def test_flow_variant(self): + """Tests that setting the flow variant uses the right frontend""" + + test_tag = "flow_variant default" + cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND") + self.execute_cmd_int(cmd, test_tag, "slang") + test_tag = "flow_variant verific" + cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND", "verific") + self.execute_cmd_int(cmd, test_tag, "verific") + if __name__ == "__main__": unittest.main() diff --git a/flow/designs/rapidus2hp/ibex/config.mk b/flow/designs/rapidus2hp/ibex/config.mk index 3af6a1dd57..e41753f71c 100644 --- a/flow/designs/rapidus2hp/ibex/config.mk +++ b/flow/designs/rapidus2hp/ibex/config.mk @@ -7,13 +7,15 @@ ifeq ($(FLOW_VARIANT), verific) export SYNTH_HDL_FRONTEND = verific endif -export VERILOG_FILES = $(sort $(wildcard $(DESIGN_HOME)/src/ibex_sv/*.sv)) \ +export VERILOG_FILES = \ + $(DESIGN_HOME)/src/ibex_sv/ibex_pkg.sv \ + $(sort $(wildcard $(DESIGN_HOME)/src/ibex_sv/*.sv)) \ $(DESIGN_HOME)/src/ibex_sv/syn/rtl/prim_clock_gating.v export VERILOG_INCLUDE_DIRS = \ $(DESIGN_HOME)/src/ibex_sv/vendor/lowrisc_ip/prim/rtl/ -export SYNTH_HDL_FRONTEND = slang +export SYNTH_HDL_FRONTEND ?= slang # if FLOW_VARIANT == pos_slack, use an SDC file that has a larger clock diff --git a/flow/designs/rapidus2hp/ibex/rules-verific.json b/flow/designs/rapidus2hp/ibex/rules-verific.json index 061ec4e8ff..71ae0f471c 100644 --- a/flow/designs/rapidus2hp/ibex/rules-verific.json +++ b/flow/designs/rapidus2hp/ibex/rules-verific.json @@ -1,6 +1,6 @@ { "synth__design__instance__area__stdcell": { - "value": 1050.0, + "value": 1030.0, "compare": "<=" }, "constraints__clocks__count": { @@ -8,11 +8,11 @@ "compare": "==" }, "placeopt__design__instance__area": { - "value": 1067, + "value": 1060, "compare": "<=" }, "placeopt__design__instance__count__stdcell": { - "value": 20402, + "value": 20243, "compare": "<=" }, "detailedplace__design__violations": { @@ -20,11 +20,11 @@ "compare": "==" }, "cts__design__instance__count__setup_buffer": { - "value": 1774, + "value": 1760, "compare": "<=" }, "cts__design__instance__count__hold_buffer": { - "value": 1774, + "value": 1760, "compare": "<=" }, "cts__timing__setup__ws": { @@ -48,11 +48,11 @@ "compare": "<=" }, "globalroute__timing__setup__ws": { - "value": -41.4, + "value": -97.8, "compare": ">=" }, "globalroute__timing__setup__tns": { - "value": -5770.0, + "value": -47700.0, "compare": ">=" }, "globalroute__timing__hold__ws": { @@ -64,11 +64,11 @@ "compare": ">=" }, "finish__timing__setup__ws": { - "value": -41.4, + "value": -97.8, "compare": ">=" }, "finish__timing__setup__tns": { - "value": -5770.0, + "value": -47700.0, "compare": ">=" }, "finish__timing__hold__ws": { diff --git a/flow/designs/rapidus2hp/ibex/test/test_params.py b/flow/designs/rapidus2hp/ibex/test/test_params.py index 4a8aa9fa66..1496793c1b 100755 --- a/flow/designs/rapidus2hp/ibex/test/test_params.py +++ b/flow/designs/rapidus2hp/ibex/test/test_params.py @@ -19,7 +19,7 @@ class TestParams(ParamTestBase): def setUp(self): """Sets up test variables""" - ParamTestBase.set_up(self, "ibex") + ParamTestBase.setUp(self, "ibex") def get_exp_util(self, place_site, pdk_version): """Returns the expected utilization""" @@ -127,6 +127,16 @@ def test_pdk_0p3(self): ) self.execute_cmd(place_site, pdk_version, front_end, "SDC_FILE", exp_sdc) + def test_flow_variant(self): + """Tests that setting the flow variant uses the right frontend""" + + test_tag = "flow_variant default" + cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND") + self.execute_cmd_int(cmd, test_tag, "slang") + test_tag = "flow_variant verific" + cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND", "verific") + self.execute_cmd_int(cmd, test_tag, "verific") + if __name__ == "__main__": unittest.main() diff --git a/flow/designs/rapidus2hp/jpeg/test/test_params.py b/flow/designs/rapidus2hp/jpeg/test/test_params.py index cf35de1be9..f0d784a61d 100755 --- a/flow/designs/rapidus2hp/jpeg/test/test_params.py +++ b/flow/designs/rapidus2hp/jpeg/test/test_params.py @@ -19,7 +19,7 @@ class TestParams(ParamTestBase): def setUp(self): """Sets up test variables""" - ParamTestBase.set_up(self, "jpeg") + ParamTestBase.setUp(self, "jpeg") def get_exp_sdc(self, place_site, pdk_version): """Returns the expected SDC file path""" diff --git a/flow/designs/rapidus2hp/utils/param_test_base.py b/flow/designs/rapidus2hp/utils/param_test_base.py index 735c9d5d9a..3f720e3ca9 100644 --- a/flow/designs/rapidus2hp/utils/param_test_base.py +++ b/flow/designs/rapidus2hp/utils/param_test_base.py @@ -9,7 +9,7 @@ class ParamTestBase(unittest.TestCase): """Base class for testing params""" - def set_up(self, design_name): + def setUp(self, design_name): """ Sets up common member variables. Assumes we're running in flow directory @@ -18,8 +18,8 @@ def set_up(self, design_name): self._platform = "rapidus2hp" self._design = design_name self._design_dir = os.path.join("designs", self._platform, self._design) - self._design_full_dir = os.path.join(os.getcwd(), self._design_dir) self._cmd_base = f"make DESIGN_CONFIG={self._design_dir}/config.mk" + self._design_full_dir = os.path.join(os.getcwd(), self._design_dir) self._result_re = re.compile(r"\S+\s+\=\s+(\S+)") self._front_end_list = ["", "slang", "verific"] self._ibm_site_list = ["", "SC6T", "SC8T"] @@ -34,7 +34,9 @@ def get_track_height(self, place_site): return "6T" return "8T" - def build_cmd(self, place_site, pdk_version, front_end, param_name): + def build_cmd( + self, place_site, pdk_version, front_end, param_name, flow_variant=None + ): """Builds the command to execute""" str_buf = [self._cmd_base] @@ -44,18 +46,27 @@ def build_cmd(self, place_site, pdk_version, front_end, param_name): str_buf.append(f"RAPIDUS_PDK_VERSION={pdk_version}") if front_end == "verific": str_buf.append(f"SYNTH_HDL_FRONTEND={front_end}") + if flow_variant and flow_variant != "": + str_buf.append(f"FLOW_VARIANT={flow_variant}") str_buf.append(f"print-{param_name}") return " ".join(str_buf) def execute_cmd(self, place_site, pdk_version, front_end, param_name, exp_result): """ Executes command - check if return code is 0 - check if value matches expected result """ test_tag = f"'{place_site}' '{pdk_version}' '{front_end}'" cmd = self.build_cmd(place_site, pdk_version, front_end, param_name) + self.execute_cmd_int(cmd, test_tag, exp_result) + + def execute_cmd_int(self, cmd, test_tag, exp_result): + """ + Executes command + check if return code is 0 + check if value matches expected result + """ + out = subprocess.run( cmd, check=True, shell=True, capture_output=True, text=True )