pySVModel 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pySVModel
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: An abstract SystemVerilog language model (incl. Verilog).
5
5
  Home-page: https://GitHub.com/edaa-org/pySVModel
6
6
  Author: Patrick Lehmann
@@ -18,17 +18,48 @@ Classifier: Topic :: Software Development :: Code Generators
18
18
  Classifier: Topic :: Software Development :: Compilers
19
19
  Classifier: License :: OSI Approved :: Apache Software License
20
20
  Classifier: Programming Language :: Python :: 3 :: Only
21
- Classifier: Programming Language :: Python :: 3.7
22
- Classifier: Programming Language :: Python :: 3.8
23
21
  Classifier: Programming Language :: Python :: 3.9
24
22
  Classifier: Programming Language :: Python :: 3.10
25
23
  Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
26
  Classifier: Development Status :: 3 - Alpha
27
- Requires-Python: >=3.7
27
+ Requires-Python: >=3.9
28
28
  Description-Content-Type: text/markdown
29
+ License-File: LICENSE.md
30
+ Requires-Dist: pyTooling~=7.0
29
31
  Provides-Extra: doc
32
+ Requires-Dist: sphinxcontrib-mermaid~=1.0; extra == "doc"
33
+ Requires-Dist: sphinx_fontawesome>=0.0.6; extra == "doc"
34
+ Requires-Dist: sphinx_autodoc_typehints~=2.5; extra == "doc"
35
+ Requires-Dist: pyTooling~=7.0; extra == "doc"
36
+ Requires-Dist: docutils~=0.21; extra == "doc"
37
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
38
+ Requires-Dist: autoapi>=2.0.1; extra == "doc"
39
+ Requires-Dist: sphinx~=8.1; extra == "doc"
40
+ Provides-Extra: test
41
+ Requires-Dist: pytest~=8.3; extra == "test"
42
+ Requires-Dist: mypy~=1.13; extra == "test"
43
+ Requires-Dist: Coverage~=7.6; extra == "test"
44
+ Requires-Dist: pyTooling~=7.0; extra == "test"
45
+ Requires-Dist: pytest-cov~=6.0; extra == "test"
46
+ Requires-Dist: lxml~=5.3; extra == "test"
47
+ Requires-Dist: typing_extensions~=4.12; extra == "test"
30
48
  Provides-Extra: all
31
- License-File: LICENSE.md
49
+ Requires-Dist: sphinxcontrib-mermaid~=1.0; extra == "all"
50
+ Requires-Dist: sphinx_fontawesome>=0.0.6; extra == "all"
51
+ Requires-Dist: pytest~=8.3; extra == "all"
52
+ Requires-Dist: sphinx_autodoc_typehints~=2.5; extra == "all"
53
+ Requires-Dist: mypy~=1.13; extra == "all"
54
+ Requires-Dist: Coverage~=7.6; extra == "all"
55
+ Requires-Dist: pyTooling~=7.0; extra == "all"
56
+ Requires-Dist: pytest-cov~=6.0; extra == "all"
57
+ Requires-Dist: docutils~=0.21; extra == "all"
58
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "all"
59
+ Requires-Dist: autoapi>=2.0.1; extra == "all"
60
+ Requires-Dist: lxml~=5.3; extra == "all"
61
+ Requires-Dist: sphinx~=8.1; extra == "all"
62
+ Requires-Dist: typing_extensions~=4.12; extra == "all"
32
63
 
33
64
  <p align="center">
34
65
  <a title="edaa-org.github.io/pySVModel" href="https://edaa-org.github.io/pySVModel"><img height="80px" src="doc/_static/logo.svg"/></a>
@@ -0,0 +1,241 @@
1
+ # ==================================================================================================================== #
2
+ # ______ ____ __ _ _ #
3
+ # _ __ _ _/ ___\ \ / / \/ | ___ __| | ___| | #
4
+ # | '_ \| | | \___ \\ \ / /| |\/| |/ _ \ / _` |/ _ \ | #
5
+ # | |_) | |_| |___) |\ V / | | | | (_) | (_| | __/ | #
6
+ # | .__/ \__, |____/ \_/ |_| |_|\___/ \__,_|\___|_| #
7
+ # |_| |___/ #
8
+ # ==================================================================================================================== #
9
+ # Authors: #
10
+ # Patrick Lehmann #
11
+ # #
12
+ # License: #
13
+ # ==================================================================================================================== #
14
+ # Copyright 2021-2024 Patrick Lehmann - Boetzingen, Germany #
15
+ # #
16
+ # Licensed under the Apache License, Version 2.0 (the "License"); #
17
+ # you may not use this file except in compliance with the License. #
18
+ # You may obtain a copy of the License at #
19
+ # #
20
+ # http://www.apache.org/licenses/LICENSE-2.0 #
21
+ # #
22
+ # Unless required by applicable law or agreed to in writing, software #
23
+ # distributed under the License is distributed on an "AS IS" BASIS, #
24
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
25
+ # See the License for the specific language governing permissions and #
26
+ # limitations under the License. #
27
+ # #
28
+ # SPDX-License-Identifier: Apache-2.0 #
29
+ # ==================================================================================================================== #
30
+ #
31
+ """
32
+ An abstract SystemVerilog language model.
33
+
34
+ :copyright: Copyright 2021-2024 Patrick Lehmann - Bötzingen, Germany
35
+ :license: Apache License, Version 2.0
36
+ """
37
+ from enum import unique, Enum
38
+ from typing import Dict, Union
39
+
40
+ from pyTooling.Decorators import export
41
+
42
+
43
+ __author__ = "Patrick Lehmann"
44
+ __email__ = "Paebbels@gmail.com"
45
+ __copyright__ = "2021-2024, Patrick Lehmann"
46
+ __license__ = "Apache License, Version 2.0"
47
+ __version__ = "0.5.0"
48
+
49
+
50
+ @export
51
+ @unique
52
+ class SystemVerilogVersion(Enum):
53
+ Any = -1
54
+
55
+ Verilog95 = 95
56
+ Verilog2001 = 1
57
+ Verilog2005 = 5
58
+
59
+ SystemVerilog2005 = 2005
60
+ SystemVerilog2009 = 2009
61
+ SystemVerilog2012 = 2012
62
+ SystemVerilog2017 = 2017
63
+
64
+ Latest = 10000
65
+
66
+ __VERSION_MAPPINGS__: Dict[Union[int, str], Enum] = {
67
+ -1: Any,
68
+ 95: Verilog95,
69
+ 1: Verilog2001,
70
+ 5: Verilog2005,
71
+ # 5: SystemVerilog2005, # prefer Verilog on numbers below 2000
72
+ 9: SystemVerilog2009,
73
+ 12: SystemVerilog2012,
74
+ 17: SystemVerilog2017,
75
+ 1995: Verilog95,
76
+ 2001: Verilog2001,
77
+ # 2005: Verilog2005, # prefer SystemVerilog on numbers above 2000
78
+ 2005: SystemVerilog2005,
79
+ 2009: SystemVerilog2009,
80
+ 2012: SystemVerilog2012,
81
+ 2017: SystemVerilog2017,
82
+ 10000: Latest,
83
+ "Any": Any,
84
+ "95": Verilog95,
85
+ "01": Verilog2001,
86
+ "05": Verilog2005,
87
+ # "05": SystemVerilog2005, # prefer Verilog on numbers below 2000
88
+ "09": SystemVerilog2009,
89
+ "12": SystemVerilog2012,
90
+ "17": SystemVerilog2017,
91
+ "1995": Verilog95,
92
+ "2001": Verilog2001,
93
+ # "2005": Verilog2005, # prefer SystemVerilog on numbers above 2000
94
+ "2005": SystemVerilog2005,
95
+ "2009": SystemVerilog2009,
96
+ "2012": SystemVerilog2012,
97
+ "2017": SystemVerilog2017,
98
+ "Latest": Latest
99
+ }
100
+
101
+ def __init__(self, *_):
102
+ """Patch the embedded MAP dictionary"""
103
+ for k, v in self.__class__.__VERSION_MAPPINGS__.items():
104
+ if (not isinstance(v, self.__class__)) and (v == self.value):
105
+ self.__class__.__VERSION_MAPPINGS__[k] = self
106
+
107
+ @classmethod
108
+ def Parse(cls, value: Union[int, str]) -> "SystemVerilogVersion":
109
+ try:
110
+ return cls.__VERSION_MAPPINGS__[value]
111
+ except KeyError:
112
+ raise ValueError("Value '{0!s}' cannot be parsed to member of {1}.".format(value, cls.__name__))
113
+
114
+ def __lt__(self, other: Any) -> bool:
115
+ """
116
+ Compare two (System)Verilog versions if the version is less than the second operand.
117
+
118
+ :param other: Parameter to compare against.
119
+ :returns: True if version is less than the second operand.
120
+ :raises TypeError: If parameter ``other`` is not of type :class:`SystemVerilogVersion`.
121
+ """
122
+ if isinstance(other, SystemVerilogVersion):
123
+ return self.value < other.value
124
+ else:
125
+ raise TypeError("Second operand is not of type 'SystemVerilogVersion'.")
126
+
127
+ def __le__(self, other: Any) -> bool:
128
+ """
129
+ Compare two (System)Verilog versions if the version is less or equal than the second operand.
130
+
131
+ :param other: Parameter to compare against.
132
+ :returns: True if version is less or equal than the second operand.
133
+ :raises TypeError: If parameter ``other`` is not of type :class:`SystemVerilogVersion`.
134
+ """
135
+ if isinstance(other, SystemVerilogVersion):
136
+ return self.value <= other.value
137
+ else:
138
+ raise TypeError("Second operand is not of type 'SystemVerilogVersion'.")
139
+
140
+ def __gt__(self, other: Any) -> bool:
141
+ """
142
+ Compare two (System)Verilog versions if the version is greater than the second operand.
143
+
144
+ :param other: Parameter to compare against.
145
+ :returns: True if version is greater than the second operand.
146
+ :raises TypeError: If parameter ``other`` is not of type :class:`SystemVerilogVersion`.
147
+ """
148
+ if isinstance(other, SystemVerilogVersion):
149
+ return self.value > other.value
150
+ else:
151
+ raise TypeError("Second operand is not of type 'SystemVerilogVersion'.")
152
+
153
+ def __ge__(self, other: Any) -> bool:
154
+ """
155
+ Compare two (System)Verilog versions if the version is greater or equal than the second operand.
156
+
157
+ :param other: Parameter to compare against.
158
+ :returns: True if version is greater or equal than the second operand.
159
+ :raises TypeError: If parameter ``other`` is not of type :class:`SystemVerilogVersion`.
160
+ """
161
+ if isinstance(other, SystemVerilogVersion):
162
+ return self.value >= other.value
163
+ else:
164
+ raise TypeError("Second operand is not of type 'SystemVerilogVersion'.")
165
+
166
+ def __ne__(self, other: Any) -> bool:
167
+ """
168
+ Compare two (System)Verilog versions if the version is unequal to the second operand.
169
+
170
+ :param other: Parameter to compare against.
171
+ :returns: True if version is unequal to the second operand.
172
+ :raises TypeError: If parameter ``other`` is not of type :class:`SystemVerilogVersion`.
173
+ """
174
+ if isinstance(other, SystemVerilogVersion):
175
+ return self.value != other.value
176
+ else:
177
+ raise TypeError("Second operand is not of type 'SystemVerilogVersion'.")
178
+
179
+ def __eq__(self, other: Any) -> bool:
180
+ """
181
+ Compare two (System)Verilog versions if the version is equal to the second operand.
182
+
183
+ :param other: Parameter to compare against.
184
+ :returns: True if version is equal to the second operand.
185
+ :raises TypeError: If parameter ``other`` is not of type :class:`SystemVerilogVersion`.
186
+ """
187
+ if isinstance(other, SystemVerilogVersion):
188
+ if (self is self.__class__.Any) or (other is self.__class__.Any):
189
+ return True
190
+ else:
191
+ return self.value == other.value
192
+ else:
193
+ raise TypeError("Second operand is not of type 'SystemVerilogVersion'.")
194
+
195
+ @property
196
+ def IsVerilog(self) -> bool:
197
+ """
198
+ Checks if the version is a (classic) Verilog version.
199
+
200
+ :returns: True if version is a (classic) Verilog version.
201
+ """
202
+ return self in (self.Verilog95, self.Verilog2001, self.Verilog2005)
203
+
204
+ @property
205
+ def IsSystemVerilog(self) -> bool:
206
+ """
207
+ Checks if the version is a SystemVerilog version.
208
+
209
+ :returns: True if version is a SystemVerilog version.
210
+ """
211
+ return self in (self.SystemVerilog2005, self.SystemVerilog2009, self.SystemVerilog2012, self.SystemVerilog2017)
212
+
213
+ def __str__(self) -> str:
214
+ """
215
+ Formats the SystemVerilog version to pattern ``SV'xx`` or in case of classic Verilog to ``Verilog'xx``.
216
+
217
+ :return: Formatted (System)Verilog version.
218
+ """
219
+ if self.value == self.Any.value:
220
+ return "SV'Any"
221
+ if self.value == self.Latest.value:
222
+ return "SV'Latest"
223
+
224
+ year = str(self.value)[-2:]
225
+ if self.value < self.SystemVerilog2005.value:
226
+ return f"Verilog'{year}"
227
+ else:
228
+ return f"SV'{year}"
229
+
230
+ def __repr__(self) -> str:
231
+ """
232
+ Formats the (System)Verilog version to pattern ``xxxx``.
233
+
234
+ :return: Formatted (System)Verilog version.
235
+ """
236
+ if self.value == self.Any.value:
237
+ return "Any"
238
+ elif self.value == self.Latest.value:
239
+ return "Latest"
240
+ else:
241
+ return str(self.value)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pySVModel
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: An abstract SystemVerilog language model (incl. Verilog).
5
5
  Home-page: https://GitHub.com/edaa-org/pySVModel
6
6
  Author: Patrick Lehmann
@@ -18,17 +18,48 @@ Classifier: Topic :: Software Development :: Code Generators
18
18
  Classifier: Topic :: Software Development :: Compilers
19
19
  Classifier: License :: OSI Approved :: Apache Software License
20
20
  Classifier: Programming Language :: Python :: 3 :: Only
21
- Classifier: Programming Language :: Python :: 3.7
22
- Classifier: Programming Language :: Python :: 3.8
23
21
  Classifier: Programming Language :: Python :: 3.9
24
22
  Classifier: Programming Language :: Python :: 3.10
25
23
  Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
26
  Classifier: Development Status :: 3 - Alpha
27
- Requires-Python: >=3.7
27
+ Requires-Python: >=3.9
28
28
  Description-Content-Type: text/markdown
29
+ License-File: LICENSE.md
30
+ Requires-Dist: pyTooling~=7.0
29
31
  Provides-Extra: doc
32
+ Requires-Dist: sphinxcontrib-mermaid~=1.0; extra == "doc"
33
+ Requires-Dist: sphinx_fontawesome>=0.0.6; extra == "doc"
34
+ Requires-Dist: sphinx_autodoc_typehints~=2.5; extra == "doc"
35
+ Requires-Dist: pyTooling~=7.0; extra == "doc"
36
+ Requires-Dist: docutils~=0.21; extra == "doc"
37
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
38
+ Requires-Dist: autoapi>=2.0.1; extra == "doc"
39
+ Requires-Dist: sphinx~=8.1; extra == "doc"
40
+ Provides-Extra: test
41
+ Requires-Dist: pytest~=8.3; extra == "test"
42
+ Requires-Dist: mypy~=1.13; extra == "test"
43
+ Requires-Dist: Coverage~=7.6; extra == "test"
44
+ Requires-Dist: pyTooling~=7.0; extra == "test"
45
+ Requires-Dist: pytest-cov~=6.0; extra == "test"
46
+ Requires-Dist: lxml~=5.3; extra == "test"
47
+ Requires-Dist: typing_extensions~=4.12; extra == "test"
30
48
  Provides-Extra: all
31
- License-File: LICENSE.md
49
+ Requires-Dist: sphinxcontrib-mermaid~=1.0; extra == "all"
50
+ Requires-Dist: sphinx_fontawesome>=0.0.6; extra == "all"
51
+ Requires-Dist: pytest~=8.3; extra == "all"
52
+ Requires-Dist: sphinx_autodoc_typehints~=2.5; extra == "all"
53
+ Requires-Dist: mypy~=1.13; extra == "all"
54
+ Requires-Dist: Coverage~=7.6; extra == "all"
55
+ Requires-Dist: pyTooling~=7.0; extra == "all"
56
+ Requires-Dist: pytest-cov~=6.0; extra == "all"
57
+ Requires-Dist: docutils~=0.21; extra == "all"
58
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "all"
59
+ Requires-Dist: autoapi>=2.0.1; extra == "all"
60
+ Requires-Dist: lxml~=5.3; extra == "all"
61
+ Requires-Dist: sphinx~=8.1; extra == "all"
62
+ Requires-Dist: typing_extensions~=4.12; extra == "all"
32
63
 
33
64
  <p align="center">
34
65
  <a title="edaa-org.github.io/pySVModel" href="https://edaa-org.github.io/pySVModel"><img height="80px" src="doc/_static/logo.svg"/></a>
@@ -0,0 +1,36 @@
1
+ pyTooling~=7.0
2
+
3
+ [all]
4
+ sphinxcontrib-mermaid~=1.0
5
+ sphinx_fontawesome>=0.0.6
6
+ pytest~=8.3
7
+ sphinx_autodoc_typehints~=2.5
8
+ mypy~=1.13
9
+ Coverage~=7.6
10
+ pyTooling~=7.0
11
+ pytest-cov~=6.0
12
+ docutils~=0.21
13
+ docutils_stubs~=0.0.22
14
+ autoapi>=2.0.1
15
+ lxml~=5.3
16
+ sphinx~=8.1
17
+ typing_extensions~=4.12
18
+
19
+ [doc]
20
+ sphinxcontrib-mermaid~=1.0
21
+ sphinx_fontawesome>=0.0.6
22
+ sphinx_autodoc_typehints~=2.5
23
+ pyTooling~=7.0
24
+ docutils~=0.21
25
+ docutils_stubs~=0.0.22
26
+ autoapi>=2.0.1
27
+ sphinx~=8.1
28
+
29
+ [test]
30
+ pytest~=8.3
31
+ mypy~=1.13
32
+ Coverage~=7.6
33
+ pyTooling~=7.0
34
+ pytest-cov~=6.0
35
+ lxml~=5.3
36
+ typing_extensions~=4.12
@@ -1,8 +1,8 @@
1
1
  [build-system]
2
2
  requires = [
3
- "setuptools >= 68.0.0",
4
- "wheel >= 0.40.0",
5
- "pyTooling >= 5.0.0"
3
+ "setuptools ~= 75.3",
4
+ "wheel ~= 0.44",
5
+ "pyTooling ~= 7.0"
6
6
  ]
7
7
  build-backend = "setuptools.build_meta"
8
8
 
@@ -10,15 +10,18 @@ build-backend = "setuptools.build_meta"
10
10
  line-length = 120
11
11
 
12
12
  [tool.mypy]
13
- python_version = "3.11"
14
- namespace_packages = true
15
-
13
+ files = ["pySVModel"]
14
+ python_version = "3.13"
15
+ #ignore_missing_imports = true
16
+ strict = true
16
17
  pretty = true
17
18
  show_error_context = true
18
-
19
+ show_error_codes = true
20
+ namespace_packages = true
19
21
  html_report = "report/typing"
20
22
 
21
23
  [tool.pytest.ini_options]
24
+ addopts = "--tb=native"
22
25
  # Don't set 'python_classes = *' otherwise, pytest doesn't search for classes
23
26
  # derived from unittest.Testcase
24
27
  python_files = "*"
@@ -27,13 +30,28 @@ filterwarnings = [
27
30
  "error::DeprecationWarning",
28
31
  "error::PendingDeprecationWarning"
29
32
  ]
33
+ junit_logging = "all"
34
+
35
+ [tool.interrogate]
36
+ color = true
37
+ verbose = 1 # possible values: 0 (minimal output), 1 (-v), 2 (-vv)
38
+ fail-under = 59
39
+ exclude = [
40
+ "build",
41
+ "dist",
42
+ "doc",
43
+ "tests",
44
+ "setup.py"
45
+ ]
46
+ ignore-setters = true
30
47
 
31
48
  [tool.coverage.run]
32
49
  branch = true
50
+ relative_files = true
33
51
  omit = [
34
52
  "*site-packages*",
35
53
  "setup.py",
36
- "tests/*"
54
+ "tests/unit/*"
37
55
  ]
38
56
 
39
57
  [tool.coverage.report]
@@ -47,9 +65,12 @@ omit = [
47
65
  "tests/*"
48
66
  ]
49
67
 
68
+ [tool.coverage.xml]
69
+ output = "report/coverage/coverage.xml"
70
+
71
+ [tool.coverage.json]
72
+ output = "report/coverage/coverage.json"
73
+
50
74
  [tool.coverage.html]
51
75
  directory = "report/coverage/html"
52
76
  title="Code Coverage of pySVModel"
53
-
54
- [tool.coverage.xml]
55
- output = "report/coverage/coverage.xml"
@@ -11,7 +11,7 @@
11
11
  # #
12
12
  # License: #
13
13
  # ==================================================================================================================== #
14
- # Copyright 2021-2023 Patrick Lehmann - Boetzingen, Germany #
14
+ # Copyright 2021-2024 Patrick Lehmann - Boetzingen, Germany #
15
15
  # #
16
16
  # Licensed under the Apache License, Version 2.0 (the "License"); #
17
17
  # you may not use this file except in compliance with the License. #
@@ -29,6 +29,8 @@
29
29
  # ==================================================================================================================== #
30
30
  #
31
31
  """Package installer for 'An abstract System Verilog language model'."""
32
+ from setuptools import setup
33
+
32
34
  from pathlib import Path
33
35
  from pyTooling.Packaging import DescribePythonPackageHostedOnGitHub, DEFAULT_CLASSIFIERS
34
36
 
@@ -37,7 +39,7 @@ packageName = "pySVModel"
37
39
  packageDirectory = packageName
38
40
  packageInformationFile = Path(f"{packageDirectory}/__init__.py")
39
41
 
40
- DescribePythonPackageHostedOnGitHub(
42
+ setup(**DescribePythonPackageHostedOnGitHub(
41
43
  packageName=packageName,
42
44
  description="An abstract SystemVerilog language model (incl. Verilog).",
43
45
  gitHubNamespace=gitHubNamespace,
@@ -48,5 +50,8 @@ DescribePythonPackageHostedOnGitHub(
48
50
  "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
49
51
  "Topic :: Software Development :: Code Generators",
50
52
  "Topic :: Software Development :: Compilers"
51
- ]
52
- )
53
+ ],
54
+ dataFiles={
55
+ packageName: ["py.typed"]
56
+ }
57
+ ))
@@ -1,143 +0,0 @@
1
- # ==================================================================================================================== #
2
- # ______ ____ __ _ _ #
3
- # _ __ _ _/ ___\ \ / / \/ | ___ __| | ___| | #
4
- # | '_ \| | | \___ \\ \ / /| |\/| |/ _ \ / _` |/ _ \ | #
5
- # | |_) | |_| |___) |\ V / | | | | (_) | (_| | __/ | #
6
- # | .__/ \__, |____/ \_/ |_| |_|\___/ \__,_|\___|_| #
7
- # |_| |___/ #
8
- # ==================================================================================================================== #
9
- # Authors: #
10
- # Patrick Lehmann #
11
- # #
12
- # License: #
13
- # ==================================================================================================================== #
14
- # Copyright 2021-2023 Patrick Lehmann - Boetzingen, Germany #
15
- # #
16
- # Licensed under the Apache License, Version 2.0 (the "License"); #
17
- # you may not use this file except in compliance with the License. #
18
- # You may obtain a copy of the License at #
19
- # #
20
- # http://www.apache.org/licenses/LICENSE-2.0 #
21
- # #
22
- # Unless required by applicable law or agreed to in writing, software #
23
- # distributed under the License is distributed on an "AS IS" BASIS, #
24
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
25
- # See the License for the specific language governing permissions and #
26
- # limitations under the License. #
27
- # #
28
- # SPDX-License-Identifier: Apache-2.0 #
29
- # ==================================================================================================================== #
30
- #
31
- """
32
- An abstract SystemVerilog language model.
33
-
34
- :copyright: Copyright 2021-2023 Patrick Lehmann - Bötzingen, Germany
35
- :license: Apache License, Version 2.0
36
- """
37
- from enum import unique, Enum
38
- from typing import Dict, Union
39
-
40
- from pyTooling.Decorators import export
41
-
42
-
43
- __author__ = "Patrick Lehmann"
44
- __email__ = "Paebbels@gmail.com"
45
- __copyright__ = "2021-2023, Patrick Lehmann"
46
- __license__ = "Apache License, Version 2.0"
47
- __version__ = "0.4.0"
48
-
49
-
50
- @export
51
- @unique
52
- class SystemVerilogVersion(Enum):
53
- Any = -1
54
-
55
- Verilog95 = 95
56
- Verilog2001 = 1
57
- Verilog2005 = 5
58
-
59
- SystemVerilog2005 = 2005
60
- SystemVerilog2009 = 2009
61
- SystemVerilog2012 = 2012
62
- SystemVerilog2017 = 2017
63
-
64
- __VERSION_MAPPINGS__: Dict[Union[int, str], Enum] = {
65
- -1: Any,
66
- 95: Verilog95,
67
- 1: Verilog2001,
68
- 5: Verilog2005,
69
- # 5: SystemVerilog2005, # prefer Verilog on numbers below 2000
70
- 9: SystemVerilog2009,
71
- 12: SystemVerilog2012,
72
- 17: SystemVerilog2017,
73
- 1995: Verilog95,
74
- 2001: Verilog2001,
75
- # 2005: Verilog2005, # prefer SystemVerilog on numbers above 2000
76
- 2005: SystemVerilog2005,
77
- 2009: SystemVerilog2009,
78
- 2012: SystemVerilog2012,
79
- 2017: SystemVerilog2017,
80
- "Any": Any,
81
- "95": Verilog95,
82
- "01": Verilog2001,
83
- "05": Verilog2005,
84
- # "05": SystemVerilog2005, # prefer Verilog on numbers below 2000
85
- "09": SystemVerilog2009,
86
- "12": SystemVerilog2012,
87
- "17": SystemVerilog2017,
88
- "1995": Verilog95,
89
- "2001": Verilog2001,
90
- # "2005": Verilog2005, # prefer SystemVerilog on numbers above 2000
91
- "2005": SystemVerilog2005,
92
- "2009": SystemVerilog2009,
93
- "2012": SystemVerilog2012,
94
- "2017": SystemVerilog2017,
95
- }
96
-
97
- def __init__(self, *_):
98
- """Patch the embedded MAP dictionary"""
99
- for k, v in self.__class__.__VERSION_MAPPINGS__.items():
100
- if (not isinstance(v, self.__class__)) and (v == self.value):
101
- self.__class__.__VERSION_MAPPINGS__[k] = self
102
-
103
- @classmethod
104
- def Parse(cls, value: Union[int, str]) -> "SystemVerilogVersion":
105
- try:
106
- return cls.__VERSION_MAPPINGS__[value]
107
- except KeyError:
108
- raise ValueError("Value '{0!s}' cannot be parsed to member of {1}.".format(value, cls.__name__))
109
-
110
- def __lt__(self, other) -> bool:
111
- return self.value < other.value
112
-
113
- def __le__(self, other) -> bool:
114
- return self.value <= other.value
115
-
116
- def __gt__(self, other) -> bool:
117
- return self.value > other.value
118
-
119
- def __ge__(self, other) -> bool:
120
- return self.value >= other.value
121
-
122
- def __ne__(self, other) -> bool:
123
- return self.value != other.value
124
-
125
- def __eq__(self, other) -> bool:
126
- if (self is self.__class__.Any) or (other is self.__class__.Any):
127
- return True
128
- else:
129
- return self.value == other.value
130
-
131
- def __str__(self) -> str:
132
- if self.value == -1:
133
- return "SV'Any"
134
- elif self.value < self.SystemVerilog2005.value:
135
- return "Verilog'" + str(self.value)[-2:]
136
- else:
137
- return "SV'" + str(self.value)[-2:]
138
-
139
- def __repr__(self) -> str:
140
- if self.value == -1:
141
- return "Any"
142
- else:
143
- return str(self.value)
@@ -1,17 +0,0 @@
1
- pyTooling>=5.0.0
2
-
3
- [all]
4
- sphinx_fontawesome>=0.0.6
5
- sphinx_autodoc_typehints>=1.19.5
6
- sphinxcontrib-mermaid>=0.7.1
7
- autoapi>=2.0.1
8
- sphinx>=5.3.0
9
- pyTooling>=5.0.0
10
-
11
- [doc]
12
- sphinx_fontawesome>=0.0.6
13
- sphinx_autodoc_typehints>=1.19.5
14
- sphinxcontrib-mermaid>=0.7.1
15
- autoapi>=2.0.1
16
- sphinx>=5.3.0
17
- pyTooling>=5.0.0
File without changes
File without changes
File without changes