xactflow 0.1.2__tar.gz → 0.2.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.
- {xactflow-0.1.2 → xactflow-0.2.0}/PKG-INFO +39 -19
- {xactflow-0.1.2 → xactflow-0.2.0}/README.md +36 -16
- {xactflow-0.1.2 → xactflow-0.2.0}/pyproject.toml +2 -2
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/runner.py +4 -4
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_01.py +16 -16
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_02.py +19 -19
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_04.py +2 -2
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_10.py +2 -2
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_11.py +1 -1
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/__init__.py +17 -17
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/cli.py +25 -25
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/diagnostics.py +1 -1
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/exporter.py +1 -1
- xactflow-0.2.0/src/xactflow/library.py +185 -0
- xactflow-0.2.0/src/xactflow/link/__init__.py +19 -0
- {xactflow-0.1.2/src/xactflow/elaborate → xactflow-0.2.0/src/xactflow/link}/model.py +11 -11
- {xactflow-0.1.2/src/xactflow/elaborate → xactflow-0.2.0/src/xactflow/link}/resolver.py +39 -39
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow.egg-info/PKG-INFO +39 -19
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow.egg-info/SOURCES.txt +3 -3
- xactflow-0.2.0/src/xactflow.egg-info/requires.txt +5 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/tests/test_cli.py +24 -10
- {xactflow-0.1.2 → xactflow-0.2.0}/tests/test_exporter.py +2 -2
- xactflow-0.2.0/tests/test_library.py +256 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/tests/test_resolver.py +26 -26
- {xactflow-0.1.2 → xactflow-0.2.0}/tests/test_scr.py +23 -23
- xactflow-0.1.2/src/xactflow/elaborate/__init__.py +0 -19
- xactflow-0.1.2/src/xactflow/library.py +0 -115
- xactflow-0.1.2/src/xactflow.egg-info/requires.txt +0 -5
- xactflow-0.1.2/tests/test_library.py +0 -117
- {xactflow-0.1.2 → xactflow-0.2.0}/LICENSE +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/setup.cfg +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/__init__.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/registry.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_03.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_05.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_06.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_07.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_08.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_09.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_12.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_13.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_14.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/SCR/scr_15.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/expressions.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/importer.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow/py.typed +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow.egg-info/dependency_links.txt +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow.egg-info/entry_points.txt +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/src/xactflow.egg-info/top_level.txt +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/tests/test_expressions.py +0 -0
- {xactflow-0.1.2 → xactflow-0.2.0}/tests/test_importer.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xactflow
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Multi-file IP-XACT
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Multi-file IP-XACT linking and semantic consistency checking on top of ipxact-compiler.
|
|
5
5
|
Author: Maxime Travaillard
|
|
6
6
|
License-Expression: LGPL-3.0-only
|
|
7
7
|
Project-URL: Repository, https://github.com/IP-XACT/XactFlow
|
|
@@ -20,7 +20,7 @@ Classifier: Topic :: Scientific/Engineering
|
|
|
20
20
|
Requires-Python: >=3.9
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: ipxact-compiler
|
|
23
|
+
Requires-Dist: ipxact-compiler>=0.1.2
|
|
24
24
|
Requires-Dist: lxml
|
|
25
25
|
Provides-Extra: dev
|
|
26
26
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -28,7 +28,7 @@ Dynamic: license-file
|
|
|
28
28
|
|
|
29
29
|
# XactFlow
|
|
30
30
|
|
|
31
|
-
Multi-file [IEEE 1685-2022](https://standards.ieee.org/ieee/1685/10307/) IP-XACT
|
|
31
|
+
Multi-file [IEEE 1685-2022](https://standards.ieee.org/ieee/1685/10307/) IP-XACT linking
|
|
32
32
|
and semantic consistency checking, built on top of
|
|
33
33
|
[`ipxact-compiler`](https://github.com/IP-XACT/ipxact-compiler) (a standalone single-file
|
|
34
34
|
IP-XACT parser).
|
|
@@ -58,11 +58,11 @@ Requires Python >= 3.9.
|
|
|
58
58
|
## CLI
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
xactflow
|
|
61
|
+
xactflow link <design.xml> [--lib DIR ...] [--config <designConfig.xml>]
|
|
62
62
|
xactflow check <file.xml>
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
`
|
|
65
|
+
`link` scans every `--lib` directory into a library indexed by VLNV, resolves `<design.xml>`
|
|
66
66
|
against it (component instances, bus interfaces, interconnections, monitor interconnections, ad
|
|
67
67
|
hoc connections), runs SCR checks on the result, prints every diagnostic, and exits nonzero if
|
|
68
68
|
any of them is an error.
|
|
@@ -98,16 +98,36 @@ a clean, expected rejection.
|
|
|
98
98
|
|
|
99
99
|
```python
|
|
100
100
|
import ipxact
|
|
101
|
-
from xactflow import Library,
|
|
101
|
+
from xactflow import Library, link
|
|
102
102
|
|
|
103
103
|
library = Library.scan("path/to/ip/library")
|
|
104
104
|
design = ipxact.parse_file("path/to/top_design.xml")
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
linked = link(design, library)
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
linked.instances # dict[str, LinkedInstance], keyed by instance name
|
|
109
|
+
linked.interconnections # list[LinkedInterconnection], every endpoint resolved
|
|
110
|
+
linked.diagnostics # list[Diagnostic] from every applicable SCR rule
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`Library.scan` raises `FileNotFoundError` or `NotADirectoryError`, for a scan root that
|
|
114
|
+
does not exist or is not a directory. A root from which no IEEE 1685-2022 document gets indexed,
|
|
115
|
+
and files in another IP-XACT version's namespace (e.g. 1685-2014), are only reported as
|
|
116
|
+
warnings in `library.diagnostics`, and the scan goes on. Documents that only exist in memory, such
|
|
117
|
+
as an importer's result, are indexed with `Library.add`, which runs the same checks as for a
|
|
118
|
+
scanned file:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
component = SomeImporter().import_(Path("ip.sv"))
|
|
122
|
+
library.add(component, path=Path("ip.sv")) # path is optional, it only records the origin.
|
|
123
|
+
library.add(component, replace=True) # Overwrite an existing entry instead.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
A single file picked by hand is indexed with `Library.add_file`, which applies the same namespace
|
|
127
|
+
filtering and checks as a scanned file and raises `FileNotFoundError` if the file does not exist:
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
library.add_file("path/to/extra_component.xml")
|
|
111
131
|
```
|
|
112
132
|
|
|
113
133
|
## Expression evaluation
|
|
@@ -158,8 +178,8 @@ IP-XACT expression evaluation to have check logic; `xactflow.evaluate()` (see [E
|
|
|
158
178
|
evaluation](#expression-evaluation) above) now exists, but isn't wired into any of these rules
|
|
159
179
|
yet.
|
|
160
180
|
|
|
161
|
-
`SCR.run_single_doc_checks(document)` and `SCR.run_post_config_checks(
|
|
162
|
-
standalone functions independent of the
|
|
181
|
+
`SCR.run_single_doc_checks(document)` and `SCR.run_post_config_checks(linked)` are public,
|
|
182
|
+
standalone functions independent of the linker's internals, so any caller (including a
|
|
163
183
|
future exporter that itself emits IP-XACT) should re-run SCR checking on IP-XACT it produced, not
|
|
164
184
|
only on the input.
|
|
165
185
|
|
|
@@ -172,7 +192,7 @@ implemented in this repository:
|
|
|
172
192
|
- `xactflow.Exporter` (`xactflow.exporters` entry point group): turns some IP-XACT-flavored
|
|
173
193
|
Python object into an output artifact, e.g. RTL, documentation, or another IP-XACT file. Its
|
|
174
194
|
`export(subject, output_dir, **options)` method leaves `subject` deliberately untyped: it may
|
|
175
|
-
be
|
|
195
|
+
be a `LinkedDesign` (a fully resolved multi-instance design), a bare `ipxact.Component` or
|
|
176
196
|
`ipxact.Design`, or anything else a given exporter chooses to support.
|
|
177
197
|
Each exporter documents and checks what it actually accepts.
|
|
178
198
|
- `xactflow.Importer` (`xactflow.importers` entry point group): reads a non-IP-XACT source (a
|
|
@@ -196,11 +216,11 @@ html = "xactflow_html:HtmlExporter"
|
|
|
196
216
|
(see [Expression evaluation](#expression-evaluation) above) can compute a concrete value from
|
|
197
217
|
an `Expression` string, but nothing in `xactflow.SCR` calls it yet, so the
|
|
198
218
|
overlap/alignment/stride SCRs, from having real check logic.
|
|
199
|
-
- **No multi-level design hierarchy.** `
|
|
219
|
+
- **No multi-level design hierarchy.** `link()` resolves one `Design` flat, it does not
|
|
200
220
|
recurse into a design nested inside another design's hierarchy. It will be supported in the future.
|
|
201
|
-
- **No `DesignConfiguration` application.** A `DesignConfiguration` can be passed to `
|
|
221
|
+
- **No `DesignConfiguration` application.** A `DesignConfiguration` can be passed to `link()`
|
|
202
222
|
and its single-doc rules get checked, but nothing actually applies it yet.
|
|
203
|
-
- **Monitor interconnections and ad hoc connections resolve but aren't checked.** `
|
|
223
|
+
- **Monitor interconnections and ad hoc connections resolve but aren't checked.** `link()`
|
|
204
224
|
resolves both into the graph, but no SCR rule (Table B.4, or the ad hoc rules in B.2/B.6) has
|
|
205
225
|
check logic yet, so a broken monitor or ad hoc reference is silently dropped rather than
|
|
206
226
|
reported.
|
|
@@ -212,9 +232,9 @@ html = "xactflow_html:HtmlExporter"
|
|
|
212
232
|
- Wire `xactflow.evaluate()` into the overlap/alignment/stride SCR rules it was built to unblock.
|
|
213
233
|
- String expression and IP-XACT builtin function (`$ipxact_index_value()` and similar) support
|
|
214
234
|
in `xactflow.evaluate()`.
|
|
215
|
-
- Multi-level design hierarchy
|
|
235
|
+
- Multi-level design hierarchy linking.
|
|
216
236
|
- A better SCR coverage, especially for the single file and pre config ones.
|
|
217
|
-
- The actual exporter and importer plugin packages (
|
|
237
|
+
- The actual exporter and importer plugin packages (a linked design to RTL exporter, an IP-XACT-emitting
|
|
218
238
|
exporter (component & design), a SystemVerilog-with-metadata importer, etc.), each in its own repository per
|
|
219
239
|
[Plugins](#plugins) above.
|
|
220
240
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# XactFlow
|
|
2
2
|
|
|
3
|
-
Multi-file [IEEE 1685-2022](https://standards.ieee.org/ieee/1685/10307/) IP-XACT
|
|
3
|
+
Multi-file [IEEE 1685-2022](https://standards.ieee.org/ieee/1685/10307/) IP-XACT linking
|
|
4
4
|
and semantic consistency checking, built on top of
|
|
5
5
|
[`ipxact-compiler`](https://github.com/IP-XACT/ipxact-compiler) (a standalone single-file
|
|
6
6
|
IP-XACT parser).
|
|
@@ -30,11 +30,11 @@ Requires Python >= 3.9.
|
|
|
30
30
|
## CLI
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
xactflow
|
|
33
|
+
xactflow link <design.xml> [--lib DIR ...] [--config <designConfig.xml>]
|
|
34
34
|
xactflow check <file.xml>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
`
|
|
37
|
+
`link` scans every `--lib` directory into a library indexed by VLNV, resolves `<design.xml>`
|
|
38
38
|
against it (component instances, bus interfaces, interconnections, monitor interconnections, ad
|
|
39
39
|
hoc connections), runs SCR checks on the result, prints every diagnostic, and exits nonzero if
|
|
40
40
|
any of them is an error.
|
|
@@ -70,16 +70,36 @@ a clean, expected rejection.
|
|
|
70
70
|
|
|
71
71
|
```python
|
|
72
72
|
import ipxact
|
|
73
|
-
from xactflow import Library,
|
|
73
|
+
from xactflow import Library, link
|
|
74
74
|
|
|
75
75
|
library = Library.scan("path/to/ip/library")
|
|
76
76
|
design = ipxact.parse_file("path/to/top_design.xml")
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
linked = link(design, library)
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
linked.instances # dict[str, LinkedInstance], keyed by instance name
|
|
81
|
+
linked.interconnections # list[LinkedInterconnection], every endpoint resolved
|
|
82
|
+
linked.diagnostics # list[Diagnostic] from every applicable SCR rule
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`Library.scan` raises `FileNotFoundError` or `NotADirectoryError`, for a scan root that
|
|
86
|
+
does not exist or is not a directory. A root from which no IEEE 1685-2022 document gets indexed,
|
|
87
|
+
and files in another IP-XACT version's namespace (e.g. 1685-2014), are only reported as
|
|
88
|
+
warnings in `library.diagnostics`, and the scan goes on. Documents that only exist in memory, such
|
|
89
|
+
as an importer's result, are indexed with `Library.add`, which runs the same checks as for a
|
|
90
|
+
scanned file:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
component = SomeImporter().import_(Path("ip.sv"))
|
|
94
|
+
library.add(component, path=Path("ip.sv")) # path is optional, it only records the origin.
|
|
95
|
+
library.add(component, replace=True) # Overwrite an existing entry instead.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
A single file picked by hand is indexed with `Library.add_file`, which applies the same namespace
|
|
99
|
+
filtering and checks as a scanned file and raises `FileNotFoundError` if the file does not exist:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
library.add_file("path/to/extra_component.xml")
|
|
83
103
|
```
|
|
84
104
|
|
|
85
105
|
## Expression evaluation
|
|
@@ -130,8 +150,8 @@ IP-XACT expression evaluation to have check logic; `xactflow.evaluate()` (see [E
|
|
|
130
150
|
evaluation](#expression-evaluation) above) now exists, but isn't wired into any of these rules
|
|
131
151
|
yet.
|
|
132
152
|
|
|
133
|
-
`SCR.run_single_doc_checks(document)` and `SCR.run_post_config_checks(
|
|
134
|
-
standalone functions independent of the
|
|
153
|
+
`SCR.run_single_doc_checks(document)` and `SCR.run_post_config_checks(linked)` are public,
|
|
154
|
+
standalone functions independent of the linker's internals, so any caller (including a
|
|
135
155
|
future exporter that itself emits IP-XACT) should re-run SCR checking on IP-XACT it produced, not
|
|
136
156
|
only on the input.
|
|
137
157
|
|
|
@@ -144,7 +164,7 @@ implemented in this repository:
|
|
|
144
164
|
- `xactflow.Exporter` (`xactflow.exporters` entry point group): turns some IP-XACT-flavored
|
|
145
165
|
Python object into an output artifact, e.g. RTL, documentation, or another IP-XACT file. Its
|
|
146
166
|
`export(subject, output_dir, **options)` method leaves `subject` deliberately untyped: it may
|
|
147
|
-
be
|
|
167
|
+
be a `LinkedDesign` (a fully resolved multi-instance design), a bare `ipxact.Component` or
|
|
148
168
|
`ipxact.Design`, or anything else a given exporter chooses to support.
|
|
149
169
|
Each exporter documents and checks what it actually accepts.
|
|
150
170
|
- `xactflow.Importer` (`xactflow.importers` entry point group): reads a non-IP-XACT source (a
|
|
@@ -168,11 +188,11 @@ html = "xactflow_html:HtmlExporter"
|
|
|
168
188
|
(see [Expression evaluation](#expression-evaluation) above) can compute a concrete value from
|
|
169
189
|
an `Expression` string, but nothing in `xactflow.SCR` calls it yet, so the
|
|
170
190
|
overlap/alignment/stride SCRs, from having real check logic.
|
|
171
|
-
- **No multi-level design hierarchy.** `
|
|
191
|
+
- **No multi-level design hierarchy.** `link()` resolves one `Design` flat, it does not
|
|
172
192
|
recurse into a design nested inside another design's hierarchy. It will be supported in the future.
|
|
173
|
-
- **No `DesignConfiguration` application.** A `DesignConfiguration` can be passed to `
|
|
193
|
+
- **No `DesignConfiguration` application.** A `DesignConfiguration` can be passed to `link()`
|
|
174
194
|
and its single-doc rules get checked, but nothing actually applies it yet.
|
|
175
|
-
- **Monitor interconnections and ad hoc connections resolve but aren't checked.** `
|
|
195
|
+
- **Monitor interconnections and ad hoc connections resolve but aren't checked.** `link()`
|
|
176
196
|
resolves both into the graph, but no SCR rule (Table B.4, or the ad hoc rules in B.2/B.6) has
|
|
177
197
|
check logic yet, so a broken monitor or ad hoc reference is silently dropped rather than
|
|
178
198
|
reported.
|
|
@@ -184,9 +204,9 @@ html = "xactflow_html:HtmlExporter"
|
|
|
184
204
|
- Wire `xactflow.evaluate()` into the overlap/alignment/stride SCR rules it was built to unblock.
|
|
185
205
|
- String expression and IP-XACT builtin function (`$ipxact_index_value()` and similar) support
|
|
186
206
|
in `xactflow.evaluate()`.
|
|
187
|
-
- Multi-level design hierarchy
|
|
207
|
+
- Multi-level design hierarchy linking.
|
|
188
208
|
- A better SCR coverage, especially for the single file and pre config ones.
|
|
189
|
-
- The actual exporter and importer plugin packages (
|
|
209
|
+
- The actual exporter and importer plugin packages (a linked design to RTL exporter, an IP-XACT-emitting
|
|
190
210
|
exporter (component & design), a SystemVerilog-with-metadata importer, etc.), each in its own repository per
|
|
191
211
|
[Plugins](#plugins) above.
|
|
192
212
|
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "xactflow"
|
|
7
7
|
dynamic = ["version"]
|
|
8
|
-
description = "Multi-file IP-XACT
|
|
8
|
+
description = "Multi-file IP-XACT linking and semantic consistency checking on top of ipxact-compiler."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "LGPL-3.0-only"
|
|
11
11
|
license-files = ["LICENSE"]
|
|
@@ -14,7 +14,7 @@ authors = [
|
|
|
14
14
|
]
|
|
15
15
|
requires-python = ">=3.9"
|
|
16
16
|
dependencies = [
|
|
17
|
-
"ipxact-compiler",
|
|
17
|
+
"ipxact-compiler>=0.1.2",
|
|
18
18
|
"lxml",
|
|
19
19
|
]
|
|
20
20
|
keywords = [
|
|
@@ -15,14 +15,14 @@ def run_single_doc_checks(document: object) -> List[Diagnostic]:
|
|
|
15
15
|
return diagnostics
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
def run_post_config_checks(
|
|
18
|
+
def run_post_config_checks(linked: object) -> List[Diagnostic]:
|
|
19
19
|
"""Run every SCR rule that needs the relationships between documents.
|
|
20
20
|
|
|
21
|
-
Takes
|
|
22
|
-
between xactflow.SCR and xactflow.
|
|
21
|
+
Takes a link.LinkedDesign (accepted as object here to avoid a circular import
|
|
22
|
+
between xactflow.SCR and xactflow.link, since link.resolver itself calls this).
|
|
23
23
|
"""
|
|
24
24
|
diagnostics: List[Diagnostic] = []
|
|
25
25
|
for r in all_rules():
|
|
26
26
|
if not r.single_doc_check:
|
|
27
|
-
diagnostics.extend(r.check(
|
|
27
|
+
diagnostics.extend(r.check(linked))
|
|
28
28
|
return diagnostics
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""IEEE 1685-2022 Annex B, Table B.1: Cross-references and VLNVs (43 rules, SCR 1.1-1.43).
|
|
2
2
|
|
|
3
|
-
SCR 1.2 and SCR 1.9 are implemented, exercised by
|
|
3
|
+
SCR 1.2 and SCR 1.9 are implemented, exercised by link.resolver. Every other rule in
|
|
4
4
|
this table is registered via stub() so it is tracked and discoverable through
|
|
5
5
|
SCR.all_rules(), with no check logic yet.
|
|
6
6
|
"""
|
|
@@ -13,7 +13,7 @@ from ..diagnostics import Diagnostic, Severity
|
|
|
13
13
|
from .registry import rule, stub
|
|
14
14
|
|
|
15
15
|
if TYPE_CHECKING:
|
|
16
|
-
from ..
|
|
16
|
+
from ..link.model import LinkedDesign
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
stub(
|
|
@@ -24,10 +24,10 @@ stub(
|
|
|
24
24
|
post_config=False,
|
|
25
25
|
description=(
|
|
26
26
|
"Every IP-XACT document visible to a tool at one time shall have a unique VLNV. "
|
|
27
|
-
"Enforced separately in xactflow.library.Library.
|
|
28
|
-
"
|
|
29
|
-
"single-document or single-
|
|
30
|
-
"discoverability via SCR.all_rules()."
|
|
27
|
+
"Enforced separately in xactflow.library.Library.add, which every document indexed in "
|
|
28
|
+
"a library goes through, since detecting a duplicate needs the whole set at once; not "
|
|
29
|
+
"expressible as a single-document or single-linked-design check, so this entry "
|
|
30
|
+
"exists only for discoverability via SCR.all_rules()."
|
|
31
31
|
),
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -43,15 +43,15 @@ stub(
|
|
|
43
43
|
"component."
|
|
44
44
|
),
|
|
45
45
|
)
|
|
46
|
-
def _check_component_ref_is_component(
|
|
47
|
-
for instance_ref in
|
|
48
|
-
resolved =
|
|
46
|
+
def _check_component_ref_is_component(linked: "LinkedDesign") -> Iterator[Diagnostic]:
|
|
47
|
+
for instance_ref in linked.design.component_instances:
|
|
48
|
+
resolved = linked.instances.get(instance_ref.instance_name)
|
|
49
49
|
# Identity, not just name presence: two componentInstance elements can share a name,
|
|
50
|
-
#
|
|
50
|
+
# linked.instances only has room for one entry per name.
|
|
51
51
|
if resolved is not None and resolved.source is instance_ref:
|
|
52
52
|
continue
|
|
53
53
|
vlnv = instance_ref.component_ref.vlnv
|
|
54
|
-
existing =
|
|
54
|
+
existing = linked.library.get(vlnv)
|
|
55
55
|
if existing is None:
|
|
56
56
|
detail = f"no document with VLNV {vlnv} was found in the library"
|
|
57
57
|
else:
|
|
@@ -62,7 +62,7 @@ def _check_component_ref_is_component(elaborated: "ElaboratedDesign") -> Iterato
|
|
|
62
62
|
f"resolve to a component: {detail}"
|
|
63
63
|
),
|
|
64
64
|
severity=Severity.ERROR,
|
|
65
|
-
location=f"{
|
|
65
|
+
location=f"{linked.vlnv}/{instance_ref.instance_name}",
|
|
66
66
|
rule_id="SCR 1.9",
|
|
67
67
|
rule_name="compRefVLNVisComp",
|
|
68
68
|
)
|
|
@@ -80,11 +80,11 @@ def _check_component_ref_is_component(elaborated: "ElaboratedDesign") -> Iterato
|
|
|
80
80
|
"for the busType and abstractionRef of every resolved instance's bus interfaces."
|
|
81
81
|
),
|
|
82
82
|
)
|
|
83
|
-
def _check_bus_interface_vlnv_refs_exist(
|
|
84
|
-
for instance in
|
|
83
|
+
def _check_bus_interface_vlnv_refs_exist(linked: "LinkedDesign") -> Iterator[Diagnostic]:
|
|
84
|
+
for instance in linked.instances.values():
|
|
85
85
|
for bus_interface in instance.component.bus_interfaces:
|
|
86
86
|
bus_vlnv = bus_interface.bus_type.vlnv
|
|
87
|
-
if
|
|
87
|
+
if linked.library.get_bus_definition(bus_vlnv) is None:
|
|
88
88
|
yield Diagnostic(
|
|
89
89
|
message=(
|
|
90
90
|
f"busInterface '{bus_interface.name}' busType references VLNV "
|
|
@@ -97,7 +97,7 @@ def _check_bus_interface_vlnv_refs_exist(elaborated: "ElaboratedDesign") -> Iter
|
|
|
97
97
|
)
|
|
98
98
|
for abstraction_type in bus_interface.abstraction_types:
|
|
99
99
|
abstraction_vlnv = abstraction_type.abstraction_ref.vlnv
|
|
100
|
-
if
|
|
100
|
+
if linked.library.get_abstraction_definition(abstraction_vlnv) is None:
|
|
101
101
|
yield Diagnostic(
|
|
102
102
|
message=(
|
|
103
103
|
f"busInterface '{bus_interface.name}' abstractionRef references "
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""IEEE 1685-2022 Annex B, Table B.2: Interconnections (19 rules, SCR 2.1-2.19).
|
|
2
2
|
|
|
3
|
-
SCR 2.1 through SCR 2.5 are implemented, exercised by
|
|
3
|
+
SCR 2.1 through SCR 2.5 are implemented, exercised by link.resolver. Every other rule
|
|
4
4
|
in this table is registered via stub() so it is tracked and discoverable through
|
|
5
5
|
SCR.all_rules(), with no check logic yet.
|
|
6
6
|
"""
|
|
@@ -15,7 +15,7 @@ from ..diagnostics import Diagnostic, Severity
|
|
|
15
15
|
from .registry import rule, stub
|
|
16
16
|
|
|
17
17
|
if TYPE_CHECKING:
|
|
18
|
-
from ..
|
|
18
|
+
from ..link.model import LinkedDesign, LinkedInstance, LinkedInterconnection, ResolvedInterfaceEndpoint
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def _active_interfaces(interconnection: ipxact.Interconnection) -> Iterator[ipxact.ActiveInterface]:
|
|
@@ -23,12 +23,12 @@ def _active_interfaces(interconnection: ipxact.Interconnection) -> Iterator[ipxa
|
|
|
23
23
|
yield from interconnection.other_active_interfaces
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def _find_bus_interface(instance: "
|
|
26
|
+
def _find_bus_interface(instance: "LinkedInstance", bus_ref: str):
|
|
27
27
|
return next((bi for bi in instance.component.bus_interfaces if bi.name == bus_ref), None)
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def _unordered_endpoint_pairs(
|
|
31
|
-
interconnection: "
|
|
31
|
+
interconnection: "LinkedInterconnection",
|
|
32
32
|
) -> Iterator[Tuple["ResolvedInterfaceEndpoint", "ResolvedInterfaceEndpoint"]]:
|
|
33
33
|
endpoints = interconnection.endpoints
|
|
34
34
|
for i in range(len(endpoints)):
|
|
@@ -68,10 +68,10 @@ def _bus_definitions_compatible(a: ipxact.VLNV, b: ipxact.VLNV, library) -> bool
|
|
|
68
68
|
"VLNV of the component instance named in componentInstanceRef."
|
|
69
69
|
),
|
|
70
70
|
)
|
|
71
|
-
def _check_active_interfaces_exist(
|
|
72
|
-
for interconnection in
|
|
71
|
+
def _check_active_interfaces_exist(linked: "LinkedDesign") -> Iterator[Diagnostic]:
|
|
72
|
+
for interconnection in linked.design.interconnections:
|
|
73
73
|
for active_interface in _active_interfaces(interconnection):
|
|
74
|
-
instance =
|
|
74
|
+
instance = linked.instances.get(active_interface.component_instance_ref)
|
|
75
75
|
if instance is None:
|
|
76
76
|
yield Diagnostic(
|
|
77
77
|
message=(
|
|
@@ -80,7 +80,7 @@ def _check_active_interfaces_exist(elaborated: "ElaboratedDesign") -> Iterator[D
|
|
|
80
80
|
f"does not resolve to a component instance"
|
|
81
81
|
),
|
|
82
82
|
severity=Severity.ERROR,
|
|
83
|
-
location=f"{
|
|
83
|
+
location=f"{linked.vlnv}/{interconnection.name}",
|
|
84
84
|
rule_id="SCR 2.1",
|
|
85
85
|
rule_name="connectedIntfsMustExist",
|
|
86
86
|
)
|
|
@@ -93,7 +93,7 @@ def _check_active_interfaces_exist(elaborated: "ElaboratedDesign") -> Iterator[D
|
|
|
93
93
|
f"component instance '{instance.instance_name}'"
|
|
94
94
|
),
|
|
95
95
|
severity=Severity.ERROR,
|
|
96
|
-
location=f"{
|
|
96
|
+
location=f"{linked.vlnv}/{interconnection.name}",
|
|
97
97
|
rule_id="SCR 2.1",
|
|
98
98
|
rule_name="connectedIntfsMustExist",
|
|
99
99
|
)
|
|
@@ -111,11 +111,11 @@ def _check_active_interfaces_exist(elaborated: "ElaboratedDesign") -> Iterator[D
|
|
|
111
111
|
"elements within the busInterface elements shall reference compatible busDefinitions."
|
|
112
112
|
),
|
|
113
113
|
)
|
|
114
|
-
def _check_interconnection_bus_compat(
|
|
115
|
-
for interconnection in
|
|
114
|
+
def _check_interconnection_bus_compat(linked: "LinkedDesign") -> Iterator[Diagnostic]:
|
|
115
|
+
for interconnection in linked.interconnections:
|
|
116
116
|
for a, b in _unordered_endpoint_pairs(interconnection):
|
|
117
117
|
if not _bus_definitions_compatible(
|
|
118
|
-
a.bus_interface.bus_type.vlnv, b.bus_interface.bus_type.vlnv,
|
|
118
|
+
a.bus_interface.bus_type.vlnv, b.bus_interface.bus_type.vlnv, linked.library
|
|
119
119
|
):
|
|
120
120
|
yield Diagnostic(
|
|
121
121
|
message=(
|
|
@@ -126,7 +126,7 @@ def _check_interconnection_bus_compat(elaborated: "ElaboratedDesign") -> Iterato
|
|
|
126
126
|
f"({b.bus_interface.bus_type.vlnv})"
|
|
127
127
|
),
|
|
128
128
|
severity=Severity.ERROR,
|
|
129
|
-
location=f"{
|
|
129
|
+
location=f"{linked.vlnv}/{interconnection.name}",
|
|
130
130
|
rule_id="SCR 2.2",
|
|
131
131
|
rule_name="connectedIntfsCompat",
|
|
132
132
|
)
|
|
@@ -176,9 +176,9 @@ def _check_interface_connected_once(document: object) -> Iterator[Diagnostic]:
|
|
|
176
176
|
"type target or mirrored-initiator, or hierarchical interfaces of type initiator."
|
|
177
177
|
),
|
|
178
178
|
)
|
|
179
|
-
def _check_active_initiator_connects(
|
|
179
|
+
def _check_active_initiator_connects(linked: "LinkedDesign") -> Iterator[Diagnostic]:
|
|
180
180
|
allowed = {ipxact.InterfaceMode.TARGET, ipxact.InterfaceMode.MIRRORED_INITIATOR}
|
|
181
|
-
for interconnection in
|
|
181
|
+
for interconnection in linked.interconnections:
|
|
182
182
|
for a, b in _unordered_endpoint_pairs(interconnection):
|
|
183
183
|
a_mode, b_mode = a.bus_interface.mode, b.bus_interface.mode
|
|
184
184
|
violated = (a_mode is ipxact.InterfaceMode.INITIATOR and b_mode not in allowed) or (
|
|
@@ -194,7 +194,7 @@ def _check_active_initiator_connects(elaborated: "ElaboratedDesign") -> Iterator
|
|
|
194
194
|
f"to target or mirroredInitiator interfaces"
|
|
195
195
|
),
|
|
196
196
|
severity=Severity.ERROR,
|
|
197
|
-
location=f"{
|
|
197
|
+
location=f"{linked.vlnv}/{interconnection.name}",
|
|
198
198
|
rule_id="SCR 2.4",
|
|
199
199
|
rule_name="activeMstConnect",
|
|
200
200
|
)
|
|
@@ -212,9 +212,9 @@ def _check_active_initiator_connects(elaborated: "ElaboratedDesign") -> Iterator
|
|
|
212
212
|
),
|
|
213
213
|
)
|
|
214
214
|
def _check_active_mirrored_target_connects(
|
|
215
|
-
|
|
215
|
+
linked: "LinkedDesign",
|
|
216
216
|
) -> Iterator[Diagnostic]:
|
|
217
|
-
for interconnection in
|
|
217
|
+
for interconnection in linked.interconnections:
|
|
218
218
|
for a, b in _unordered_endpoint_pairs(interconnection):
|
|
219
219
|
a_mode, b_mode = a.bus_interface.mode, b.bus_interface.mode
|
|
220
220
|
violated = (
|
|
@@ -234,7 +234,7 @@ def _check_active_mirrored_target_connects(
|
|
|
234
234
|
f"connect to target interfaces"
|
|
235
235
|
),
|
|
236
236
|
severity=Severity.ERROR,
|
|
237
|
-
location=f"{
|
|
237
|
+
location=f"{linked.vlnv}/{interconnection.name}",
|
|
238
238
|
rule_id="SCR 2.5",
|
|
239
239
|
rule_name="activeMSlvConnect",
|
|
240
240
|
)
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
(6 rules, SCR 4.1-4.6).
|
|
3
3
|
|
|
4
4
|
None of these are implemented yet; every rule is registered via stub() so it is tracked and
|
|
5
|
-
discoverable through SCR.all_rules().
|
|
6
|
-
interconnections into the
|
|
5
|
+
discoverable through SCR.all_rules(). link.resolver already resolves monitor
|
|
6
|
+
interconnections into the linked graph; these rules would check that resolved graph.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
from __future__ import annotations
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
None of these are implemented yet; every rule is registered via stub() so it is tracked and
|
|
4
4
|
discoverable through SCR.all_rules(). These need a "hierarchical family of bus interfaces"
|
|
5
|
-
concept (bus interfaces linked across nested designs) that
|
|
6
|
-
yet: it
|
|
5
|
+
concept (bus interfaces linked across nested designs) that link.resolver does not build
|
|
6
|
+
yet: it links one Design flat, with no recursion into sub-designs.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
from __future__ import annotations
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
None of these are implemented yet; every rule is registered via stub() so it is tracked and
|
|
4
4
|
discoverable through SCR.all_rules(). Same caveat as Table B.10: these need a hierarchical
|
|
5
|
-
family of bus interfaces concept
|
|
5
|
+
family of bus interfaces concept link.resolver does not build yet.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.2.0"
|
|
2
2
|
|
|
3
3
|
from . import SCR
|
|
4
4
|
from .diagnostics import Diagnostic, Severity
|
|
5
|
-
from .elaborate import (
|
|
6
|
-
ElaboratedDesign,
|
|
7
|
-
ElaboratedInstance,
|
|
8
|
-
ElaboratedInterconnection,
|
|
9
|
-
ElaboratedMonitorInterconnection,
|
|
10
|
-
ResolvedInterfaceEndpoint,
|
|
11
|
-
ResolvedPortReference,
|
|
12
|
-
elaborate,
|
|
13
|
-
)
|
|
14
5
|
from .exporter import Exporter, discover_exporters
|
|
15
6
|
from .expressions import ExpressionError, evaluate, parameter_resolver
|
|
16
7
|
from .importer import Importer, discover_importers
|
|
17
8
|
from .library import Library, LibraryEntry
|
|
9
|
+
from .link import (
|
|
10
|
+
LinkedDesign,
|
|
11
|
+
LinkedInstance,
|
|
12
|
+
LinkedInterconnection,
|
|
13
|
+
LinkedMonitorInterconnection,
|
|
14
|
+
ResolvedInterfaceEndpoint,
|
|
15
|
+
ResolvedPortReference,
|
|
16
|
+
link,
|
|
17
|
+
)
|
|
18
18
|
|
|
19
19
|
__all__ = [
|
|
20
20
|
"SCR",
|
|
21
21
|
"Diagnostic",
|
|
22
22
|
"Severity",
|
|
23
|
-
"ElaboratedDesign",
|
|
24
|
-
"ElaboratedInstance",
|
|
25
|
-
"ElaboratedInterconnection",
|
|
26
|
-
"ElaboratedMonitorInterconnection",
|
|
27
|
-
"ResolvedInterfaceEndpoint",
|
|
28
|
-
"ResolvedPortReference",
|
|
29
|
-
"elaborate",
|
|
30
23
|
"Exporter",
|
|
31
24
|
"discover_exporters",
|
|
32
25
|
"ExpressionError",
|
|
@@ -36,5 +29,12 @@ __all__ = [
|
|
|
36
29
|
"discover_importers",
|
|
37
30
|
"Library",
|
|
38
31
|
"LibraryEntry",
|
|
32
|
+
"LinkedDesign",
|
|
33
|
+
"LinkedInstance",
|
|
34
|
+
"LinkedInterconnection",
|
|
35
|
+
"LinkedMonitorInterconnection",
|
|
36
|
+
"ResolvedInterfaceEndpoint",
|
|
37
|
+
"ResolvedPortReference",
|
|
38
|
+
"link",
|
|
39
39
|
"__version__",
|
|
40
40
|
]
|