Skip to content

Commit 4192f3b

Browse files
authored
Update ICV defaults for RHEL9, fix version_number() (#886)
* Update ICV defaults for RHEL9, fix version_number() The BWRC servers migrated to RHEL9, and with that, our old setup using S-2021.06-SP3-2 for the default ICV version is not functional. In general, users of RHEL9 should adopt W-2024.09-4 from Synopsys for ICV and V-2023.09-SP2 for ICVWB. Synopsys now defaults to install these newer ICV versions at the /icvalidator/ directory instead of /icv/, so the ICV_HOME env var should reflect this. Finally, SynopsysTool.version_number() fails to correctly parse W-2024.09-4. This change fixes that, and includes regression unit tests to ensure previous versions of ICV can still be successfully parsed * Fix test_synopsys_tool static analyzer test failure * Add comment to icv/defaults.yml for old ICV versions Old ICV (<2024) versions will be found at /icv/ instead of /icvalidator/
1 parent f157f1f commit 4192f3b

File tree

4 files changed

+76
-12
lines changed

4 files changed

+76
-12
lines changed

hammer/common/synopsys/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,25 @@ def version_number(self, version: str) -> int:
3232
"""
3333
Assumes versions look like NAME-YYYY.MM-SPMINOR.
3434
Assumes less than 100 minor versions.
35+
36+
Handles various version formats:
37+
- NAME-YYYY.MM (no minor version)
38+
- NAME-YYYY.MM-N (where N is a number like 4)
39+
- NAME-YYYY.MM-SPN (where SP is a prefix and N is a number)
40+
- NAME-YYYY.MM-PREFIXN (where PREFIX is any text and N is a number)
3541
"""
3642
date = "-".join(version.split("-")[1:]) # type: str
3743
year = int(date.split(".")[0]) # type: int
3844
month = int(date.split(".")[1][:2]) # type: int
3945
minor_version = 0 # type: int
4046
if "-" in date:
41-
minor_version = int(date.split("-")[1][2:])
47+
minor_part = date.split("-")[1]
48+
# Try to handle both formats: with prefix (like "SP4") and without (like "4")
49+
# If the minor part starts with non-digits, skip them
50+
for i, char in enumerate(minor_part):
51+
if char.isdigit():
52+
minor_version = int(minor_part[i:])
53+
break
4254
return (year * 100 + month) * 100 + minor_version
4355

4456
@property

hammer/drc/icv/defaults.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
# Default settings for ICV DRC, for project/technology configuration and overriding.
22
drc.icv:
3+
# Note: Older versions of ICV are often located at /icv/ instead of /icvalidator/.
4+
# If you are using an older version, you should change the path in addition to the version.
35
# Location of the binary
4-
icv_drc_bin: "${synopsys.synopsys_home}/icv/${drc.icv.version}/bin/LINUX.64/icv"
6+
icv_drc_bin: "${synopsys.synopsys_home}/icvalidator/${drc.icv.version}/bin/LINUX.64/icv"
57
icv_drc_bin_meta: lazysubst
68

7-
icv_vue_bin: "${synopsys.synopsys_home}/icv/${drc.icv.version}/bin/LINUX.64/icv_vue"
9+
icv_vue_bin: "${synopsys.synopsys_home}/icvalidator/${drc.icv.version}/bin/LINUX.64/icv_vue"
810
icv_vue_bin_meta: lazysubst
911

1012
icvwb_bin: "${synopsys.synopsys_home}/icvwb/${drc.icv.icvwb_version}/bin/icvwb"
1113
icvwb_bin_meta: lazysubst
1214

13-
ICV_HOME_DIR: "${synopsys.synopsys_home}/icv/${drc.icv.version}"
15+
ICV_HOME_DIR: "${synopsys.synopsys_home}/icvalidator/${drc.icv.version}"
1416
ICV_HOME_DIR_meta: lazysubst
1517

1618
# type: str
17-
version: "S-2021.06-SP3-2"
19+
version: "W-2024.09-4"
1820
# type: str
19-
icvwb_version: "S-2021.06-SP2"
21+
icvwb_version: "V-2023.09-SP2"
2022
# Port for VUE (violation browser) to communicate with ICVWB (layout browser)
2123
# Any open port 1000 to 65536 allowed
2224
# type: int

hammer/lvs/icv/defaults.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
# Default settings for ICV lvs, for project/technology configuration and overriding.
22
lvs.icv:
3+
# Note: Older versions of ICV are often located at /icv/ instead of /icvalidator/.
4+
# If you are using an older version, you should change the path in addition to the version.
35
# Location of the binary
4-
icv_lvs_bin: "${synopsys.synopsys_home}/icv/${lvs.icv.version}/bin/LINUX.64/icv"
6+
icv_lvs_bin: "${synopsys.synopsys_home}/icvalidator/${lvs.icv.version}/bin/LINUX.64/icv"
57
icv_lvs_bin_meta: lazysubst
68

7-
icv_nettran_bin: "${synopsys.synopsys_home}/icv/${lvs.icv.version}/bin/LINUX.64/icv_nettran"
9+
icv_nettran_bin: "${synopsys.synopsys_home}/icvalidator/${lvs.icv.version}/bin/LINUX.64/icv_nettran"
810
icv_nettran_bin_meta: lazysubst
911

10-
icv_vue_bin: "${synopsys.synopsys_home}/icv/${lvs.icv.version}/bin/LINUX.64/icv_vue"
12+
icv_vue_bin: "${synopsys.synopsys_home}/icvalidator/${lvs.icv.version}/bin/LINUX.64/icv_vue"
1113
icv_vue_bin_meta: lazysubst
1214

1315
icvwb_bin: "${synopsys.synopsys_home}/icvwb/${lvs.icv.icvwb_version}/bin/icvwb"
1416
icvwb_bin_meta: lazysubst
1517

16-
ICV_HOME_DIR: "${synopsys.synopsys_home}/icv/${lvs.icv.version}"
18+
ICV_HOME_DIR: "${synopsys.synopsys_home}/icvalidator/${lvs.icv.version}"
1719
ICV_HOME_DIR_meta: lazysubst
1820

1921
# type: str
20-
version: "S-2021.06-SP3-2"
22+
version: "W-2024.09-4"
2123
# type: str
22-
icvwb_version: "S-2021.06-SP2"
24+
icvwb_version: "V-2023.09-SP2"
2325
# Port for VUE (violation browser) to communicate with ICVWB (layout browser)
2426
# Any open port 1000 to 65536 allowed
2527
# type: int

tests/test_synopsys_tool.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import unittest
2+
import sys
3+
import os
4+
5+
# Add the hammer path to the import path
6+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
7+
8+
from hammer.common.synopsys import SynopsysTool
9+
10+
class TestSynopsysTool(unittest.TestCase):
11+
"""Test the SynopsysTool class"""
12+
13+
def setUp(self):
14+
# Create an instance of SynopsysTool for testing
15+
class MinimalSynopsysTool(SynopsysTool):
16+
def tool_config_prefix(self):
17+
return "synopsys"
18+
19+
def get_setting(self, key, nullvalue=None):
20+
return nullvalue
21+
22+
# Implement the abstract property steps
23+
@property
24+
def steps(self):
25+
return []
26+
27+
self.tool = MinimalSynopsysTool()
28+
29+
def test_version_number_icv_formats(self):
30+
"""Test actual ICV version formats."""
31+
# Test S-2021.06-SP3-2 format
32+
version1 = "S-2021.06-SP3-2"
33+
expected1 = (2021 * 100 + 6) * 100 + 3 # The method should extract 3 from SP3-2
34+
self.assertEqual(self.tool.version_number(version1), expected1)
35+
36+
# Test W-2024.09-4 format
37+
version2 = "W-2024.09-4"
38+
expected2 = (2024 * 100 + 9) * 100 + 4
39+
self.assertEqual(self.tool.version_number(version2), expected2)
40+
41+
# Test V-2023.09-SP2 format
42+
version3 = "V-2023.09-SP2"
43+
expected3 = (2023 * 100 + 9) * 100 + 2
44+
self.assertEqual(self.tool.version_number(version3), expected3)
45+
46+
47+
if __name__ == '__main__':
48+
unittest.main()

0 commit comments

Comments
 (0)