Skip to content

Commit ce4f540

Browse files
authored
Merge pull request #3822 from The-OpenROAD-Project-staging/fix-rapidus-ibex-frontend
Fixed SYNTH_HDL_FRONTEND for rapidus2hp ibex when FLOW_VARIANT is ver…
2 parents 169b196 + ae5c0c9 commit ce4f540

10 files changed

Lines changed: 76 additions & 23 deletions

File tree

flow/designs/rapidus2hp/cva6/test/test_params.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestParams(ParamTestBase):
1919
def setUp(self):
2020
"""Sets up test variables"""
2121

22-
ParamTestBase.set_up(self, "cva6")
22+
ParamTestBase.setUp(self, "cva6")
2323

2424
def get_exp_sdc(self, place_site, pdk_version):
2525
"""Returns the expected SDC file path"""
@@ -92,6 +92,16 @@ def test_pdk_0p3(self):
9292
exp_sdc = self.get_exp_sdc(place_site, pdk_version)
9393
self.execute_cmd(place_site, pdk_version, front_end, "SDC_FILE", exp_sdc)
9494

95+
def test_flow_variant(self):
96+
"""Tests that setting the flow variant uses the right frontend"""
97+
98+
test_tag = "flow_variant default"
99+
cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND")
100+
self.execute_cmd_int(cmd, test_tag, "slang")
101+
test_tag = "flow_variant verific"
102+
cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND", "verific")
103+
self.execute_cmd_int(cmd, test_tag, "verific")
104+
95105

96106
if __name__ == "__main__":
97107
unittest.main()

flow/designs/rapidus2hp/ethmac/test/test_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestParams(ParamTestBase):
1919
def setUp(self):
2020
"""Sets up test variables"""
2121

22-
ParamTestBase.set_up(self, "ethmac")
22+
ParamTestBase.setUp(self, "ethmac")
2323

2424
def get_exp_util(self, place_site, pdk_version):
2525
"""Returns the expected utilization"""

flow/designs/rapidus2hp/gcd/test/test_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestParams(ParamTestBase):
1919
def setUp(self):
2020
"""Sets up test variables"""
2121

22-
ParamTestBase.set_up(self, "gcd")
22+
ParamTestBase.setUp(self, "gcd")
2323

2424
def get_exp_util(self, place_site, pdk_version):
2525
"""Returns the expected value"""

flow/designs/rapidus2hp/hercules_idecode/test/test_params.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestParams(ParamTestBase):
1919
def setUp(self):
2020
"""Sets up test variables"""
2121

22-
ParamTestBase.set_up(self, "hercules_idecode")
22+
ParamTestBase.setUp(self, "hercules_idecode")
2323

2424
def get_exp_util(self, place_site, front_end):
2525
"""Returns the expected value"""
@@ -98,6 +98,16 @@ def test_pdk_0p3(self):
9898
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
9999
)
100100

101+
def test_flow_variant(self):
102+
"""Tests that setting the flow variant uses the right frontend"""
103+
104+
test_tag = "flow_variant default"
105+
cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND")
106+
self.execute_cmd_int(cmd, test_tag, "slang")
107+
test_tag = "flow_variant verific"
108+
cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND", "verific")
109+
self.execute_cmd_int(cmd, test_tag, "verific")
110+
101111

102112
if __name__ == "__main__":
103113
unittest.main()

flow/designs/rapidus2hp/hercules_is_int/test/test_params.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestParams(ParamTestBase):
1919
def setUp(self):
2020
"""Sets up test variables"""
2121

22-
ParamTestBase.set_up(self, "hercules_is_int")
22+
ParamTestBase.setUp(self, "hercules_is_int")
2323

2424
def get_exp_util(self, place_site, front_end, pdk_version):
2525
"""Returns the expected value"""
@@ -100,6 +100,16 @@ def test_pdk_0p3(self):
100100
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
101101
)
102102

103+
def test_flow_variant(self):
104+
"""Tests that setting the flow variant uses the right frontend"""
105+
106+
test_tag = "flow_variant default"
107+
cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND")
108+
self.execute_cmd_int(cmd, test_tag, "slang")
109+
test_tag = "flow_variant verific"
110+
cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND", "verific")
111+
self.execute_cmd_int(cmd, test_tag, "verific")
112+
103113

104114
if __name__ == "__main__":
105115
unittest.main()

flow/designs/rapidus2hp/ibex/config.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ ifeq ($(FLOW_VARIANT), verific)
77
export SYNTH_HDL_FRONTEND = verific
88
endif
99

10-
export VERILOG_FILES = $(sort $(wildcard $(DESIGN_HOME)/src/ibex_sv/*.sv)) \
10+
export VERILOG_FILES = \
11+
$(DESIGN_HOME)/src/ibex_sv/ibex_pkg.sv \
12+
$(sort $(wildcard $(DESIGN_HOME)/src/ibex_sv/*.sv)) \
1113
$(DESIGN_HOME)/src/ibex_sv/syn/rtl/prim_clock_gating.v
1214

1315
export VERILOG_INCLUDE_DIRS = \
1416
$(DESIGN_HOME)/src/ibex_sv/vendor/lowrisc_ip/prim/rtl/
1517

16-
export SYNTH_HDL_FRONTEND = slang
18+
export SYNTH_HDL_FRONTEND ?= slang
1719

1820

1921
# if FLOW_VARIANT == pos_slack, use an SDC file that has a larger clock

flow/designs/rapidus2hp/ibex/rules-verific.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
{
22
"synth__design__instance__area__stdcell": {
3-
"value": 1050.0,
3+
"value": 1030.0,
44
"compare": "<="
55
},
66
"constraints__clocks__count": {
77
"value": 1,
88
"compare": "=="
99
},
1010
"placeopt__design__instance__area": {
11-
"value": 1067,
11+
"value": 1060,
1212
"compare": "<="
1313
},
1414
"placeopt__design__instance__count__stdcell": {
15-
"value": 20402,
15+
"value": 20243,
1616
"compare": "<="
1717
},
1818
"detailedplace__design__violations": {
1919
"value": 0,
2020
"compare": "=="
2121
},
2222
"cts__design__instance__count__setup_buffer": {
23-
"value": 1774,
23+
"value": 1760,
2424
"compare": "<="
2525
},
2626
"cts__design__instance__count__hold_buffer": {
27-
"value": 1774,
27+
"value": 1760,
2828
"compare": "<="
2929
},
3030
"cts__timing__setup__ws": {
@@ -48,11 +48,11 @@
4848
"compare": "<="
4949
},
5050
"globalroute__timing__setup__ws": {
51-
"value": -41.4,
51+
"value": -97.8,
5252
"compare": ">="
5353
},
5454
"globalroute__timing__setup__tns": {
55-
"value": -5770.0,
55+
"value": -47700.0,
5656
"compare": ">="
5757
},
5858
"globalroute__timing__hold__ws": {
@@ -64,11 +64,11 @@
6464
"compare": ">="
6565
},
6666
"finish__timing__setup__ws": {
67-
"value": -41.4,
67+
"value": -97.8,
6868
"compare": ">="
6969
},
7070
"finish__timing__setup__tns": {
71-
"value": -5770.0,
71+
"value": -47700.0,
7272
"compare": ">="
7373
},
7474
"finish__timing__hold__ws": {

flow/designs/rapidus2hp/ibex/test/test_params.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestParams(ParamTestBase):
1919
def setUp(self):
2020
"""Sets up test variables"""
2121

22-
ParamTestBase.set_up(self, "ibex")
22+
ParamTestBase.setUp(self, "ibex")
2323

2424
def get_exp_util(self, place_site, pdk_version):
2525
"""Returns the expected utilization"""
@@ -127,6 +127,16 @@ def test_pdk_0p3(self):
127127
)
128128
self.execute_cmd(place_site, pdk_version, front_end, "SDC_FILE", exp_sdc)
129129

130+
def test_flow_variant(self):
131+
"""Tests that setting the flow variant uses the right frontend"""
132+
133+
test_tag = "flow_variant default"
134+
cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND")
135+
self.execute_cmd_int(cmd, test_tag, "slang")
136+
test_tag = "flow_variant verific"
137+
cmd = self.build_cmd("", "", "", "SYNTH_HDL_FRONTEND", "verific")
138+
self.execute_cmd_int(cmd, test_tag, "verific")
139+
130140

131141
if __name__ == "__main__":
132142
unittest.main()

flow/designs/rapidus2hp/jpeg/test/test_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestParams(ParamTestBase):
1919
def setUp(self):
2020
"""Sets up test variables"""
2121

22-
ParamTestBase.set_up(self, "jpeg")
22+
ParamTestBase.setUp(self, "jpeg")
2323

2424
def get_exp_sdc(self, place_site, pdk_version):
2525
"""Returns the expected SDC file path"""

flow/designs/rapidus2hp/utils/param_test_base.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class ParamTestBase(unittest.TestCase):
1010
"""Base class for testing params"""
1111

12-
def set_up(self, design_name):
12+
def setUp(self, design_name):
1313
"""
1414
Sets up common member variables.
1515
Assumes we're running in flow directory
@@ -18,8 +18,8 @@ def set_up(self, design_name):
1818
self._platform = "rapidus2hp"
1919
self._design = design_name
2020
self._design_dir = os.path.join("designs", self._platform, self._design)
21-
self._design_full_dir = os.path.join(os.getcwd(), self._design_dir)
2221
self._cmd_base = f"make DESIGN_CONFIG={self._design_dir}/config.mk"
22+
self._design_full_dir = os.path.join(os.getcwd(), self._design_dir)
2323
self._result_re = re.compile(r"\S+\s+\=\s+(\S+)")
2424
self._front_end_list = ["", "slang", "verific"]
2525
self._ibm_site_list = ["", "SC6T", "SC8T"]
@@ -34,7 +34,9 @@ def get_track_height(self, place_site):
3434
return "6T"
3535
return "8T"
3636

37-
def build_cmd(self, place_site, pdk_version, front_end, param_name):
37+
def build_cmd(
38+
self, place_site, pdk_version, front_end, param_name, flow_variant=None
39+
):
3840
"""Builds the command to execute"""
3941

4042
str_buf = [self._cmd_base]
@@ -44,18 +46,27 @@ def build_cmd(self, place_site, pdk_version, front_end, param_name):
4446
str_buf.append(f"RAPIDUS_PDK_VERSION={pdk_version}")
4547
if front_end == "verific":
4648
str_buf.append(f"SYNTH_HDL_FRONTEND={front_end}")
49+
if flow_variant and flow_variant != "":
50+
str_buf.append(f"FLOW_VARIANT={flow_variant}")
4751
str_buf.append(f"print-{param_name}")
4852
return " ".join(str_buf)
4953

5054
def execute_cmd(self, place_site, pdk_version, front_end, param_name, exp_result):
5155
"""
5256
Executes command
53-
check if return code is 0
54-
check if value matches expected result
5557
"""
5658

5759
test_tag = f"'{place_site}' '{pdk_version}' '{front_end}'"
5860
cmd = self.build_cmd(place_site, pdk_version, front_end, param_name)
61+
self.execute_cmd_int(cmd, test_tag, exp_result)
62+
63+
def execute_cmd_int(self, cmd, test_tag, exp_result):
64+
"""
65+
Executes command
66+
check if return code is 0
67+
check if value matches expected result
68+
"""
69+
5970
out = subprocess.run(
6071
cmd, check=True, shell=True, capture_output=True, text=True
6172
)

0 commit comments

Comments
 (0)