Skip to content

Commit 3166cbb

Browse files
authored
Merge pull request #3755 from The-OpenROAD-Project-staging/fix-rapidus-cva6
fixed SDC setting for rapidus cva6
2 parents 1ff0d08 + 2f11860 commit 3166cbb

2 files changed

Lines changed: 126 additions & 3 deletions

File tree

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,12 @@ export SDC_FILE = $(strip \
107107
$(_0P2A_6T_SDC_FILE), \
108108
$(_0P2A_8T_SDC_FILE) \
109109
), \
110-
$(if $(and $(filter 0.3,$(RAPIDUS_PDK_VERSION)),$(filter ra02h138_DST_45CPP,$(PLACE_SITE))), \
111-
$(_0P3_6T_SDC_FILE), \
112-
$(_0P3_8T_SDC_FILE) \
110+
$(if $(filter 0.3,$(RAPIDUS_PDK_VERSION)), \
111+
$(if $(filter ra02h138_DST_45CPP,$(PLACE_SITE)), \
112+
$(_0P3_6T_SDC_FILE), \
113+
$(_0P3_8T_SDC_FILE) \
114+
), \
115+
$(DEFAULT_SDC_FILE) \
113116
) \
114117
))
115118

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import re
5+
import subprocess
6+
import unittest
7+
8+
9+
class TestParams(unittest.TestCase):
10+
"""Unit test for checking correct Makefile settings"""
11+
12+
def setUp(self):
13+
"""Sets up test variables"""
14+
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"
30+
31+
def test_pdk_0p2_default(self):
32+
"""Tests PDK 0.2 SDC file - should be default for both 6T and 8T"""
33+
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)
48+
49+
def test_pdk_0p2(self):
50+
"""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)
65+
66+
def test_pdk_0p2a(self):
67+
"""
68+
Tests PDK 0.2a SDC file
69+
6T: constraint_0.2a_6T.sdc
70+
8T: constraint_0.2a_8T.sdc
71+
"""
72+
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"
82+
)
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)
91+
92+
def test_pdk_0p3(self):
93+
"""
94+
Tests PDK 0.3 SDC file
95+
6T: constraint_0.3_6T.sdc
96+
8T: constraint_0.3_8T.sdc
97+
"""
98+
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"
108+
)
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)
117+
118+
119+
if __name__ == "__main__":
120+
unittest.main()

0 commit comments

Comments
 (0)