55import subprocess
66import unittest
77
8+
89class TestParams (unittest .TestCase ):
9- """ Unit test for checking correct Makefile settings """
10-
10+ """Unit test for checking correct Makefile settings"""
11+
1112 def setUp (self ):
12- """ Sets up test variables """
13-
13+ """Sets up test variables"""
14+
1415 self ._cmd_base = "make DESIGN_CONFIG=designs/rapidus2hp/cva6/config.mk"
1516 self ._pwd = os .getcwd ()
1617 self ._design_dir = os .path .join (self ._pwd , "designs/rapidus2hp/cva6" )
@@ -19,41 +20,43 @@ def setUp(self):
1920 self ._synopsys_site_list = ["" , "ra02h138_DST_45CPP" , "ra02h138_DST_45CPP" ]
2021
2122 def _get_track_height (self , place_site ):
22- """ Returns the track height for the place site """
23-
23+ """Returns the track height for the place site"""
24+
2425 if place_site .startswith ("SC" ):
2526 return place_site [2 :]
2627 if place_site == "ra02h138_DST_45CPP" :
2728 return "6T"
2829 return "8T"
29-
30+
3031 def test_pdk_0p2_default (self ):
31- """ Tests PDK 0.2 SDC file - should be default for both 6T and 8T """
32-
32+ """Tests PDK 0.2 SDC file - should be default for both 6T and 8T"""
33+
3334 exp_value = os .path .join (self ._design_dir , "constraint.sdc" )
3435 for place_site in self ._ibm_site_list :
3536 if place_site == "" :
3637 cmd = f"{ self ._cmd_base } print-SDC_FILE"
3738 else :
3839 cmd = f"{ self ._cmd_base } PLACE_SITE={ place_site } print-SDC_FILE"
39- out = subprocess .run (cmd , check = True , shell = True ,
40- capture_output = True , text = True )
40+ out = subprocess .run (
41+ cmd , check = True , shell = True , capture_output = True , text = True
42+ )
4143 self .assertEqual (out .returncode , 0 )
4244 result = self ._result_re .match (out .stdout )
4345 self .assertIsNotNone (result )
4446 value = result .group (1 )
4547 self .assertEqual (value , exp_value )
4648
4749 def test_pdk_0p2 (self ):
48- """ Tests PDK 0.2 SDC file - should be default for both 6T and 8T """
50+ """Tests PDK 0.2 SDC file - should be default for both 6T and 8T"""
4951 exp_value = os .path .join (self ._design_dir , "constraint.sdc" )
5052 for place_site in self ._ibm_site_list :
5153 if place_site == "" :
5254 cmd = f"{ self ._cmd_base } RAPIDUS_PDK_VERSION=0.2 print-SDC_FILE"
5355 else :
5456 cmd = f"{ self ._cmd_base } RAPIDUS_PDK_VERSION=0.2 PLACE_SITE={ place_site } print-SDC_FILE"
55- out = subprocess .run (cmd , check = True , shell = True ,
56- capture_output = True , text = True )
57+ out = subprocess .run (
58+ cmd , check = True , shell = True , capture_output = True , text = True
59+ )
5760 self .assertEqual (out .returncode , 0 )
5861 result = self ._result_re .match (out .stdout )
5962 self .assertIsNotNone (result )
@@ -66,18 +69,20 @@ def test_pdk_0p2a(self):
6669 6T: constraint_0.2a_6T.sdc
6770 8T: constraint_0.2a_8T.sdc
6871 """
69-
72+
7073 for place_site in self ._synopsys_site_list :
7174 if place_site == "" :
7275 cmd = f"{ self ._cmd_base } RAPIDUS_PDK_VERSION=0.2a print-SDC_FILE"
7376 exp_value = os .path .join (self ._design_dir , "constraint_0.2a_8T.sdc" )
7477 else :
7578 cmd = f"{ self ._cmd_base } RAPIDUS_PDK_VERSION=0.2a PLACE_SITE={ place_site } print-SDC_FILE"
7679 track_height = self ._get_track_height (place_site )
77- exp_value = os .path .join (self ._design_dir ,
78- f"constraint_0.2a_{ track_height } .sdc" )
79- out = subprocess .run (cmd , check = True , shell = True ,
80- capture_output = True , text = True )
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+ )
8186 self .assertEqual (out .returncode , 0 )
8287 result = self ._result_re .match (out .stdout )
8388 self .assertIsNotNone (result )
@@ -90,26 +95,26 @@ def test_pdk_0p3(self):
9095 6T: constraint_0.3_6T.sdc
9196 8T: constraint_0.3_8T.sdc
9297 """
93-
98+
9499 for place_site in self ._synopsys_site_list :
95100 if place_site == "" :
96101 cmd = f"{ self ._cmd_base } RAPIDUS_PDK_VERSION=0.3 print-SDC_FILE"
97102 exp_value = os .path .join (self ._design_dir , "constraint_0.3_8T.sdc" )
98103 else :
99104 cmd = f"{ self ._cmd_base } RAPIDUS_PDK_VERSION=0.3 PLACE_SITE={ place_site } print-SDC_FILE"
100105 track_height = self ._get_track_height (place_site )
101- exp_value = os .path .join (self ._design_dir ,
102- f"constraint_0.3_{ track_height } .sdc" )
103- out = subprocess .run (cmd , check = True , shell = True ,
104- capture_output = True , text = True )
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+ )
105112 self .assertEqual (out .returncode , 0 )
106113 result = self ._result_re .match (out .stdout )
107114 self .assertIsNotNone (result )
108115 value = result .group (1 )
109116 self .assertEqual (value , exp_value )
110-
117+
118+
111119if __name__ == "__main__" :
112120 unittest .main ()
113-
114-
115-
0 commit comments