sv-weave-uvm 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.
- sv_weave_uvm-0.1.0/LICENSE +73 -0
- sv_weave_uvm-0.1.0/PKG-INFO +67 -0
- sv_weave_uvm-0.1.0/README.md +37 -0
- sv_weave_uvm-0.1.0/pyproject.toml +69 -0
- sv_weave_uvm-0.1.0/setup.cfg +4 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm/__init__.py +7 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm/__version__.py +5 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm/binding.py +102 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm/share/sv/sv_weave_uvm_pkg.sv +89 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm/weavers.py +182 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm.egg-info/PKG-INFO +67 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm.egg-info/SOURCES.txt +14 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm.egg-info/dependency_links.txt +1 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm.egg-info/entry_points.txt +6 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm.egg-info/requires.txt +11 -0
- sv_weave_uvm-0.1.0/src/sv_weave_uvm.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"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.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"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.
|
|
20
|
+
|
|
21
|
+
"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).
|
|
22
|
+
|
|
23
|
+
"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.
|
|
24
|
+
|
|
25
|
+
"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."
|
|
26
|
+
|
|
27
|
+
"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.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License. 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.
|
|
30
|
+
|
|
31
|
+
3. Grant of Patent License. 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.
|
|
32
|
+
|
|
33
|
+
4. Redistribution. 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:
|
|
34
|
+
|
|
35
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
36
|
+
|
|
37
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
38
|
+
|
|
39
|
+
(c) 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
|
|
40
|
+
|
|
41
|
+
(d) 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.
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. 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.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. 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.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. 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.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. 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.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. 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.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
|
56
|
+
|
|
57
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
Copyright 2026 sv-weave
|
|
62
|
+
|
|
63
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
64
|
+
you may not use this file except in compliance with the License.
|
|
65
|
+
You may obtain a copy of the License at
|
|
66
|
+
|
|
67
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
68
|
+
|
|
69
|
+
Unless required by applicable law or agreed to in writing, software
|
|
70
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
71
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
72
|
+
See the License for the specific language governing permissions and
|
|
73
|
+
limitations under the License.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sv-weave-uvm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: UVM library for sv-weave: binding, factory adapter, UVM weavers and audits
|
|
5
|
+
Author-email: Matthew Ballance <matt.ballance@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Documentation, https://dvkit.org/sv-weave/sv-weave-uvm/
|
|
8
|
+
Project-URL: Source, https://github.com/sv-weave/sv-weave-uvm
|
|
9
|
+
Keywords: systemverilog,uvm,code-generation,verification,slang
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
16
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: sv-weave<0.2,>=0.1
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-dfm; extra == "dev"
|
|
24
|
+
Requires-Dist: dv-flow-mgr; extra == "dev"
|
|
25
|
+
Requires-Dist: dv-flow-libhdlsim; extra == "dev"
|
|
26
|
+
Provides-Extra: docs
|
|
27
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
28
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# sv-weave-uvm
|
|
32
|
+
|
|
33
|
+
The UVM library for [sv-weave](https://github.com/sv-weave/sv-weave): the `uvm`
|
|
34
|
+
binding, the factory adapter (`sv_weave_uvm_pkg`), UVM-specific weavers and, later,
|
|
35
|
+
UVM audits. Core sv-weave stays library-neutral; everything UVM-specific lives here.
|
|
36
|
+
|
|
37
|
+
## Use
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
pip install sv-weave sv-weave-uvm
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
# sv-weave.yaml
|
|
45
|
+
sv-weave:
|
|
46
|
+
binding: uvm # found through the sv_weave.bindings entry point
|
|
47
|
+
packages: {include: [my_tx_pkg]}
|
|
48
|
+
weavers: [{name: copy}, {name: compare}, {name: print}]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The binding maps features to `uvm_object` hooks (`copy` -> `do_copy`, `compare` ->
|
|
52
|
+
`do_compare`, `print` -> `convert2string`) and registers each woven class with
|
|
53
|
+
`sv_weave_uvm_factory`, a `uvm_default_factory` subclass. UVM resolves its own type and
|
|
54
|
+
instance overrides first; the woven class of the resolved type is substituted after
|
|
55
|
+
that, for the profile chosen with `+weave_profile=<p>`.
|
|
56
|
+
|
|
57
|
+
## Develop
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
ivpm update # sv-weave (source), dv-flow, pytest, Verilator
|
|
61
|
+
source packages/packages.envrc # or direnv with the tracked .envrc
|
|
62
|
+
uv pip install --python packages/python/bin/python --no-deps -e .
|
|
63
|
+
pytest tests/unit
|
|
64
|
+
pytest -m sim # weave + Verilator runs
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Status: `docs/plan/status.md`. Background: `sv-weave-uvm-handoff.md`.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# sv-weave-uvm
|
|
2
|
+
|
|
3
|
+
The UVM library for [sv-weave](https://github.com/sv-weave/sv-weave): the `uvm`
|
|
4
|
+
binding, the factory adapter (`sv_weave_uvm_pkg`), UVM-specific weavers and, later,
|
|
5
|
+
UVM audits. Core sv-weave stays library-neutral; everything UVM-specific lives here.
|
|
6
|
+
|
|
7
|
+
## Use
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
pip install sv-weave sv-weave-uvm
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
# sv-weave.yaml
|
|
15
|
+
sv-weave:
|
|
16
|
+
binding: uvm # found through the sv_weave.bindings entry point
|
|
17
|
+
packages: {include: [my_tx_pkg]}
|
|
18
|
+
weavers: [{name: copy}, {name: compare}, {name: print}]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The binding maps features to `uvm_object` hooks (`copy` -> `do_copy`, `compare` ->
|
|
22
|
+
`do_compare`, `print` -> `convert2string`) and registers each woven class with
|
|
23
|
+
`sv_weave_uvm_factory`, a `uvm_default_factory` subclass. UVM resolves its own type and
|
|
24
|
+
instance overrides first; the woven class of the resolved type is substituted after
|
|
25
|
+
that, for the profile chosen with `+weave_profile=<p>`.
|
|
26
|
+
|
|
27
|
+
## Develop
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
ivpm update # sv-weave (source), dv-flow, pytest, Verilator
|
|
31
|
+
source packages/packages.envrc # or direnv with the tracked .envrc
|
|
32
|
+
uv pip install --python packages/python/bin/python --no-deps -e .
|
|
33
|
+
pytest tests/unit
|
|
34
|
+
pytest -m sim # weave + Verilator runs
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Status: `docs/plan/status.md`. Background: `sv-weave-uvm-handoff.md`.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sv-weave-uvm"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "UVM library for sv-weave: binding, factory adapter, UVM weavers and audits"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11" # follows sv-weave (pyslang 12 requires 3.11)
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "Matthew Ballance", email = "matt.ballance@gmail.com"},
|
|
15
|
+
]
|
|
16
|
+
keywords = ["systemverilog", "uvm", "code-generation", "verification", "slang"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
|
|
24
|
+
"Topic :: Software Development :: Code Generators",
|
|
25
|
+
]
|
|
26
|
+
# The plugin API gate: core API_VERSION (0, 1). Raise both together.
|
|
27
|
+
dependencies = [
|
|
28
|
+
"sv-weave>=0.1,<0.2",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Documentation = "https://dvkit.org/sv-weave/sv-weave-uvm/"
|
|
33
|
+
Source = "https://github.com/sv-weave/sv-weave-uvm"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest",
|
|
38
|
+
"pytest-dfm",
|
|
39
|
+
"dv-flow-mgr",
|
|
40
|
+
"dv-flow-libhdlsim",
|
|
41
|
+
]
|
|
42
|
+
docs = [
|
|
43
|
+
"sphinx",
|
|
44
|
+
"sphinx-rtd-theme",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.entry-points."sv_weave.bindings"]
|
|
48
|
+
uvm = "sv_weave_uvm.binding:UvmBinding"
|
|
49
|
+
|
|
50
|
+
[project.entry-points."sv_weave.weavers"]
|
|
51
|
+
do_print = "sv_weave_uvm.weavers:DoPrintWeaver"
|
|
52
|
+
pack = "sv_weave_uvm.weavers:PackWeaver"
|
|
53
|
+
|
|
54
|
+
[tool.setuptools.dynamic]
|
|
55
|
+
version = {attr = "sv_weave_uvm.__version__.__version__"}
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.packages.find]
|
|
58
|
+
where = ["src"]
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.package-data]
|
|
61
|
+
"sv_weave_uvm" = ["**/*.sv", "**/*.svh"]
|
|
62
|
+
|
|
63
|
+
[tool.pytest.ini_options]
|
|
64
|
+
testpaths = ["tests"]
|
|
65
|
+
markers = [
|
|
66
|
+
"sim: end-to-end weave + Verilator simulation (pytest-dfm)",
|
|
67
|
+
"docs: Sphinx documentation build",
|
|
68
|
+
"xezim: needs the xezim simulator; skipped when it is not on PATH",
|
|
69
|
+
]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""sv-weave-uvm: the UVM library for sv-weave (binding, factory adapter, UVM weavers)."""
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
from .__version__ import __version__
|
|
5
|
+
|
|
6
|
+
#: Directory of the SystemVerilog sources shipped with the package.
|
|
7
|
+
SV_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "share", "sv")
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""The UVM binding for sv-weave (``binding: uvm``). It works *with* the library:
|
|
2
|
+
|
|
3
|
+
- **Features are uvm_object's own virtual hooks:** ``copy`` -> ``do_copy``,
|
|
4
|
+
``compare`` -> ``do_compare``, ``print`` -> ``convert2string``, ``do_print`` ->
|
|
5
|
+
``do_print`` (the ``do_print`` weaver, :mod:`sv_weave_uvm.weavers`), ``do_pack`` /
|
|
6
|
+
``do_unpack`` (the ``pack`` weaver). UVM's ``copy()``, ``compare()``, ``print()``,
|
|
7
|
+
``sprint()``, ``pack*()`` and ``unpack*()`` reach them as usual.
|
|
8
|
+
- **The library's factory decides what gets created.** Each woven class carries
|
|
9
|
+
`` `uvm_object_utils `` and is registered with ``sv_weave_uvm_factory``
|
|
10
|
+
(``share/sv/sv_weave_uvm_pkg.sv``), a ``uvm_default_factory`` subclass installed in
|
|
11
|
+
the core service. UVM resolves the requested type through its own type and
|
|
12
|
+
instance overrides first; the factory then substitutes the woven class of the
|
|
13
|
+
*resolved* type for the profile chosen with ``+weave_profile=<p>`` (default: the
|
|
14
|
+
config's ``default-profile``). The result does not depend on registration order,
|
|
15
|
+
unlike plain ``set_type_override``.
|
|
16
|
+
|
|
17
|
+
The user class must be registered with the factory (`` `uvm_object_utils ``); a woven
|
|
18
|
+
class of an unregistered class is generated but not registered (a warning).
|
|
19
|
+
"""
|
|
20
|
+
import os
|
|
21
|
+
from typing import Dict
|
|
22
|
+
|
|
23
|
+
from sv_weave.plugin import Binding, FeatureSpec
|
|
24
|
+
|
|
25
|
+
from . import SV_DIR
|
|
26
|
+
from .__version__ import __version__
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _q(s: str) -> str:
|
|
30
|
+
return '"%s"' % s.replace('"', '\\"')
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _registered(cls) -> bool:
|
|
34
|
+
"""The class itself declares get_type(), i.e. it uses `uvm_object_utils."""
|
|
35
|
+
return any(m.name == "get_type" and m.static for m in cls.methods)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class UvmBinding(Binding):
|
|
39
|
+
name = "uvm"
|
|
40
|
+
version = __version__
|
|
41
|
+
roots = ("uvm_pkg::uvm_object",)
|
|
42
|
+
|
|
43
|
+
def features(self) -> Dict[str, FeatureSpec]:
|
|
44
|
+
return {
|
|
45
|
+
"copy": FeatureSpec("copy", "do_copy", args=("uvm_object rhs",),
|
|
46
|
+
arg_names=("rhs",), rhs="rhs"),
|
|
47
|
+
"compare": FeatureSpec("compare", "do_compare",
|
|
48
|
+
args=("uvm_object rhs", "uvm_comparer comparer"),
|
|
49
|
+
arg_names=("rhs", "comparer"), ret="bit", rhs="rhs"),
|
|
50
|
+
"print": FeatureSpec("print", "convert2string", ret="string"),
|
|
51
|
+
"do_print": FeatureSpec("do_print", "do_print", args=("uvm_printer printer",),
|
|
52
|
+
arg_names=("printer",)),
|
|
53
|
+
"do_pack": FeatureSpec("do_pack", "do_pack", args=("uvm_packer packer",),
|
|
54
|
+
arg_names=("packer",)),
|
|
55
|
+
"do_unpack": FeatureSpec("do_unpack", "do_unpack", args=("uvm_packer packer",),
|
|
56
|
+
arg_names=("packer",)),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
def sv_runtime_files(self):
|
|
60
|
+
return [os.path.join(SV_DIR, "sv_weave_uvm_pkg.sv")]
|
|
61
|
+
|
|
62
|
+
def preamble(self):
|
|
63
|
+
return ['`include "uvm_macros.svh"']
|
|
64
|
+
|
|
65
|
+
def imports(self):
|
|
66
|
+
return ["uvm_pkg"]
|
|
67
|
+
|
|
68
|
+
def create_expr(self, cls, inst: str = ""):
|
|
69
|
+
if _registered(cls) and cls.type_expr:
|
|
70
|
+
return "%s::type_id::create(%s)" % (cls.type_expr, inst or '""')
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
def miscompare_stmt(self, cls, field: str) -> str:
|
|
74
|
+
return ('uvm_pkg::uvm_report_info("sv-weave", "compare: %s.%s differs", '
|
|
75
|
+
'uvm_pkg::UVM_HIGH);' % (cls.qname, field))
|
|
76
|
+
|
|
77
|
+
def finalize(self, w) -> None:
|
|
78
|
+
if not _registered(w.cls):
|
|
79
|
+
w.warning("%s is not registered with the UVM factory (no `uvm_object_utils); "
|
|
80
|
+
"its woven class will not be used" % w.cls.qname, w.cls.loc)
|
|
81
|
+
# The *_param_utils form registers the woven class by type only: it gets no
|
|
82
|
+
# factory name of its own and inherits get_type_name()/type_name() from the
|
|
83
|
+
# user's class, so logs and factory.print() show the original name.
|
|
84
|
+
macro = "uvm_component_param_utils" if w.cls.is_a("uvm_pkg::uvm_component") else \
|
|
85
|
+
"uvm_object_param_utils"
|
|
86
|
+
w.add_item("`%s(%s)" % (macro, w.woven.name))
|
|
87
|
+
|
|
88
|
+
def package_items(self, wpkg, cfg):
|
|
89
|
+
regs = [wc for wc in wpkg.classes
|
|
90
|
+
if wc.concrete and wc.target.binding == self.name and _registered(wc.cls)]
|
|
91
|
+
if not regs:
|
|
92
|
+
return []
|
|
93
|
+
stmts = ["begin",
|
|
94
|
+
" sv_weave_uvm_pkg::sv_weave_uvm_factory f = "
|
|
95
|
+
"sv_weave_uvm_pkg::sv_weave_uvm_factory::install();",
|
|
96
|
+
" f.set_config_default(%s);" % _q(cfg.default_profile)]
|
|
97
|
+
for wc in regs:
|
|
98
|
+
for prof in wc.profiles:
|
|
99
|
+
stmts.append(" f.add(%s::get_type(), %s, %s::get_type());"
|
|
100
|
+
% (wc.cls.type_expr, _q(prof), wc.name))
|
|
101
|
+
stmts.append("end")
|
|
102
|
+
return stmts
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// sv_weave_uvm_pkg: the SV side of the sv-weave-uvm binding (sv_weave_uvm.binding).
|
|
2
|
+
//
|
|
3
|
+
// A uvm_default_factory subclass. The UVM factory first resolves the requested type
|
|
4
|
+
// through its normal type and instance overrides; this factory then substitutes the
|
|
5
|
+
// woven class registered for the *resolved* type and the active profile:
|
|
6
|
+
//
|
|
7
|
+
// tx --(user override)--> my_tx --(woven, profile)--> Woven_my_tx__release
|
|
8
|
+
//
|
|
9
|
+
// So the result does not depend on the order in which overrides and woven classes are
|
|
10
|
+
// registered (sv-weave handoff: "do not do this with plain UVM type overrides").
|
|
11
|
+
// Profile: +weave_profile=<p>, else the config's default-profile.
|
|
12
|
+
// Compile after uvm_pkg and before the woven packages.
|
|
13
|
+
`ifndef SV_WEAVE_UVM_PKG_SV
|
|
14
|
+
`define SV_WEAVE_UVM_PKG_SV
|
|
15
|
+
|
|
16
|
+
`include "uvm_macros.svh"
|
|
17
|
+
|
|
18
|
+
package sv_weave_uvm_pkg;
|
|
19
|
+
import uvm_pkg::*;
|
|
20
|
+
|
|
21
|
+
class sv_weave_uvm_factory extends uvm_default_factory;
|
|
22
|
+
// resolved type -> profile -> woven class. Keyed by the type's wrapper (one per
|
|
23
|
+
// type), not its name, so same-named classes in different packages stay apart.
|
|
24
|
+
local uvm_object_wrapper m_woven[uvm_object_wrapper][string];
|
|
25
|
+
local string m_config_default;
|
|
26
|
+
local string m_plusarg_profile;
|
|
27
|
+
local bit m_plusargs_read;
|
|
28
|
+
|
|
29
|
+
// Installs this factory in the core service (once) and returns it. Called by the
|
|
30
|
+
// generated registration code, before the testbench creates anything.
|
|
31
|
+
static function sv_weave_uvm_factory install();
|
|
32
|
+
uvm_coreservice_t cs = uvm_coreservice_t::get();
|
|
33
|
+
uvm_factory f = cs.get_factory();
|
|
34
|
+
sv_weave_uvm_factory wf;
|
|
35
|
+
if ($cast(wf, f)) return wf;
|
|
36
|
+
wf = new();
|
|
37
|
+
cs.set_factory(wf);
|
|
38
|
+
return wf;
|
|
39
|
+
endfunction
|
|
40
|
+
|
|
41
|
+
function void set_config_default(string profile);
|
|
42
|
+
m_config_default = profile;
|
|
43
|
+
endfunction
|
|
44
|
+
|
|
45
|
+
function void add(uvm_object_wrapper user_type, string profile,
|
|
46
|
+
uvm_object_wrapper woven_type);
|
|
47
|
+
m_woven[user_type][profile] = woven_type;
|
|
48
|
+
endfunction
|
|
49
|
+
|
|
50
|
+
function string profile();
|
|
51
|
+
if (!m_plusargs_read) begin
|
|
52
|
+
m_plusargs_read = 1;
|
|
53
|
+
void'($value$plusargs("weave_profile=%s", m_plusarg_profile));
|
|
54
|
+
end
|
|
55
|
+
return (m_plusarg_profile != "") ? m_plusarg_profile : m_config_default;
|
|
56
|
+
endfunction
|
|
57
|
+
|
|
58
|
+
// The woven class for an already-resolved type, or the type itself.
|
|
59
|
+
function uvm_object_wrapper woven_of(uvm_object_wrapper t);
|
|
60
|
+
string p;
|
|
61
|
+
if (t == null || !m_woven.exists(t)) return t;
|
|
62
|
+
p = profile();
|
|
63
|
+
if (m_woven[t].exists(p)) return m_woven[t][p];
|
|
64
|
+
if (m_woven[t].exists(m_config_default)) return m_woven[t][m_config_default];
|
|
65
|
+
return t;
|
|
66
|
+
endfunction
|
|
67
|
+
|
|
68
|
+
virtual function uvm_object_wrapper find_override_by_type(
|
|
69
|
+
uvm_object_wrapper requested_type, string full_inst_path);
|
|
70
|
+
return woven_of(super.find_override_by_type(requested_type, full_inst_path));
|
|
71
|
+
endfunction
|
|
72
|
+
|
|
73
|
+
virtual function uvm_object_wrapper find_override_by_name(
|
|
74
|
+
string requested_type_name, string full_inst_path);
|
|
75
|
+
uvm_object_wrapper t, w;
|
|
76
|
+
t = super.find_override_by_name(requested_type_name, full_inst_path);
|
|
77
|
+
if (t != null) return woven_of(t);
|
|
78
|
+
// No override: UVM returns null here and the caller (e.g. create_*_by_name, used
|
|
79
|
+
// by run_test) falls back to the registered type, unwoven. Report its woven
|
|
80
|
+
// class as the override instead; keep null when there is none.
|
|
81
|
+
t = m_resolve_type_name(requested_type_name); // find_wrapper_by_name warns if unknown
|
|
82
|
+
w = woven_of(t);
|
|
83
|
+
return (w != t) ? w : null;
|
|
84
|
+
endfunction
|
|
85
|
+
endclass
|
|
86
|
+
|
|
87
|
+
endpackage
|
|
88
|
+
|
|
89
|
+
`endif
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"""UVM-specific weavers (entry-point group ``sv_weave.weavers``).
|
|
2
|
+
|
|
3
|
+
``do_print``: one ``uvm_printer`` call per field, through the binding's ``do_print``
|
|
4
|
+
feature, so ``print()`` and ``sprint()`` show the fields with the table, tree and line
|
|
5
|
+
printers. The core ``print`` weaver (``convert2string``) is independent of it; a config
|
|
6
|
+
lists either or both.
|
|
7
|
+
|
|
8
|
+
``pack``: ``do_pack`` and ``do_unpack`` through ``uvm_packer``, so ``pack()``,
|
|
9
|
+
``pack_bytes()``, ``pack_ints()`` and the ``unpack*()`` calls round-trip the fields.
|
|
10
|
+
"""
|
|
11
|
+
from sv_weave.frontend.types import ArrayKind, TypeCat
|
|
12
|
+
from sv_weave.match import extends_root, has_attr
|
|
13
|
+
from sv_weave.plugin import Weaver
|
|
14
|
+
from sv_weave.weavers.copy import copyable
|
|
15
|
+
|
|
16
|
+
from .__version__ import __version__
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _q(s: str) -> str:
|
|
20
|
+
return '"%s"' % s.replace("\\", "\\\\").replace('"', '\\"')
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _type_name(t) -> str:
|
|
24
|
+
return t.spelling or t.text or t.cat.value
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def print_stmt(w, f, printer: str):
|
|
28
|
+
"""The ``uvm_printer`` call that prints field ``f``, or "" for none."""
|
|
29
|
+
t = f.type
|
|
30
|
+
a = "this.%s" % f.name
|
|
31
|
+
name = _q(f.name)
|
|
32
|
+
if t.cat == TypeCat.ENUM and t.nameable:
|
|
33
|
+
return "%s.print_generic(%s, %s, $bits(%s), %s.name());" % (
|
|
34
|
+
printer, name, _q(_type_name(t)), a, a)
|
|
35
|
+
if t.cat in (TypeCat.INTEGRAL, TypeCat.ENUM) or \
|
|
36
|
+
(t.cat in (TypeCat.STRUCT, TypeCat.UNION) and t.packed):
|
|
37
|
+
radix = "uvm_pkg::UVM_DEC" if t.signed else "uvm_pkg::UVM_NORADIX"
|
|
38
|
+
fn = "print_field_int" if 0 < t.width <= 64 else "print_field"
|
|
39
|
+
return "%s.%s(%s, %s, $bits(%s), %s);" % (printer, fn, name, a, a, radix)
|
|
40
|
+
if t.cat == TypeCat.STRING:
|
|
41
|
+
return "%s.print_string(%s, %s);" % (printer, name, a)
|
|
42
|
+
if t.cat == TypeCat.REAL:
|
|
43
|
+
return "%s.print_real(%s, %s);" % (printer, name, a)
|
|
44
|
+
if t.cat == TypeCat.CLASS:
|
|
45
|
+
cls = w.model.find_class(t.class_qname) if t.class_qname else None
|
|
46
|
+
if cls is not None and cls.is_a("uvm_pkg::uvm_object"):
|
|
47
|
+
if "weave_deep" in f.attrs:
|
|
48
|
+
return "%s.print_object(%s, %s);" % (printer, name, a)
|
|
49
|
+
# A reference, as UVM_REFERENCE fields print: type and instance id.
|
|
50
|
+
return ('%s.print_generic(%s, %s, 0, (%s == null) ? "<null>" : '
|
|
51
|
+
'$sformatf("@%%0d", %s.get_inst_id()));'
|
|
52
|
+
% (printer, name, _q(_type_name(t)), a, a))
|
|
53
|
+
return ('%s.print_generic(%s, %s, 0, (%s == null) ? "<null>" : "<object>");'
|
|
54
|
+
% (printer, name, _q(_type_name(t)), a))
|
|
55
|
+
if t.cat in (TypeCat.EVENT, TypeCat.CHANDLE):
|
|
56
|
+
return ""
|
|
57
|
+
if t.cat == TypeCat.ARRAY:
|
|
58
|
+
size = "$size(%s)" % a if t.array_kind == ArrayKind.FIXED else "%s.size()" % a
|
|
59
|
+
else:
|
|
60
|
+
size = "0"
|
|
61
|
+
return '%s.print_generic(%s, %s, %s, $sformatf("%%p", %s));' % (
|
|
62
|
+
printer, name, _q(_type_name(t)), size, a)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class DoPrintWeaver(Weaver):
|
|
66
|
+
name = "do_print"
|
|
67
|
+
version = __version__
|
|
68
|
+
|
|
69
|
+
def subscribe(self, bus):
|
|
70
|
+
bus.on(extends_root() & ~has_attr("weave_noprint"), self.weave)
|
|
71
|
+
|
|
72
|
+
def weave(self, w):
|
|
73
|
+
slot = w.feature("do_print")
|
|
74
|
+
printer = slot.sig.arg_names[0] if slot.sig.arg_names else "printer"
|
|
75
|
+
for f in w.fields():
|
|
76
|
+
if not copyable(w, f, "weave_noprint"):
|
|
77
|
+
continue
|
|
78
|
+
text = print_stmt(w, f, printer)
|
|
79
|
+
if text:
|
|
80
|
+
slot.body.add(text)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _scalar(t) -> bool:
|
|
84
|
+
return t.cat in (TypeCat.INTEGRAL, TypeCat.STRING, TypeCat.REAL) or \
|
|
85
|
+
(t.cat == TypeCat.ENUM and t.nameable) or \
|
|
86
|
+
(t.cat in (TypeCat.STRUCT, TypeCat.UNION) and t.packed)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _pack_one(t, a: str, packer: str) -> str:
|
|
90
|
+
if t.cat == TypeCat.STRING:
|
|
91
|
+
return "%s.pack_string(%s);" % (packer, a)
|
|
92
|
+
if t.cat == TypeCat.REAL:
|
|
93
|
+
return "%s.pack_real(%s);" % (packer, a)
|
|
94
|
+
fn = "pack_field_int" if 0 < t.width <= 64 else "pack_field"
|
|
95
|
+
return "%s.%s(%s, $bits(%s));" % (packer, fn, a, a)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _unpack_one(t, a: str, packer: str) -> str:
|
|
99
|
+
if t.cat == TypeCat.STRING:
|
|
100
|
+
return "%s = %s.unpack_string();" % (a, packer)
|
|
101
|
+
if t.cat == TypeCat.REAL:
|
|
102
|
+
return "%s = %s.unpack_real();" % (a, packer)
|
|
103
|
+
fn = "unpack_field_int" if 0 < t.width <= 64 else "unpack_field"
|
|
104
|
+
rhs = "%s.%s($bits(%s))" % (packer, fn, a)
|
|
105
|
+
if t.cat == TypeCat.ENUM:
|
|
106
|
+
rhs = "%s'(%s)" % (t.spelling, rhs)
|
|
107
|
+
return "%s = %s;" % (a, rhs)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def pack_stmts(w, f, packer: str):
|
|
111
|
+
"""The (pack, unpack) statements for field ``f``; None when it is not packed,
|
|
112
|
+
a str when it cannot be packed (the reason)."""
|
|
113
|
+
t = f.type
|
|
114
|
+
a = "this.%s" % f.name
|
|
115
|
+
if _scalar(t):
|
|
116
|
+
return _pack_one(t, a, packer), _unpack_one(t, a, packer)
|
|
117
|
+
if t.cat == TypeCat.CLASS:
|
|
118
|
+
cls = w.model.find_class(t.class_qname) if t.class_qname else None
|
|
119
|
+
if "weave_deep" not in f.attrs:
|
|
120
|
+
return None # a reference: not packed, as UVM_REFERENCE fields
|
|
121
|
+
if cls is None or not cls.is_a("uvm_pkg::uvm_object"):
|
|
122
|
+
return "a weave_deep handle that is not a uvm_object"
|
|
123
|
+
# unpack_object_with_meta creates the object from the packed type name; for a
|
|
124
|
+
# woven class it does not (it shares the user's name) and a null handle stays
|
|
125
|
+
# null. Create it through the factory first, as a deep copy does.
|
|
126
|
+
made = w.binding.create_expr(cls, _q(f.name))
|
|
127
|
+
create = " if (%s == null) %s = %s;\n" % (a, a, made) if made else ""
|
|
128
|
+
unpack = ("begin\n"
|
|
129
|
+
" uvm_pkg::uvm_object ref__;\n%(c)s"
|
|
130
|
+
" ref__ = %(a)s;\n"
|
|
131
|
+
" %(p)s.unpack_object_with_meta(ref__);\n"
|
|
132
|
+
" if (ref__ != %(a)s && !$cast(%(a)s, ref__))\n"
|
|
133
|
+
" uvm_pkg::uvm_report_error(\"sv-weave\", {\"do_unpack: cannot cast \",\n"
|
|
134
|
+
" ref__.get_type_name(), \" to %(f)s\"});\n"
|
|
135
|
+
"end" % {"a": a, "p": packer, "f": f.name, "c": create})
|
|
136
|
+
return "%s.pack_object_with_meta(%s);" % (packer, a), unpack
|
|
137
|
+
if t.cat in (TypeCat.EVENT, TypeCat.CHANDLE, TypeCat.VIRTUAL_IF):
|
|
138
|
+
return None
|
|
139
|
+
if t.cat == TypeCat.ARRAY and t.elem is not None and _scalar(t.elem) and \
|
|
140
|
+
t.array_kind != ArrayKind.ASSOC:
|
|
141
|
+
e = "%s[i__]" % a
|
|
142
|
+
pe, ue = _pack_one(t.elem, e, packer), _unpack_one(t.elem, e, packer)
|
|
143
|
+
if t.array_kind == ArrayKind.FIXED:
|
|
144
|
+
return ("foreach (%s[i__]) %s" % (a, pe), "foreach (%s[i__]) %s" % (a, ue))
|
|
145
|
+
pack = ("begin\n %s.pack_field_int(%s.size(), 32);\n"
|
|
146
|
+
" foreach (%s[i__]) %s\nend" % (packer, a, a, pe))
|
|
147
|
+
if t.array_kind == ArrayKind.DYNAMIC:
|
|
148
|
+
resize = " %s = new[sz__];\n" % a
|
|
149
|
+
else:
|
|
150
|
+
resize = " while (%s.size() > sz__) void'(%s.pop_back());\n" % (a, a)
|
|
151
|
+
unpack = ("begin\n int sz__;\n sz__ = %s.unpack_field_int(32);\n%s"
|
|
152
|
+
" for (int i__ = 0; i__ < sz__; i__++) %s\nend"
|
|
153
|
+
% (packer, resize, ue))
|
|
154
|
+
return pack, unpack
|
|
155
|
+
return "type %s" % _type_name(t)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class PackWeaver(Weaver):
|
|
159
|
+
"""``do_pack`` and ``do_unpack`` through ``uvm_packer``, field by field in
|
|
160
|
+
declaration order; arrays other than fixed-size ones carry their size (32 bits)
|
|
161
|
+
first, as `` `uvm_pack_array``. Opt out with ``weave_nopack``."""
|
|
162
|
+
name = "pack"
|
|
163
|
+
version = __version__
|
|
164
|
+
|
|
165
|
+
def subscribe(self, bus):
|
|
166
|
+
bus.on(extends_root() & ~has_attr("weave_nopack"), self.weave)
|
|
167
|
+
|
|
168
|
+
def weave(self, w):
|
|
169
|
+
ps, us = w.feature("do_pack"), w.feature("do_unpack")
|
|
170
|
+
pp = ps.sig.arg_names[0] if ps.sig.arg_names else "packer"
|
|
171
|
+
up = us.sig.arg_names[0] if us.sig.arg_names else "packer"
|
|
172
|
+
for f in w.fields():
|
|
173
|
+
if not copyable(w, f, "weave_nopack"):
|
|
174
|
+
continue
|
|
175
|
+
r = pack_stmts(w, f, pp)
|
|
176
|
+
if r is None:
|
|
177
|
+
continue
|
|
178
|
+
if isinstance(r, str):
|
|
179
|
+
w.warning("pack: field '%s' (%s) is not packed" % (f.name, r))
|
|
180
|
+
continue
|
|
181
|
+
ps.body.add(r[0])
|
|
182
|
+
us.body.add(pack_stmts(w, f, up)[1])
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sv-weave-uvm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: UVM library for sv-weave: binding, factory adapter, UVM weavers and audits
|
|
5
|
+
Author-email: Matthew Ballance <matt.ballance@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Documentation, https://dvkit.org/sv-weave/sv-weave-uvm/
|
|
8
|
+
Project-URL: Source, https://github.com/sv-weave/sv-weave-uvm
|
|
9
|
+
Keywords: systemverilog,uvm,code-generation,verification,slang
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
16
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: sv-weave<0.2,>=0.1
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-dfm; extra == "dev"
|
|
24
|
+
Requires-Dist: dv-flow-mgr; extra == "dev"
|
|
25
|
+
Requires-Dist: dv-flow-libhdlsim; extra == "dev"
|
|
26
|
+
Provides-Extra: docs
|
|
27
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
28
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# sv-weave-uvm
|
|
32
|
+
|
|
33
|
+
The UVM library for [sv-weave](https://github.com/sv-weave/sv-weave): the `uvm`
|
|
34
|
+
binding, the factory adapter (`sv_weave_uvm_pkg`), UVM-specific weavers and, later,
|
|
35
|
+
UVM audits. Core sv-weave stays library-neutral; everything UVM-specific lives here.
|
|
36
|
+
|
|
37
|
+
## Use
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
pip install sv-weave sv-weave-uvm
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
# sv-weave.yaml
|
|
45
|
+
sv-weave:
|
|
46
|
+
binding: uvm # found through the sv_weave.bindings entry point
|
|
47
|
+
packages: {include: [my_tx_pkg]}
|
|
48
|
+
weavers: [{name: copy}, {name: compare}, {name: print}]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The binding maps features to `uvm_object` hooks (`copy` -> `do_copy`, `compare` ->
|
|
52
|
+
`do_compare`, `print` -> `convert2string`) and registers each woven class with
|
|
53
|
+
`sv_weave_uvm_factory`, a `uvm_default_factory` subclass. UVM resolves its own type and
|
|
54
|
+
instance overrides first; the woven class of the resolved type is substituted after
|
|
55
|
+
that, for the profile chosen with `+weave_profile=<p>`.
|
|
56
|
+
|
|
57
|
+
## Develop
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
ivpm update # sv-weave (source), dv-flow, pytest, Verilator
|
|
61
|
+
source packages/packages.envrc # or direnv with the tracked .envrc
|
|
62
|
+
uv pip install --python packages/python/bin/python --no-deps -e .
|
|
63
|
+
pytest tests/unit
|
|
64
|
+
pytest -m sim # weave + Verilator runs
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Status: `docs/plan/status.md`. Background: `sv-weave-uvm-handoff.md`.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/sv_weave_uvm/__init__.py
|
|
5
|
+
src/sv_weave_uvm/__version__.py
|
|
6
|
+
src/sv_weave_uvm/binding.py
|
|
7
|
+
src/sv_weave_uvm/weavers.py
|
|
8
|
+
src/sv_weave_uvm.egg-info/PKG-INFO
|
|
9
|
+
src/sv_weave_uvm.egg-info/SOURCES.txt
|
|
10
|
+
src/sv_weave_uvm.egg-info/dependency_links.txt
|
|
11
|
+
src/sv_weave_uvm.egg-info/entry_points.txt
|
|
12
|
+
src/sv_weave_uvm.egg-info/requires.txt
|
|
13
|
+
src/sv_weave_uvm.egg-info/top_level.txt
|
|
14
|
+
src/sv_weave_uvm/share/sv/sv_weave_uvm_pkg.sv
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sv_weave_uvm
|