Skip to content

Commit aa1d13e

Browse files
authored
Merge pull request #3756 from The-OpenROAD-Project-staging/rapidus-config-tests
Extended param testing to rest of Rapidus designs
2 parents 61e189d + 85926b6 commit aa1d13e

11 files changed

Lines changed: 672 additions & 84 deletions

File tree

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

Lines changed: 51 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,47 @@
11
#!/usr/bin/env python3
22

33
import os
4-
import re
5-
import subprocess
4+
import sys
65
import unittest
76

7+
if __name__ == "__main__":
8+
util_dir = os.path.join(
9+
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
10+
"utils",
11+
)
12+
sys.path.insert(0, util_dir)
13+
from param_test_base import ParamTestBase
14+
815

9-
class TestParams(unittest.TestCase):
16+
class TestParams(ParamTestBase):
1017
"""Unit test for checking correct Makefile settings"""
1118

1219
def setUp(self):
1320
"""Sets up test variables"""
1421

15-
self._cmd_base = "make DESIGN_CONFIG=designs/rapidus2hp/cva6/config.mk"
16-
self._pwd = os.getcwd()
17-
self._design_dir = os.path.join(self._pwd, "designs/rapidus2hp/cva6")
18-
self._result_re = re.compile(r"\S+\s+\=\s+(\S+)")
19-
self._ibm_site_list = ["", "SC6T", "SC8T"]
20-
self._synopsys_site_list = ["", "ra02h138_DST_45CPP", "ra02h138_DST_45CPP"]
21-
22-
def _get_track_height(self, place_site):
23-
"""Returns the track height for the place site"""
24-
25-
if place_site.startswith("SC"):
26-
return place_site[2:]
27-
if place_site == "ra02h138_DST_45CPP":
28-
return "6T"
29-
return "8T"
22+
ParamTestBase.set_up(self, "cva6")
3023

3124
def test_pdk_0p2_default(self):
3225
"""Tests PDK 0.2 SDC file - should be default for both 6T and 8T"""
3326

34-
exp_value = os.path.join(self._design_dir, "constraint.sdc")
35-
for place_site in self._ibm_site_list:
36-
if place_site == "":
37-
cmd = f"{self._cmd_base} print-SDC_FILE"
38-
else:
39-
cmd = f"{self._cmd_base} PLACE_SITE={place_site} print-SDC_FILE"
40-
out = subprocess.run(
41-
cmd, check=True, shell=True, capture_output=True, text=True
42-
)
43-
self.assertEqual(out.returncode, 0)
44-
result = self._result_re.match(out.stdout)
45-
self.assertIsNotNone(result)
46-
value = result.group(1)
47-
self.assertEqual(value, exp_value)
27+
pdk_version = ""
28+
exp_sdc = os.path.join(self._design_full_dir, "constraint.sdc")
29+
for front_end in self._front_end_list:
30+
for place_site in self._ibm_site_list:
31+
self.execute_cmd(
32+
place_site, pdk_version, front_end, "SDC_FILE", exp_sdc
33+
)
4834

4935
def test_pdk_0p2(self):
5036
"""Tests PDK 0.2 SDC file - should be default for both 6T and 8T"""
51-
exp_value = os.path.join(self._design_dir, "constraint.sdc")
52-
for place_site in self._ibm_site_list:
53-
if place_site == "":
54-
cmd = f"{self._cmd_base} RAPIDUS_PDK_VERSION=0.2 print-SDC_FILE"
55-
else:
56-
cmd = f"{self._cmd_base} RAPIDUS_PDK_VERSION=0.2 PLACE_SITE={place_site} print-SDC_FILE"
57-
out = subprocess.run(
58-
cmd, check=True, shell=True, capture_output=True, text=True
59-
)
60-
self.assertEqual(out.returncode, 0)
61-
result = self._result_re.match(out.stdout)
62-
self.assertIsNotNone(result)
63-
value = result.group(1)
64-
self.assertEqual(value, exp_value)
37+
38+
pdk_version = "0.2"
39+
exp_sdc = os.path.join(self._design_full_dir, "constraint.sdc")
40+
for front_end in self._front_end_list:
41+
for place_site in self._ibm_site_list:
42+
self.execute_cmd(
43+
place_site, pdk_version, front_end, "SDC_FILE", exp_sdc
44+
)
6545

6646
def test_pdk_0p2a(self):
6747
"""
@@ -70,24 +50,20 @@ def test_pdk_0p2a(self):
7050
8T: constraint_0.2a_8T.sdc
7151
"""
7252

73-
for place_site in self._synopsys_site_list:
74-
if place_site == "":
75-
cmd = f"{self._cmd_base} RAPIDUS_PDK_VERSION=0.2a print-SDC_FILE"
76-
exp_value = os.path.join(self._design_dir, "constraint_0.2a_8T.sdc")
77-
else:
78-
cmd = f"{self._cmd_base} RAPIDUS_PDK_VERSION=0.2a PLACE_SITE={place_site} print-SDC_FILE"
79-
track_height = self._get_track_height(place_site)
80-
exp_value = os.path.join(
81-
self._design_dir, f"constraint_0.2a_{track_height}.sdc"
53+
pdk_version = "0.2a"
54+
for front_end in self._front_end_list:
55+
for place_site in self._synopsys_site_list:
56+
if place_site == "":
57+
track_height = "8T"
58+
else:
59+
track_height = self.get_track_height(place_site)
60+
exp_sdc = os.path.join(
61+
self._design_full_dir,
62+
f"constraint_{pdk_version}_{track_height}.sdc",
63+
)
64+
self.execute_cmd(
65+
place_site, pdk_version, front_end, "SDC_FILE", exp_sdc
8266
)
83-
out = subprocess.run(
84-
cmd, check=True, shell=True, capture_output=True, text=True
85-
)
86-
self.assertEqual(out.returncode, 0)
87-
result = self._result_re.match(out.stdout)
88-
self.assertIsNotNone(result)
89-
value = result.group(1)
90-
self.assertEqual(value, exp_value)
9167

9268
def test_pdk_0p3(self):
9369
"""
@@ -96,24 +72,19 @@ def test_pdk_0p3(self):
9672
8T: constraint_0.3_8T.sdc
9773
"""
9874

99-
for place_site in self._synopsys_site_list:
100-
if place_site == "":
101-
cmd = f"{self._cmd_base} RAPIDUS_PDK_VERSION=0.3 print-SDC_FILE"
102-
exp_value = os.path.join(self._design_dir, "constraint_0.3_8T.sdc")
103-
else:
104-
cmd = f"{self._cmd_base} RAPIDUS_PDK_VERSION=0.3 PLACE_SITE={place_site} print-SDC_FILE"
105-
track_height = self._get_track_height(place_site)
106-
exp_value = os.path.join(
107-
self._design_dir, f"constraint_0.3_{track_height}.sdc"
75+
pdk_version = "0.3"
76+
for front_end in self._front_end_list:
77+
for place_site in self._synopsys_site_list:
78+
if place_site == "":
79+
track_height = "8T"
80+
else:
81+
track_height = self.get_track_height(place_site)
82+
exp_sdc = os.path.join(
83+
self._design_full_dir, f"constraint_0.3_{track_height}.sdc"
84+
)
85+
self.execute_cmd(
86+
place_site, pdk_version, front_end, "SDC_FILE", exp_sdc
10887
)
109-
out = subprocess.run(
110-
cmd, check=True, shell=True, capture_output=True, text=True
111-
)
112-
self.assertEqual(out.returncode, 0)
113-
result = self._result_re.match(out.stdout)
114-
self.assertIsNotNone(result)
115-
value = result.group(1)
116-
self.assertEqual(value, exp_value)
11788

11889

11990
if __name__ == "__main__":
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import sys
5+
import unittest
6+
7+
if __name__ == "__main__":
8+
util_dir = os.path.join(
9+
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
10+
"utils",
11+
)
12+
sys.path.insert(0, util_dir)
13+
from param_test_base import ParamTestBase
14+
15+
16+
class TestParams(ParamTestBase):
17+
"""Unit test for checking correct Makefile settings"""
18+
19+
def setUp(self):
20+
"""Sets up test variables"""
21+
22+
ParamTestBase.set_up(self, "ethmac")
23+
24+
def test_pdk_0p2_default(self):
25+
"""Tests PDK 0.2 Utilization - should be 70"""
26+
27+
front_end = ""
28+
pdk_version = ""
29+
exp_util = 70
30+
for place_site in self._ibm_site_list:
31+
self.execute_cmd(
32+
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
33+
)
34+
35+
def test_pdk_0p2(self):
36+
"""Tests PDK 0.2 Utilization - should be 70"""
37+
38+
front_end = ""
39+
pdk_version = "0.2"
40+
exp_util = 70
41+
for place_site in self._ibm_site_list:
42+
self.execute_cmd(
43+
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
44+
)
45+
46+
def test_pdk_0p2a(self):
47+
"""Tests PDK 0.2a Utilization - should be 70"""
48+
49+
front_end = ""
50+
pdk_version = "0.2a"
51+
exp_util = 70
52+
for place_site in self._synopsys_site_list:
53+
self.execute_cmd(
54+
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
55+
)
56+
57+
def test_pdk_0p3(self):
58+
"""Tests PDK 0.2a Utilization - should be 65"""
59+
60+
front_end = ""
61+
pdk_version = "0.3"
62+
exp_util = 65
63+
for place_site in self._synopsys_site_list:
64+
self.execute_cmd(
65+
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
66+
)
67+
68+
69+
if __name__ == "__main__":
70+
unittest.main()
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import sys
5+
import unittest
6+
7+
if __name__ == "__main__":
8+
util_dir = os.path.join(
9+
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
10+
"utils",
11+
)
12+
sys.path.insert(0, util_dir)
13+
from param_test_base import ParamTestBase
14+
15+
16+
class TestParams(ParamTestBase):
17+
"""Unit test for checking correct Makefile settings"""
18+
19+
def setUp(self):
20+
"""Sets up test variables"""
21+
22+
ParamTestBase.set_up(self, "gcd")
23+
24+
def get_exp_util(self, place_site):
25+
"""Returns the expected value"""
26+
27+
if place_site in ["SC6T", "ra02h138_DST_45CPP"]:
28+
return 43
29+
return 45
30+
31+
def test_pdk_0p2_default(self):
32+
"""
33+
Tests PDK 0.2 utilization
34+
"""
35+
36+
front_end = ""
37+
pdk_version = ""
38+
for place_site in self._ibm_site_list:
39+
exp_util = self.get_exp_util(place_site)
40+
self.execute_cmd(
41+
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
42+
)
43+
44+
def test_pdk_0p2(self):
45+
"""
46+
Tests PDK 0.2 utilization
47+
"""
48+
49+
front_end = ""
50+
pdk_version = "0.2"
51+
for place_site in self._ibm_site_list:
52+
exp_util = self.get_exp_util(place_site)
53+
self.execute_cmd(
54+
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
55+
)
56+
57+
def test_pdk_0p2a(self):
58+
"""
59+
Tests PDK 0.2a utilization
60+
"""
61+
62+
front_end = ""
63+
pdk_version = "0.2a"
64+
for place_site in self._synopsys_site_list:
65+
exp_util = self.get_exp_util(place_site)
66+
self.execute_cmd(
67+
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
68+
)
69+
70+
def test_pdk_0p3(self):
71+
"""
72+
Tests PDK 0.3 utilization
73+
"""
74+
75+
front_end = ""
76+
pdk_version = "0.3"
77+
for place_site in self._synopsys_site_list:
78+
exp_util = self.get_exp_util(place_site)
79+
self.execute_cmd(
80+
place_site, pdk_version, front_end, "CORE_UTILIZATION", exp_util
81+
)
82+
83+
84+
if __name__ == "__main__":
85+
unittest.main()

‎flow/designs/rapidus2hp/hercules_idecode/config.mk‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export SYNTH_HDL_FRONTEND ?= slang
2424
# | Front End | Place Site | Utilization |
2525
# | --------- | ---------- | ----------- |
2626
# | slang | 6T | 44 |
27-
# | slang | 6T | 50 |
27+
# | slang | 8T | 50 |
2828
# | verific | 6T | 43 |
29-
# | verific | 6T | 48 |
29+
# | verific | 8T | 48 |
3030

3131
export CORE_UTILIZATION = $(strip $(if $(filter slang,$(SYNTH_HDL_FRONTEND)), \
3232
$(if $(filter ra02h138_DST_45CPP SC6T,$(PLACE_SITE)), \

0 commit comments

Comments
 (0)