xactflow 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.
Files changed (45) hide show
  1. xactflow-0.1.0/LICENSE +164 -0
  2. xactflow-0.1.0/PKG-INFO +176 -0
  3. xactflow-0.1.0/README.md +148 -0
  4. xactflow-0.1.0/pyproject.toml +57 -0
  5. xactflow-0.1.0/setup.cfg +4 -0
  6. xactflow-0.1.0/src/xactflow/SCR/__init__.py +28 -0
  7. xactflow-0.1.0/src/xactflow/SCR/registry.py +89 -0
  8. xactflow-0.1.0/src/xactflow/SCR/runner.py +28 -0
  9. xactflow-0.1.0/src/xactflow/SCR/scr_01.py +597 -0
  10. xactflow-0.1.0/src/xactflow/SCR/scr_02.py +415 -0
  11. xactflow-0.1.0/src/xactflow/SCR/scr_03.py +243 -0
  12. xactflow-0.1.0/src/xactflow/SCR/scr_04.py +86 -0
  13. xactflow-0.1.0/src/xactflow/SCR/scr_05.py +333 -0
  14. xactflow-0.1.0/src/xactflow/SCR/scr_06.py +677 -0
  15. xactflow-0.1.0/src/xactflow/SCR/scr_07.py +320 -0
  16. xactflow-0.1.0/src/xactflow/SCR/scr_08.py +104 -0
  17. xactflow-0.1.0/src/xactflow/SCR/scr_09.py +99 -0
  18. xactflow-0.1.0/src/xactflow/SCR/scr_10.py +47 -0
  19. xactflow-0.1.0/src/xactflow/SCR/scr_11.py +46 -0
  20. xactflow-0.1.0/src/xactflow/SCR/scr_12.py +90 -0
  21. xactflow-0.1.0/src/xactflow/SCR/scr_13.py +54 -0
  22. xactflow-0.1.0/src/xactflow/SCR/scr_14.py +304 -0
  23. xactflow-0.1.0/src/xactflow/SCR/scr_15.py +36 -0
  24. xactflow-0.1.0/src/xactflow/__init__.py +36 -0
  25. xactflow-0.1.0/src/xactflow/cli.py +200 -0
  26. xactflow-0.1.0/src/xactflow/diagnostics.py +33 -0
  27. xactflow-0.1.0/src/xactflow/elaborate/__init__.py +19 -0
  28. xactflow-0.1.0/src/xactflow/elaborate/model.py +84 -0
  29. xactflow-0.1.0/src/xactflow/elaborate/resolver.py +164 -0
  30. xactflow-0.1.0/src/xactflow/exporter.py +67 -0
  31. xactflow-0.1.0/src/xactflow/importer.py +60 -0
  32. xactflow-0.1.0/src/xactflow/library.py +115 -0
  33. xactflow-0.1.0/src/xactflow/py.typed +0 -0
  34. xactflow-0.1.0/src/xactflow.egg-info/PKG-INFO +176 -0
  35. xactflow-0.1.0/src/xactflow.egg-info/SOURCES.txt +43 -0
  36. xactflow-0.1.0/src/xactflow.egg-info/dependency_links.txt +1 -0
  37. xactflow-0.1.0/src/xactflow.egg-info/entry_points.txt +2 -0
  38. xactflow-0.1.0/src/xactflow.egg-info/requires.txt +5 -0
  39. xactflow-0.1.0/src/xactflow.egg-info/top_level.txt +1 -0
  40. xactflow-0.1.0/tests/test_cli.py +192 -0
  41. xactflow-0.1.0/tests/test_exporter.py +91 -0
  42. xactflow-0.1.0/tests/test_importer.py +75 -0
  43. xactflow-0.1.0/tests/test_library.py +117 -0
  44. xactflow-0.1.0/tests/test_resolver.py +164 -0
  45. xactflow-0.1.0/tests/test_scr.py +257 -0
xactflow-0.1.0/LICENSE ADDED
@@ -0,0 +1,164 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ This version of the GNU Lesser General Public License incorporates
9
+ the terms and conditions of version 3 of the GNU General Public
10
+ License, supplemented by the additional permissions listed below.
11
+
12
+ 0. Additional Definitions.
13
+
14
+ As used herein, "this License" refers to version 3 of the GNU Lesser
15
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
16
+ General Public License.
17
+
18
+ "The Library" refers to a covered work governed by this License,
19
+ other than an Application or a Combined Work as defined below.
20
+
21
+ An "Application" is any work that makes use of an interface provided
22
+ by the Library, but which is not otherwise based on the Library.
23
+ Defining a subclass of a class defined by the Library is deemed a mode
24
+ of using an interface provided by the Library.
25
+
26
+ A "Combined Work" is a work produced by combining or linking an
27
+ Application with the Library. The particular version of the Library
28
+ with which the Combined Work was made is also called the "Linked
29
+ Version".
30
+
31
+ The "Minimal Corresponding Source" for a Combined Work means the
32
+ Corresponding Source for the Combined Work, excluding any source code
33
+ for portions of the Combined Work that, considered in isolation, are
34
+ based on the Application, and not on the Linked Version.
35
+
36
+ The "Corresponding Application Code" for a Combined Work means the
37
+ object code and/or source code for the Application, including any data
38
+ and utility programs needed for reproducing the Combined Work from the
39
+ Application, but excluding the System Libraries of the Combined Work.
40
+
41
+ 1. Exception to Section 3 of the GNU GPL.
42
+
43
+ You may convey a covered work under sections 3 and 4 of this License
44
+ without being bound by section 3 of the GNU GPL.
45
+
46
+ 2. Conveying Modified Versions.
47
+
48
+ If you modify a copy of the Library, and, in your modifications, a
49
+ facility refers to a function or data to be supplied by an Application
50
+ that uses the facility (other than as an argument passed when the
51
+ facility is invoked), then you may convey a copy of the modified
52
+ version:
53
+
54
+ a) under this License, provided that you make a good faith effort to
55
+ ensure that, in the event an Application does not supply the
56
+ function or data, the facility still operates, and performs
57
+ whatever part of its purpose remains meaningful, or
58
+
59
+ b) under the GNU GPL, with none of the additional permissions of
60
+ this License applicable to that copy.
61
+
62
+ 3. Object Code Incorporating Material from Library Header Files.
63
+
64
+ The object code form of an Application may incorporate material from
65
+ a header file that is part of the Library. You may convey such object
66
+ code under terms of your choice, provided that, if the incorporated
67
+ material is not limited to numerical parameters, data structure
68
+ layouts and accessors, or small macros, inline functions and templates
69
+ (ten or fewer lines in length), you do both of the following:
70
+
71
+ a) Give prominent notice with each copy of the object code that the
72
+ Library is used in it and that the Library and its use are
73
+ covered by this License.
74
+
75
+ b) Accompany the object code with a copy of the GNU GPL and this license
76
+ document.
77
+
78
+ 4. Combined Works.
79
+
80
+ You may convey a Combined Work under terms of your choice that,
81
+ taken together, effectively do not restrict modification of the
82
+ portions of the Library contained in the Combined Work and reverse
83
+ engineering for debugging such modifications, if you also do each of
84
+ the following:
85
+
86
+ a) Give prominent notice with each copy of the Combined Work that
87
+ the Library is used in it and that the Library and its use are
88
+ covered by this License.
89
+
90
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
91
+ document.
92
+
93
+ c) For a Combined Work that displays copyright notices during
94
+ execution, include the copyright notice for the Library among
95
+ these notices, as well as a reference directing the user to the
96
+ copies of the GNU GPL and this license document.
97
+
98
+ d) Do one of the following:
99
+
100
+ 0) Convey the Minimal Corresponding Source under the terms of this
101
+ License, and the Corresponding Application Code in a form
102
+ suitable for, and under terms that permit, the user to
103
+ recombine or relink the Application with a modified version of
104
+ the Linked Version to produce a modified Combined Work, in the
105
+ manner specified by section 6 of the GNU GPL for conveying
106
+ Corresponding Source.
107
+
108
+ 1) Use a suitable shared library mechanism for linking with the
109
+ Library. A suitable mechanism is one that (a) uses at run time
110
+ a copy of the Library already present on the user's computer
111
+ system, and (b) will operate properly with a modified version
112
+ of the Library that is interface-compatible with the Linked
113
+ Version.
114
+
115
+ e) Provide Installation Information, but only if you would otherwise
116
+ be required to provide such information under section 6 of the
117
+ GNU GPL, and only to the extent that such information is
118
+ necessary to install and execute a modified version of the
119
+ Combined Work produced by recombining or relinking the
120
+ Application with a modified version of the Linked Version. (If
121
+ you use option 4d0, the Installation Information must accompany
122
+ the Minimal Corresponding Source and Corresponding Application
123
+ Code. If you use option 4d1, you must provide the Installation
124
+ Information in the manner specified by section 6 of the GNU GPL
125
+ for conveying Corresponding Source.)
126
+
127
+ 5. Combined Libraries.
128
+
129
+ You may place library facilities that are a work based on the
130
+ Library side by side in a single library together with other library
131
+ facilities that are not Applications and are not covered by this
132
+ License, and convey such a combined library under terms of your
133
+ choice, if you do both of the following:
134
+
135
+ a) Accompany the combined library with a copy of the same work based
136
+ on the Library, uncombined with any other library facilities,
137
+ conveyed under the terms of this License.
138
+
139
+ b) Give prominent notice with the combined library that part of it
140
+ is a work based on the Library, and explaining where to find the
141
+ accompanying uncombined form of the same work.
142
+
143
+ 6. Revised Versions of the GNU Lesser General Public License.
144
+
145
+ The Free Software Foundation may publish revised and/or new versions
146
+ of the GNU Lesser General Public License from time to time. Such new
147
+ versions will be similar in spirit to the present version, but may
148
+ differ in detail to address new problems or concerns.
149
+
150
+ Each version is given a distinguishing version number. If the
151
+ Library as you received it specifies that a certain numbered version
152
+ of the GNU Lesser General Public License "or any later version"
153
+ applies to it, you have the option of following the terms and
154
+ conditions either of that published version or of any later version
155
+ published by the Free Software Foundation. If the Library as you
156
+ received it does not specify a version number of the GNU Lesser
157
+ General Public License, you may choose any version of the GNU Lesser
158
+ General Public License ever published by the Free Software Foundation.
159
+
160
+ If the Library as you received it specifies that a proxy can decide
161
+ whether future versions of the GNU Lesser General Public License shall
162
+ apply, that proxy's public statement of acceptance of any version is
163
+ permanent authorization for you to choose that version for the
164
+ Library.
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: xactflow
3
+ Version: 0.1.0
4
+ Summary: Multi-file IP-XACT elaboration and semantic consistency checking on top of ipxact-compiler.
5
+ Author: Maxime Travaillard
6
+ License-Expression: LGPL-3.0-only
7
+ Project-URL: Repository, https://github.com/IP-XACT/XactFlow
8
+ Project-URL: Issues, https://github.com/IP-XACT/XactFlow/issues
9
+ Keywords: IP-XACT,IEEE 1685,XML,Compiler,XactFlow
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: ipxact-compiler
24
+ Requires-Dist: lxml
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # XactFlow
30
+
31
+ Multi-file [IEEE 1685-2022](https://standards.ieee.org/ieee/1685/10307/) IP-XACT elaboration
32
+ and semantic consistency checking, built on top of
33
+ [`ipxact-compiler`](https://github.com/IP-XACT/ipxact-compiler) (a standalone single-file
34
+ IP-XACT parser).
35
+
36
+ `ipxact-compiler` parses one IP-XACT XML document into a Python object model and stops there,
37
+ no cross-file resolution, no validation or further checking.
38
+ XactFlow is what consumes those parsed objects to do the higher-level work: resolving a
39
+ `Design` (and its component instances, bus interfaces, and interconnections) against a library
40
+ of `Component`/`BusDefinition`/`AbstractionDefinition` files into one combined, navigable
41
+ object graph, and checking that graph against IP-XACT Semantic Consistency Rules (SCRs).
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ pip install xactflow
47
+ ```
48
+
49
+ For local development, `requirements-dev.txt` overrides ipxact-compiler to a local installation.
50
+ It can be modified to adapt the path or to keep the version on PyPI.
51
+
52
+ ```bash
53
+ pip install -r requirements-dev.txt -e .
54
+ ```
55
+
56
+ Requires Python >= 3.9.
57
+
58
+ ## CLI
59
+
60
+ ```bash
61
+ xactflow elaborate <design.xml> [--lib DIR ...] [--config <designConfig.xml>]
62
+ xactflow check <file.xml>
63
+ ```
64
+
65
+ `elaborate` scans every `--lib` directory into a library indexed by VLNV, resolves `<design.xml>`
66
+ against it (component instances, bus interfaces, interconnections, monitor interconnections, ad
67
+ hoc connections), runs SCR checks on the result, prints every diagnostic, and exits nonzero if
68
+ any of them is an error.
69
+
70
+ `check` runs only the SCR rules that are checkable on a single document (no library needed) and
71
+ is useful for validating one file in isolation, e.g. as a pre-commit or CI step.
72
+
73
+ Installed exporter and importer plugins each become their own top-level subcommand
74
+ automatically, named after whatever entry point name they registered under
75
+ (`xactflow.exporters` / `xactflow.importers`), e.g. `xactflow html design.xml -o docs/` once a
76
+ package like that is installed. XactFlow itself ships no exporters or importers; see
77
+ [Plugins](#plugins) below.
78
+
79
+ ## Library usage
80
+
81
+ ```python
82
+ import ipxact
83
+ from xactflow import Library, elaborate
84
+
85
+ library = Library.scan("path/to/ip/library")
86
+ design = ipxact.parse_file("path/to/top_design.xml")
87
+
88
+ elaborated = elaborate(design, library)
89
+
90
+ elaborated.instances # dict[str, ElaboratedInstance], keyed by instance name
91
+ elaborated.interconnections # list[ElaboratedInterconnection], every endpoint resolved
92
+ elaborated.diagnostics # list[Diagnostic] from every applicable SCR rule
93
+ ```
94
+
95
+ ## Semantic Consistency Rules (SCR)
96
+
97
+ IEEE 1685-2022's Annex B defines 281 SCRs across 15 tables, each independently tagged
98
+ `single doc check` (checkable on one document alone) and `post config` (only applies once
99
+ configuration has been completed). Every one of them is registered in `xactflow.SCR`, one module
100
+ per table (`SCR/scr_01.py` through `SCR/scr_15.py`), so the full set is always discoverable:
101
+
102
+ ```python
103
+ from xactflow import SCR
104
+
105
+ len(SCR.all_rules()) # 281
106
+ [r.id for r in SCR.all_rules() if r.implemented] # currently implemented: SCR 1.2, 1.9, 2.1-2.5
107
+ ```
108
+
109
+ A rule with `implemented=False` is registered (id, name, table, the two flags, and the rule text
110
+ as its description) but its check always reports nothing; that's a deliberate placeholder, not a
111
+ bug, tracking Annex B's full rule set ahead of writing the check logic for each one. Table B.14
112
+ (expressions) and most of the overlap/alignment rules in Tables B.7-B.9 additionally need real
113
+ IP-XACT expression evaluation, which neither `ipxact-compiler` nor XactFlow implements yet
114
+ (`Expression` fields are unevaluated strings in the object model).
115
+
116
+ `SCR.run_single_doc_checks(document)` and `SCR.run_post_config_checks(elaborated)` are public,
117
+ standalone functions independent of the elaborator's internals, so any caller (including a
118
+ future exporter that itself emits IP-XACT) should re-run SCR checking on IP-XACT it produced, not
119
+ only on the input.
120
+
121
+ ## Plugins
122
+
123
+ XactFlow defines two plugin interfaces, both discovered via
124
+ [entry points](https://packaging.python.org/en/latest/specifications/entry-points/), neither
125
+ implemented in this repository:
126
+
127
+ - `xactflow.Exporter` (`xactflow.exporters` entry point group): turns some IP-XACT-flavored
128
+ Python object into an output artifact, e.g. RTL, documentation, or another IP-XACT file. Its
129
+ `export(subject, output_dir, **options)` method leaves `subject` deliberately untyped: it may
130
+ be an `ElaboratedDesign` (a fully resolved multi-instance design), a bare `ipxact.Component` or
131
+ `ipxact.Design`, or anything else a given exporter chooses to support.
132
+ Each exporter documents and checks what it actually accepts.
133
+ - `xactflow.Importer` (`xactflow.importers` entry point group): reads a non-IP-XACT source (a
134
+ custom design description, an annotated SystemVerilog file, etc.) and produces an IP-XACT
135
+ object model instance from it.
136
+
137
+ A package that generates IP-XACT itself (from a hand-built object model, or as an importer's
138
+ downstream step) is still just an `Exporter` writing its own XML; that capability lives in its
139
+ own package rather than in `ipxact-compiler` or XactFlow.
140
+
141
+ A plugin package registers itself in its own `pyproject.toml`:
142
+
143
+ ```toml
144
+ [project.entry-points."xactflow.exporters"]
145
+ html = "xactflow_html:HtmlExporter"
146
+ ```
147
+
148
+ ## Known limitations
149
+
150
+ - **No IP-XACT expression evaluation.** `addressOffset`, `size`, `range`, `width`, `bitOffset`,
151
+ and similar fields are unevaluated `str` in the object model (`ipxact-compiler`'s deliberate
152
+ choice, carried through here). This blocks most of the overlap/alignment/stride SCRs,
153
+ from having real check logic yet.
154
+ - **No multi-level design hierarchy.** `elaborate()` resolves one `Design` flat, it does not
155
+ recurse into a design nested inside another design's hierarchy. It will be supported in the future.
156
+ - **No `DesignConfiguration` application.** A `DesignConfiguration` can be passed to `elaborate()`
157
+ and its single-doc rules get checked, but nothing actually applies it yet.
158
+ - **Monitor interconnections and ad hoc connections resolve but aren't checked.** `elaborate()`
159
+ resolves both into the graph, but no SCR rule (Table B.4, or the ad hoc rules in B.2/B.6) has
160
+ check logic yet, so a broken monitor or ad hoc reference is silently dropped rather than
161
+ reported.
162
+ - **274 of 281 SCR rules have no check logic.** See [Semantic Consistency
163
+ Rules](#semantic-consistency-rules-scr) above.
164
+
165
+ ## Ideas for later
166
+
167
+ - Real IP-XACT expression evaluation.
168
+ - Multi-level design hierarchy elaboration.
169
+ - A better SCR coverage, especially for the single file and pre config ones.
170
+ - The actual exporter and importer plugin packages (an elaborated design to RTL exporter, an IP-XACT-emitting
171
+ exporter (component & design), a SystemVerilog-with-metadata importer, etc.), each in its own repository per
172
+ [Plugins](#plugins) above.
173
+
174
+ ## License
175
+
176
+ LGPL-3.0. See [LICENSE](LICENSE).
@@ -0,0 +1,148 @@
1
+ # XactFlow
2
+
3
+ Multi-file [IEEE 1685-2022](https://standards.ieee.org/ieee/1685/10307/) IP-XACT elaboration
4
+ and semantic consistency checking, built on top of
5
+ [`ipxact-compiler`](https://github.com/IP-XACT/ipxact-compiler) (a standalone single-file
6
+ IP-XACT parser).
7
+
8
+ `ipxact-compiler` parses one IP-XACT XML document into a Python object model and stops there,
9
+ no cross-file resolution, no validation or further checking.
10
+ XactFlow is what consumes those parsed objects to do the higher-level work: resolving a
11
+ `Design` (and its component instances, bus interfaces, and interconnections) against a library
12
+ of `Component`/`BusDefinition`/`AbstractionDefinition` files into one combined, navigable
13
+ object graph, and checking that graph against IP-XACT Semantic Consistency Rules (SCRs).
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install xactflow
19
+ ```
20
+
21
+ For local development, `requirements-dev.txt` overrides ipxact-compiler to a local installation.
22
+ It can be modified to adapt the path or to keep the version on PyPI.
23
+
24
+ ```bash
25
+ pip install -r requirements-dev.txt -e .
26
+ ```
27
+
28
+ Requires Python >= 3.9.
29
+
30
+ ## CLI
31
+
32
+ ```bash
33
+ xactflow elaborate <design.xml> [--lib DIR ...] [--config <designConfig.xml>]
34
+ xactflow check <file.xml>
35
+ ```
36
+
37
+ `elaborate` scans every `--lib` directory into a library indexed by VLNV, resolves `<design.xml>`
38
+ against it (component instances, bus interfaces, interconnections, monitor interconnections, ad
39
+ hoc connections), runs SCR checks on the result, prints every diagnostic, and exits nonzero if
40
+ any of them is an error.
41
+
42
+ `check` runs only the SCR rules that are checkable on a single document (no library needed) and
43
+ is useful for validating one file in isolation, e.g. as a pre-commit or CI step.
44
+
45
+ Installed exporter and importer plugins each become their own top-level subcommand
46
+ automatically, named after whatever entry point name they registered under
47
+ (`xactflow.exporters` / `xactflow.importers`), e.g. `xactflow html design.xml -o docs/` once a
48
+ package like that is installed. XactFlow itself ships no exporters or importers; see
49
+ [Plugins](#plugins) below.
50
+
51
+ ## Library usage
52
+
53
+ ```python
54
+ import ipxact
55
+ from xactflow import Library, elaborate
56
+
57
+ library = Library.scan("path/to/ip/library")
58
+ design = ipxact.parse_file("path/to/top_design.xml")
59
+
60
+ elaborated = elaborate(design, library)
61
+
62
+ elaborated.instances # dict[str, ElaboratedInstance], keyed by instance name
63
+ elaborated.interconnections # list[ElaboratedInterconnection], every endpoint resolved
64
+ elaborated.diagnostics # list[Diagnostic] from every applicable SCR rule
65
+ ```
66
+
67
+ ## Semantic Consistency Rules (SCR)
68
+
69
+ IEEE 1685-2022's Annex B defines 281 SCRs across 15 tables, each independently tagged
70
+ `single doc check` (checkable on one document alone) and `post config` (only applies once
71
+ configuration has been completed). Every one of them is registered in `xactflow.SCR`, one module
72
+ per table (`SCR/scr_01.py` through `SCR/scr_15.py`), so the full set is always discoverable:
73
+
74
+ ```python
75
+ from xactflow import SCR
76
+
77
+ len(SCR.all_rules()) # 281
78
+ [r.id for r in SCR.all_rules() if r.implemented] # currently implemented: SCR 1.2, 1.9, 2.1-2.5
79
+ ```
80
+
81
+ A rule with `implemented=False` is registered (id, name, table, the two flags, and the rule text
82
+ as its description) but its check always reports nothing; that's a deliberate placeholder, not a
83
+ bug, tracking Annex B's full rule set ahead of writing the check logic for each one. Table B.14
84
+ (expressions) and most of the overlap/alignment rules in Tables B.7-B.9 additionally need real
85
+ IP-XACT expression evaluation, which neither `ipxact-compiler` nor XactFlow implements yet
86
+ (`Expression` fields are unevaluated strings in the object model).
87
+
88
+ `SCR.run_single_doc_checks(document)` and `SCR.run_post_config_checks(elaborated)` are public,
89
+ standalone functions independent of the elaborator's internals, so any caller (including a
90
+ future exporter that itself emits IP-XACT) should re-run SCR checking on IP-XACT it produced, not
91
+ only on the input.
92
+
93
+ ## Plugins
94
+
95
+ XactFlow defines two plugin interfaces, both discovered via
96
+ [entry points](https://packaging.python.org/en/latest/specifications/entry-points/), neither
97
+ implemented in this repository:
98
+
99
+ - `xactflow.Exporter` (`xactflow.exporters` entry point group): turns some IP-XACT-flavored
100
+ Python object into an output artifact, e.g. RTL, documentation, or another IP-XACT file. Its
101
+ `export(subject, output_dir, **options)` method leaves `subject` deliberately untyped: it may
102
+ be an `ElaboratedDesign` (a fully resolved multi-instance design), a bare `ipxact.Component` or
103
+ `ipxact.Design`, or anything else a given exporter chooses to support.
104
+ Each exporter documents and checks what it actually accepts.
105
+ - `xactflow.Importer` (`xactflow.importers` entry point group): reads a non-IP-XACT source (a
106
+ custom design description, an annotated SystemVerilog file, etc.) and produces an IP-XACT
107
+ object model instance from it.
108
+
109
+ A package that generates IP-XACT itself (from a hand-built object model, or as an importer's
110
+ downstream step) is still just an `Exporter` writing its own XML; that capability lives in its
111
+ own package rather than in `ipxact-compiler` or XactFlow.
112
+
113
+ A plugin package registers itself in its own `pyproject.toml`:
114
+
115
+ ```toml
116
+ [project.entry-points."xactflow.exporters"]
117
+ html = "xactflow_html:HtmlExporter"
118
+ ```
119
+
120
+ ## Known limitations
121
+
122
+ - **No IP-XACT expression evaluation.** `addressOffset`, `size`, `range`, `width`, `bitOffset`,
123
+ and similar fields are unevaluated `str` in the object model (`ipxact-compiler`'s deliberate
124
+ choice, carried through here). This blocks most of the overlap/alignment/stride SCRs,
125
+ from having real check logic yet.
126
+ - **No multi-level design hierarchy.** `elaborate()` resolves one `Design` flat, it does not
127
+ recurse into a design nested inside another design's hierarchy. It will be supported in the future.
128
+ - **No `DesignConfiguration` application.** A `DesignConfiguration` can be passed to `elaborate()`
129
+ and its single-doc rules get checked, but nothing actually applies it yet.
130
+ - **Monitor interconnections and ad hoc connections resolve but aren't checked.** `elaborate()`
131
+ resolves both into the graph, but no SCR rule (Table B.4, or the ad hoc rules in B.2/B.6) has
132
+ check logic yet, so a broken monitor or ad hoc reference is silently dropped rather than
133
+ reported.
134
+ - **274 of 281 SCR rules have no check logic.** See [Semantic Consistency
135
+ Rules](#semantic-consistency-rules-scr) above.
136
+
137
+ ## Ideas for later
138
+
139
+ - Real IP-XACT expression evaluation.
140
+ - Multi-level design hierarchy elaboration.
141
+ - A better SCR coverage, especially for the single file and pre config ones.
142
+ - The actual exporter and importer plugin packages (an elaborated design to RTL exporter, an IP-XACT-emitting
143
+ exporter (component & design), a SystemVerilog-with-metadata importer, etc.), each in its own repository per
144
+ [Plugins](#plugins) above.
145
+
146
+ ## License
147
+
148
+ LGPL-3.0. See [LICENSE](LICENSE).
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "xactflow"
7
+ dynamic = ["version"]
8
+ description = "Multi-file IP-XACT elaboration and semantic consistency checking on top of ipxact-compiler."
9
+ readme = "README.md"
10
+ license = "LGPL-3.0-only"
11
+ license-files = ["LICENSE"]
12
+ authors = [
13
+ { name = "Maxime Travaillard"},
14
+ ]
15
+ requires-python = ">=3.9"
16
+ dependencies = [
17
+ "ipxact-compiler",
18
+ "lxml",
19
+ ]
20
+ keywords = [
21
+ "IP-XACT", "IEEE 1685", "XML", "Compiler",
22
+ "XactFlow",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 3 - Alpha",
26
+ "Programming Language :: Python :: 3",
27
+ "Programming Language :: Python :: 3 :: Only",
28
+ "Programming Language :: Python :: 3.9",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Programming Language :: Python :: 3.14",
34
+ "Topic :: Scientific/Engineering",
35
+ ]
36
+
37
+ [project.urls]
38
+ Repository = "https://github.com/IP-XACT/XactFlow"
39
+ Issues = "https://github.com/IP-XACT/XactFlow/issues"
40
+
41
+
42
+ [project.optional-dependencies]
43
+ dev = [
44
+ "pytest",
45
+ ]
46
+
47
+ [project.scripts]
48
+ xactflow = "xactflow.cli:main"
49
+
50
+ [tool.setuptools.dynamic]
51
+ version = {attr = "xactflow.__version__"}
52
+
53
+ [tool.setuptools.packages.find]
54
+ where = ["src"]
55
+
56
+ [tool.setuptools.package-data]
57
+ xactflow = ["py.typed"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,28 @@
1
+ from . import ( # noqa: F401 (registers every Annex B rule as an import side effect)
2
+ scr_01,
3
+ scr_02,
4
+ scr_03,
5
+ scr_04,
6
+ scr_05,
7
+ scr_06,
8
+ scr_07,
9
+ scr_08,
10
+ scr_09,
11
+ scr_10,
12
+ scr_11,
13
+ scr_12,
14
+ scr_13,
15
+ scr_14,
16
+ scr_15,
17
+ )
18
+ from .registry import Rule, all_rules, rule, stub
19
+ from .runner import run_post_config_checks, run_single_doc_checks
20
+
21
+ __all__ = [
22
+ "Rule",
23
+ "all_rules",
24
+ "rule",
25
+ "stub",
26
+ "run_post_config_checks",
27
+ "run_single_doc_checks",
28
+ ]
@@ -0,0 +1,89 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Callable, Iterator, List
5
+
6
+ from ..diagnostics import Diagnostic
7
+
8
+
9
+ @dataclass(frozen=True)
10
+ class Rule:
11
+ """One IEEE 1685-2022 Annex B semantic consistency rule (SCR)."""
12
+
13
+ id: str
14
+ table: str
15
+ name: str
16
+ single_doc_check: bool
17
+ post_config: bool
18
+ description: str
19
+ check: Callable[[object], Iterator[Diagnostic]]
20
+ implemented: bool
21
+
22
+
23
+ _REGISTRY: List[Rule] = []
24
+
25
+
26
+ def rule(
27
+ *,
28
+ id: str,
29
+ table: str,
30
+ name: str,
31
+ single_doc_check: bool,
32
+ post_config: bool,
33
+ description: str,
34
+ ) -> Callable[[Callable[[object], Iterator[Diagnostic]]], Callable[[object], Iterator[Diagnostic]]]:
35
+ """Decorator registering a check function as one working Annex B SCR rule."""
36
+
37
+ def decorator(
38
+ check: Callable[[object], Iterator[Diagnostic]]
39
+ ) -> Callable[[object], Iterator[Diagnostic]]:
40
+ _REGISTRY.append(
41
+ Rule(
42
+ id=id,
43
+ table=table,
44
+ name=name,
45
+ single_doc_check=single_doc_check,
46
+ post_config=post_config,
47
+ description=description,
48
+ check=check,
49
+ implemented=True,
50
+ )
51
+ )
52
+ return check
53
+
54
+ return decorator
55
+
56
+
57
+ def _not_yet_implemented(_subject: object) -> Iterator[Diagnostic]:
58
+ return []
59
+
60
+
61
+ def stub(
62
+ *,
63
+ id: str,
64
+ table: str,
65
+ name: str,
66
+ single_doc_check: bool,
67
+ post_config: bool,
68
+ description: str,
69
+ ) -> None:
70
+ """Register an Annex B rule that is tracked (discoverable via all_rules()) but has no check
71
+ logic implemented yet. Its check always reports nothing; `implemented` is False so callers
72
+ can tell it apart from a working rule registered through @rule.
73
+ """
74
+ _REGISTRY.append(
75
+ Rule(
76
+ id=id,
77
+ table=table,
78
+ name=name,
79
+ single_doc_check=single_doc_check,
80
+ post_config=post_config,
81
+ description=description,
82
+ check=_not_yet_implemented,
83
+ implemented=False,
84
+ )
85
+ )
86
+
87
+
88
+ def all_rules() -> List[Rule]:
89
+ return list(_REGISTRY)