pyEDAA.OSVVM 0.1.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.
@@ -0,0 +1,82 @@
1
+ This is a local copy of the Apache License Version 2.0.
2
+ The original can be obtained here: [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
3
+
4
+ --------------------------------------------------------------------------------
5
+
6
+ # Apache License
7
+
8
+ Version 2.0, January 2004
9
+
10
+ ## TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ ### 1. Definitions.
13
+
14
+ *"License"* shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
15
+
16
+ *"Licensor"* shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
17
+
18
+ *"Legal Entity"* shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
19
+
20
+ *"You"* (or *"Your"*) shall mean an individual or Legal Entity exercising permissions granted by this License.
21
+
22
+ *"Source"* form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
23
+
24
+ *"Object"* form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
25
+
26
+ *"Work"* shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
27
+
28
+ *"Derivative Works"* shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
29
+
30
+ *"Contribution"* shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, *"submitted"* means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as *"Not a Contribution."*
31
+
32
+ *"Contributor"* shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
33
+
34
+ ### 2. Grant of Copyright License.
35
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
36
+
37
+ ### 3. Grant of Patent License.
38
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
39
+
40
+ ### 4. Redistribution.
41
+ You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
42
+
43
+ - You must give any other recipients of the Work or Derivative Works a copy of this License; and
44
+ - You must cause any modified files to carry prominent notices stating that You changed the files; and
45
+ - You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
46
+ - If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
47
+
48
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
49
+
50
+ ### 5. Submission of Contributions.
51
+ Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
52
+
53
+ ### 6. Trademarks.
54
+ This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
55
+
56
+ ### 7. Disclaimer of Warranty.
57
+ Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
58
+
59
+ ### 8. Limitation of Liability.
60
+ In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
61
+
62
+ ### 9. Accepting Warranty or Additional Liability.
63
+ While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
64
+
65
+
66
+ ## Appendix: How to apply the Apache License to your work
67
+
68
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
69
+
70
+ Copyright [yyyy] [name of copyright owner]
71
+
72
+ Licensed under the Apache License, Version 2.0 (the "License");
73
+ you may not use this file except in compliance with the License.
74
+ You may obtain a copy of the License at
75
+
76
+ http://www.apache.org/licenses/LICENSE-2.0
77
+
78
+ Unless required by applicable law or agreed to in writing, software
79
+ distributed under the License is distributed on an "AS IS" BASIS,
80
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81
+ See the License for the specific language governing permissions and
82
+ limitations under the License.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.2
2
+ Name: pyEDAA.OSVVM
3
+ Version: 0.1.0
4
+ Summary: Parser and converter for OSVVM-specific data models and report formats.
5
+ Home-page: https://GitHub.com/edaa-org/pyEDAA.OSVVM
6
+ Author: Patrick Lehmann
7
+ Author-email: Paebbels@gmail.com
8
+ License: Apache-2.0
9
+ Project-URL: Documentation, https://edaa-org.GitHub.io/pyEDAA.OSVVM
10
+ Project-URL: Source Code, https://GitHub.com/edaa-org/pyEDAA.OSVVM
11
+ Project-URL: Issue Tracker, https://GitHub.com/edaa-org/pyEDAA.OSVVM/issues
12
+ Keywords: eda project,model,abstract,osvvm,reports,data format,unit test,test suite,test bench,test harness
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Utilities
16
+ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Development Status :: 3 - Alpha
22
+ Requires-Python: >=3.12
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE.md
25
+ Requires-Dist: pyTooling~=8.2
26
+ Requires-Dist: pyVHDLModel~=0.31
27
+ Provides-Extra: doc
28
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
29
+ Requires-Dist: pyVHDLModel~=0.31; extra == "doc"
30
+ Requires-Dist: sphinx_reports~=0.7; extra == "doc"
31
+ Requires-Dist: docutils~=0.21; extra == "doc"
32
+ Requires-Dist: sphinx_design~=0.6.1; extra == "doc"
33
+ Requires-Dist: autoapi>=2.0.1; extra == "doc"
34
+ Requires-Dist: sphinx~=8.2; extra == "doc"
35
+ Requires-Dist: sphinxcontrib-mermaid~=1.0; extra == "doc"
36
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == "doc"
37
+ Requires-Dist: sphinx_autodoc_typehints~=3.1; extra == "doc"
38
+ Requires-Dist: pyTooling~=8.2; extra == "doc"
39
+ Requires-Dist: sphinx_rtd_theme~=3.0; extra == "doc"
40
+ Provides-Extra: test
41
+ Requires-Dist: pyVHDLModel~=0.31; extra == "test"
42
+ Requires-Dist: pytest-cov~=6.0; extra == "test"
43
+ Requires-Dist: lxml~=5.3; extra == "test"
44
+ Requires-Dist: typing_extensions~=4.12; extra == "test"
45
+ Requires-Dist: mypy~=1.15; extra == "test"
46
+ Requires-Dist: pytest~=8.3; extra == "test"
47
+ Requires-Dist: pyTooling~=8.2; extra == "test"
48
+ Requires-Dist: Coverage~=7.6; extra == "test"
49
+ Provides-Extra: all
50
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "all"
51
+ Requires-Dist: pyVHDLModel~=0.31; extra == "all"
52
+ Requires-Dist: Coverage~=7.6; extra == "all"
53
+ Requires-Dist: docutils~=0.21; extra == "all"
54
+ Requires-Dist: pyTooling~=8.2; extra == "all"
55
+ Requires-Dist: sphinx_design~=0.6.1; extra == "all"
56
+ Requires-Dist: pytest-cov~=6.0; extra == "all"
57
+ Requires-Dist: lxml~=5.3; extra == "all"
58
+ Requires-Dist: autoapi>=2.0.1; extra == "all"
59
+ Requires-Dist: sphinx~=8.2; extra == "all"
60
+ Requires-Dist: sphinxcontrib-mermaid~=1.0; extra == "all"
61
+ Requires-Dist: pytest~=8.3; extra == "all"
62
+ Requires-Dist: mypy~=1.15; extra == "all"
63
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
64
+ Requires-Dist: sphinx_reports~=0.7; extra == "all"
65
+ Requires-Dist: sphinx_autodoc_typehints~=3.1; extra == "all"
66
+ Requires-Dist: typing_extensions~=4.12; extra == "all"
67
+ Requires-Dist: sphinx_rtd_theme~=3.0; extra == "all"
68
+ Dynamic: author
69
+ Dynamic: author-email
70
+ Dynamic: classifier
71
+ Dynamic: description
72
+ Dynamic: description-content-type
73
+ Dynamic: home-page
74
+ Dynamic: keywords
75
+ Dynamic: license
76
+ Dynamic: project-url
77
+ Dynamic: provides-extra
78
+ Dynamic: requires-dist
79
+ Dynamic: requires-python
80
+ Dynamic: summary
81
+
82
+ # Main Goals
83
+
84
+ This package provides OSVVM-specific data models and parsers. The data models can be used as is or converted to generic
85
+ data models of the pyEDAA data model family. This includes parsing OSVVM's `*.pro`-files and translating them to a
86
+ pyEDAA.ProjectModel instance as well as reading OSVVM's reports in YAML format like test results, alerts or functional
87
+ coverage.
88
+
89
+ Frameworks consuming these data models can build higher level features and services on top of these models, while
90
+ using one parser that's aligned with OSVVM's data formats.
91
+
92
+ # Data Models
93
+
94
+ ## Project Description via `*.pro`-Files
95
+
96
+
97
+ ## Testsuite Summary Reports
98
+
99
+
100
+ ## Testcase Summary Reports
101
+
102
+
103
+ ## Alert and Log Reports
104
+
105
+
106
+ ## Scoreboard Reports
107
+
108
+
109
+ ## Functional Coverage Reports
110
+
111
+
112
+ ## Requirement Reports
113
+
114
+
115
+
116
+
117
+ # Features
118
+
119
+
120
+
121
+ # Use Cases
122
+
123
+ * Reading OSVVM's `*.pro` files.
124
+
125
+ # Examples
126
+
127
+
128
+
129
+ # Consumers
130
+
131
+
132
+ # References
133
+
134
+ * [OSVVM/OSVVM-Scripts: OSVVMProjectScripts.tcl](https://GitHub.com/OSVVM/OSVVM-Scripts/blob/master/OSVVMProjectScripts.tcl)
135
+
136
+
137
+ # Contributors
138
+
139
+ * [Patrick Lehmann](https://GitHub.com/Paebbels) (Maintainer)
140
+ * [and more...](https://GitHub.com/edaa-org/pyEDAA.OSVVM/graphs/contributors)
141
+
142
+ # License
143
+
144
+ This Python package (source code) licensed under [Apache License 2.0](LICENSE.md).
145
+ The accompanying documentation is licensed under [Creative Commons - Attribution 4.0 (CC-BY 4.0)](doc/Doc-License.rst).
146
+
147
+ -------------------------
148
+ SPDX-License-Identifier: Apache-2.0
@@ -0,0 +1,67 @@
1
+ # Main Goals
2
+
3
+ This package provides OSVVM-specific data models and parsers. The data models can be used as is or converted to generic
4
+ data models of the pyEDAA data model family. This includes parsing OSVVM's `*.pro`-files and translating them to a
5
+ pyEDAA.ProjectModel instance as well as reading OSVVM's reports in YAML format like test results, alerts or functional
6
+ coverage.
7
+
8
+ Frameworks consuming these data models can build higher level features and services on top of these models, while
9
+ using one parser that's aligned with OSVVM's data formats.
10
+
11
+ # Data Models
12
+
13
+ ## Project Description via `*.pro`-Files
14
+
15
+
16
+ ## Testsuite Summary Reports
17
+
18
+
19
+ ## Testcase Summary Reports
20
+
21
+
22
+ ## Alert and Log Reports
23
+
24
+
25
+ ## Scoreboard Reports
26
+
27
+
28
+ ## Functional Coverage Reports
29
+
30
+
31
+ ## Requirement Reports
32
+
33
+
34
+
35
+
36
+ # Features
37
+
38
+
39
+
40
+ # Use Cases
41
+
42
+ * Reading OSVVM's `*.pro` files.
43
+
44
+ # Examples
45
+
46
+
47
+
48
+ # Consumers
49
+
50
+
51
+ # References
52
+
53
+ * [OSVVM/OSVVM-Scripts: OSVVMProjectScripts.tcl](https://GitHub.com/OSVVM/OSVVM-Scripts/blob/master/OSVVMProjectScripts.tcl)
54
+
55
+
56
+ # Contributors
57
+
58
+ * [Patrick Lehmann](https://GitHub.com/Paebbels) (Maintainer)
59
+ * [and more...](https://GitHub.com/edaa-org/pyEDAA.OSVVM/graphs/contributors)
60
+
61
+ # License
62
+
63
+ This Python package (source code) licensed under [Apache License 2.0](LICENSE.md).
64
+ The accompanying documentation is licensed under [Creative Commons - Attribution 4.0 (CC-BY 4.0)](doc/Doc-License.rst).
65
+
66
+ -------------------------
67
+ SPDX-License-Identifier: Apache-2.0
@@ -0,0 +1,378 @@
1
+ # ==================================================================================================================== #
2
+ # _____ ____ _ _ ___ ______ ____ ____ __ #
3
+ # _ __ _ _| ____| _ \ / \ / \ / _ \/ ___\ \ / /\ \ / / \/ | #
4
+ # | '_ \| | | | _| | | | |/ _ \ / _ \ | | | \___ \\ \ / / \ \ / /| |\/| | #
5
+ # | |_) | |_| | |___| |_| / ___ \ / ___ \ | |_| |___) |\ V / \ V / | | | | #
6
+ # | .__/ \__, |_____|____/_/ \_\/_/ \_(_)___/|____/ \_/ \_/ |_| |_| #
7
+ # |_| |___/ #
8
+ # ==================================================================================================================== #
9
+ # Authors: #
10
+ # Patrick Lehmann #
11
+ # #
12
+ # License: #
13
+ # ==================================================================================================================== #
14
+ # Copyright 2025-2025 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
+ from pathlib import Path
32
+ from typing import Optional as Nullable, List, Dict
33
+
34
+ from pyTooling.Decorators import readonly, export
35
+ from pyTooling.MetaClasses import ExtendedType
36
+ from pyVHDLModel import VHDLVersion
37
+
38
+ from pyEDAA.OSVVM import OSVVMException
39
+
40
+
41
+ __all__ = ["osvvmContext"]
42
+
43
+
44
+ @export
45
+ class Base(metaclass=ExtendedType):
46
+ pass
47
+
48
+
49
+ @export
50
+ class SourceFile(Base):
51
+ """A base-class describing any source file (VHDL, Verilog, ...) supported by OSVVM Scripts."""
52
+
53
+ _path: Path
54
+
55
+ def __init__(self, path: Path) -> None:
56
+ self._path = path
57
+
58
+ @readonly
59
+ def Path(self) -> Path:
60
+ return self._path
61
+
62
+
63
+ @export
64
+ class VHDLSourceFile(SourceFile):
65
+ _vhdlVersion: VHDLVersion
66
+
67
+ def __init__(self, path: Path, vhdlVersion: Nullable[VHDLVersion] = None):
68
+ super().__init__(path)
69
+
70
+ self._vhdlVersion = vhdlVersion
71
+
72
+ @property
73
+ def VHDLVersion(self) -> VHDLVersion:
74
+ return self._vhdlVersion
75
+
76
+ @VHDLVersion.setter
77
+ def VHDLVersion(self, value: VHDLVersion) -> None:
78
+ self._vhdlVersion = value
79
+
80
+
81
+ @export
82
+ class Library(Base):
83
+ """A VHDL library collecting multiple VHDL files containing VHDL design units."""
84
+
85
+ _name: str
86
+ _files: List[VHDLSourceFile]
87
+
88
+ def __init__(self, name: str) -> None:
89
+ self._name = name
90
+ self._files = []
91
+
92
+ @readonly
93
+ def Name(self) -> str:
94
+ return self._name
95
+
96
+ @readonly
97
+ def Files(self) -> List[SourceFile]:
98
+ return self._files
99
+
100
+ def AddFile(self, file: VHDLSourceFile) -> None:
101
+ self._files.append(file)
102
+
103
+ def __repr__(self) -> str:
104
+ return f"VHDLLibrary: {self._name}"
105
+
106
+
107
+ @export
108
+ class GenericValue(Base):
109
+ _name: str
110
+ _value: str
111
+
112
+ def __init__(self, name: str, value: str) -> None:
113
+ self._name = name
114
+ self._value = value
115
+
116
+ @readonly
117
+ def Name(self) -> str:
118
+ return self._name
119
+
120
+ @readonly
121
+ def Value(self) -> str:
122
+ return self._value
123
+
124
+ def __repr__(self) -> str:
125
+ return f"{self._name} = {self._value}"
126
+
127
+
128
+ @export
129
+ class Testcase(Base):
130
+ _name: str
131
+ _toplevelName: Nullable[str]
132
+ _generics: Dict[str, str]
133
+
134
+ def __init__(self, name: str) -> None:
135
+ self._name = name
136
+ self._toplevelName = None
137
+ self._generics = {}
138
+
139
+ @readonly
140
+ def Name(self) -> str:
141
+ return self._name
142
+
143
+ @readonly
144
+ def ToplevelName(self) -> str:
145
+ return self._toplevelName
146
+
147
+ @readonly
148
+ def Generics(self) -> Dict[str, str]:
149
+ return self._generics
150
+
151
+ def SetToplevel(self, toplevelName: str) -> None:
152
+ self._toplevelName = toplevelName
153
+
154
+ def AddGeneric(self, genericValue: GenericValue):
155
+ self._generics[genericValue._name] = genericValue._value
156
+
157
+ def __repr__(self) -> str:
158
+ return f"Testcase: {self._name} - [{', '.join([f'{n}={v}' for n,v in self._generics.items()])}]"
159
+
160
+
161
+ @export
162
+ class Testsuite(Base):
163
+ _name: str
164
+ _testcases: Dict[str, Testcase]
165
+
166
+ def __init__(self, name: str) -> None:
167
+ self._name = name
168
+ self._testcases = {}
169
+
170
+ @readonly
171
+ def Name(self) -> str:
172
+ return self._name
173
+
174
+ @readonly
175
+ def Testcases(self) -> Dict[str, Testcase]:
176
+ return self._testcases
177
+
178
+ def AddTestcase(self, testcase: Testcase) -> None:
179
+ self._testcases[testcase._name] = testcase
180
+
181
+ def __repr__(self) -> str:
182
+ return f"Testsuite: {self._name}"
183
+
184
+
185
+ @export
186
+ class Context(Base):
187
+ # _tcl: TclEnvironment
188
+
189
+ _lastException: Exception
190
+
191
+ _workingDirectory: Path
192
+ _currentDirectory: Path
193
+ _includedFiles: List[Path]
194
+
195
+ _vhdlversion: VHDLVersion
196
+
197
+ _libraries: Dict[str, Library]
198
+ _library: Nullable[Library]
199
+
200
+ _testsuites: Dict[str, Testsuite]
201
+ _testsuite: Nullable[Testsuite]
202
+ _testcase: Nullable[Testcase]
203
+ _options: Dict[int, GenericValue]
204
+
205
+ def __init__(self) -> None:
206
+ self._processor = None
207
+ self._lastException = None
208
+
209
+ self._workingDirectory = Path.cwd()
210
+ self._currentDirectory = self._workingDirectory
211
+ self._includedFiles = []
212
+
213
+ self._vhdlversion = VHDLVersion.VHDL2008
214
+
215
+ self._library = None
216
+ self._libraries = {}
217
+
218
+ self._testcase = None
219
+ self._testsuite = None
220
+ self._testsuites = {}
221
+ self._options = {}
222
+
223
+ def Clear(self) -> None:
224
+ self._processor = None
225
+ self._lastException = None
226
+
227
+ self._workingDirectory = Path.cwd()
228
+ self._currentDirectory = self._workingDirectory
229
+ self._includedFiles = []
230
+
231
+ self._vhdlversion = VHDLVersion.VHDL2008
232
+
233
+ self._library = None
234
+ self._libraries = {}
235
+
236
+ self._testcase = None
237
+ self._testsuite = None
238
+ self._testsuites = {}
239
+ self._options = {}
240
+
241
+ @readonly
242
+ def Processor(self): # -> "Tk":
243
+ return self._processor
244
+
245
+ @property
246
+ def LastException(self) -> Exception:
247
+ lastException = self._lastException
248
+ self._lastException = None
249
+ return lastException
250
+
251
+ @LastException.setter
252
+ def LastException(self, value: Exception) -> None:
253
+ self._lastException = value
254
+
255
+ @readonly
256
+ def WorkingDirectory(self) -> Path:
257
+ return self._workingDirectory
258
+
259
+ @readonly
260
+ def CurrentDirectory(self) -> Path:
261
+ return self._currentDirectory
262
+
263
+ @property
264
+ def VHDLVersion(self) -> VHDLVersion:
265
+ return self._vhdlversion
266
+
267
+ @VHDLVersion.setter
268
+ def VHDLVersion(self, value: VHDLVersion) -> None:
269
+ self._vhdlversion = value
270
+
271
+ @readonly
272
+ def IncludedFiles(self) -> List[Path]:
273
+ return self._includedFiles
274
+
275
+ @readonly
276
+ def Libraries(self) -> Dict[str, Library]:
277
+ return self._libraries
278
+
279
+ @readonly
280
+ def Library(self) -> Library:
281
+ return self._library
282
+
283
+ @readonly
284
+ def Testsuites(self) -> Dict[str, Testsuite]:
285
+ return self._testsuites
286
+
287
+ @readonly
288
+ def Testsuite(self) -> Testsuite:
289
+ return self._testsuite
290
+
291
+ @readonly
292
+ def TestCase(self) -> Testcase:
293
+ return self._testcase
294
+
295
+ def IncludeFile(self, proFileOrBuildDirectory: Path) -> Path:
296
+ if proFileOrBuildDirectory.is_absolute():
297
+ ex = OSVVMException(f"Absolute path '{proFileOrBuildDirectory}' not supported.")
298
+ self._lastException = ex
299
+ raise ex
300
+
301
+ path = (self._currentDirectory / proFileOrBuildDirectory).resolve()
302
+ if path.is_file():
303
+ if path.suffix == ".pro":
304
+ self._currentDirectory = path.parent.relative_to(self._workingDirectory, walk_up=True)
305
+ proFile = self._currentDirectory / path.name
306
+ else:
307
+ ex = OSVVMException(f"Path '{proFileOrBuildDirectory}' is not a *.pro file.")
308
+ self._lastException = ex
309
+ raise ex
310
+ elif path.is_dir():
311
+ self._currentDirectory = path
312
+ proFile = path / "build.pro"
313
+ if not proFile.exists():
314
+ proFile = path / f"{path.name}.pro"
315
+ if not proFile.exists():
316
+ ex = OSVVMException(f"Path '{proFileOrBuildDirectory}' is not a build directory.")
317
+ ex.__cause__ = FileNotFoundError(path / "build.pro")
318
+ self._lastException = ex
319
+ raise ex
320
+ else:
321
+ ex = OSVVMException(f"Path '{proFileOrBuildDirectory}' is not a *.pro file or build directory.")
322
+ self._lastException = ex
323
+ raise ex
324
+
325
+ self._includedFiles.append(proFile)
326
+ return proFile
327
+
328
+ def EvaluateFile(self, proFile: Path) -> None:
329
+ self._processor.EvaluateProFile(proFile)
330
+
331
+ def SetLibrary(self, name: str):
332
+ try:
333
+ self._library = self._libraries[name]
334
+ except KeyError:
335
+ self._library = Library(name)
336
+ self._libraries[name] = self._library
337
+
338
+ def AddVHDLFile(self, vhdlFile: VHDLSourceFile) -> None:
339
+ if self._library is None:
340
+ self.SetLibrary("default")
341
+
342
+ vhdlFile.VHDLVersion = self._vhdlversion
343
+ self._library.AddFile(vhdlFile)
344
+
345
+ def SetTestsuite(self, testsuiteName: str):
346
+ try:
347
+ self._testsuite = self._testsuites[testsuiteName]
348
+ except KeyError:
349
+ self._testsuite = Testsuite(testsuiteName)
350
+ self._testsuites[testsuiteName] = self._testsuite
351
+
352
+ def AddTestcase(self, testName: str) -> TestCase:
353
+ if self._testsuite is None:
354
+ self.SetTestsuite("default")
355
+
356
+ self._testcase = Testcase(testName)
357
+ self._testsuite._testcases[testName] = self._testcase
358
+
359
+ return self._testcase
360
+
361
+ def SetTestcaseToplevel(self, toplevel: str) -> TestCase:
362
+ if self._testcase is None:
363
+ ex = OSVVMException("Can't set testcase toplevel, because no testcase setup.")
364
+ self._lastException = ex
365
+ raise ex
366
+
367
+ self._testcase.SetToplevel(toplevel)
368
+
369
+ return self._testcase
370
+
371
+ def AddOption(self, genericValue: GenericValue):
372
+ optionID = id(genericValue)
373
+ self._options[optionID] = genericValue
374
+
375
+ return optionID
376
+
377
+
378
+ osvvmContext: Context = Context()