pyVHDLModel 0.40.0rc2__tar.gz → 0.41.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 (41) hide show
  1. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/PKG-INFO +23 -23
  2. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Association.py +46 -6
  3. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Base.py +279 -10
  4. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Common.py +171 -14
  5. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Concurrent.py +353 -37
  6. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Configuration.py +127 -9
  7. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Declaration.py +88 -4
  8. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/DesignUnit.py +201 -13
  9. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Exception.py +269 -2
  10. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Expression.py +330 -61
  11. pyvhdlmodel-0.41.0/pyVHDLModel/Formatting/VHDL.py +4058 -0
  12. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/IEEE.py +10 -10
  13. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Instantiation.py +44 -2
  14. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Interface.py +923 -16
  15. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Name.py +14 -10
  16. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Namespace.py +2 -2
  17. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Object.py +100 -9
  18. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Predefined.py +2 -1
  19. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Regions.py +429 -34
  20. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/STD.py +18 -17
  21. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Sequential.py +431 -37
  22. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Subprogram.py +168 -17
  23. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Symbol.py +180 -9
  24. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Type.py +259 -14
  25. pyvhdlmodel-0.41.0/pyVHDLModel/Visitor.py +3007 -0
  26. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/__init__.py +659 -125
  27. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel.egg-info/PKG-INFO +23 -23
  28. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel.egg-info/requires.txt +22 -22
  29. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyproject.toml +2 -2
  30. pyvhdlmodel-0.40.0rc2/pyVHDLModel/Formatting/VHDL.py +0 -998
  31. pyvhdlmodel-0.40.0rc2/pyVHDLModel/Visitor.py +0 -749
  32. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/LICENSE.md +0 -0
  33. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/README.md +0 -0
  34. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/Formatting/__init__.py +0 -0
  35. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/PSLModel.py +0 -0
  36. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel/py.typed +0 -0
  37. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel.egg-info/SOURCES.txt +0 -0
  38. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel.egg-info/dependency_links.txt +0 -0
  39. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/pyVHDLModel.egg-info/top_level.txt +0 -0
  40. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/setup.cfg +0 -0
  41. {pyvhdlmodel-0.40.0rc2 → pyvhdlmodel-0.41.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyVHDLModel
3
- Version: 0.40.0rc2
3
+ Version: 0.41.0
4
4
  Summary: An abstract VHDL language model.
5
5
  Home-page: https://GitHub.com/VHDL/pyVHDLModel
6
6
  Author: Patrick Lehmann
@@ -26,45 +26,45 @@ Classifier: Development Status :: 4 - Beta
26
26
  Requires-Python: >=3.11
27
27
  Description-Content-Type: text/markdown
28
28
  License-File: LICENSE.md
29
- Requires-Dist: pyTooling<11.0,>=10.0.0rc6
29
+ Requires-Dist: pyTooling<11.0,>=10.1.1
30
30
  Provides-Extra: doc
31
- Requires-Dist: sphinx_rtd_theme~=3.1; extra == "doc"
31
+ Requires-Dist: sphinx~=9.2; extra == "doc"
32
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
33
+ Requires-Dist: autoapi>=2.0.1; extra == "doc"
32
34
  Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "doc"
33
35
  Requires-Dist: sphinx-copybutton>=0.5.2; extra == "doc"
34
- Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
35
- Requires-Dist: pyTooling<11.0,>=10.0.0rc6; extra == "doc"
36
- Requires-Dist: pyTooling.Sphinx[reports]~=0.1.0rc5; extra == "doc"
36
+ Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "doc"
37
+ Requires-Dist: sphinx_rtd_theme~=3.1; extra == "doc"
37
38
  Requires-Dist: sphinx_design~=0.7.0; extra == "doc"
38
- Requires-Dist: autoapi>=2.0.1; extra == "doc"
39
+ Requires-Dist: pyTooling<11.0,>=10.1.1; extra == "doc"
39
40
  Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "doc"
40
- Requires-Dist: sphinx~=9.1; extra == "doc"
41
41
  Provides-Extra: test
42
- Requires-Dist: Coverage~=7.16; extra == "test"
43
- Requires-Dist: typing_extensions~=4.16; extra == "test"
42
+ Requires-Dist: pytest-xdist~=3.8; extra == "test"
44
43
  Requires-Dist: lxml<7.0,>=6.1.3; extra == "test"
44
+ Requires-Dist: Coverage~=7.17; extra == "test"
45
45
  Requires-Dist: pytest-cov~=7.1; extra == "test"
46
- Requires-Dist: pyTooling<11.0,>=10.0.0rc6; extra == "test"
47
- Requires-Dist: pytest-xdist~=3.8; extra == "test"
48
- Requires-Dist: pytest~=9.1; extra == "test"
49
46
  Requires-Dist: mypy[reports]~=2.4; extra == "test"
47
+ Requires-Dist: pyTooling<11.0,>=10.1.1; extra == "test"
48
+ Requires-Dist: typing_extensions~=4.16; extra == "test"
49
+ Requires-Dist: pytest~=9.1; extra == "test"
50
50
  Provides-Extra: all
51
- Requires-Dist: sphinx_rtd_theme~=3.1; extra == "all"
51
+ Requires-Dist: sphinx~=9.2; extra == "all"
52
+ Requires-Dist: mypy[reports]~=2.4; extra == "all"
53
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "all"
54
+ Requires-Dist: autoapi>=2.0.1; extra == "all"
55
+ Requires-Dist: pytest-xdist~=3.8; extra == "all"
52
56
  Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "all"
53
- Requires-Dist: Coverage~=7.16; extra == "all"
54
- Requires-Dist: typing_extensions~=4.16; extra == "all"
55
57
  Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
56
58
  Requires-Dist: lxml<7.0,>=6.1.3; extra == "all"
57
- Requires-Dist: docutils_stubs~=0.0.22; extra == "all"
59
+ Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "all"
60
+ Requires-Dist: Coverage~=7.17; extra == "all"
58
61
  Requires-Dist: pytest-cov~=7.1; extra == "all"
59
- Requires-Dist: pyTooling<11.0,>=10.0.0rc6; extra == "all"
60
- Requires-Dist: pyTooling.Sphinx[reports]~=0.1.0rc5; extra == "all"
62
+ Requires-Dist: sphinx_rtd_theme~=3.1; extra == "all"
61
63
  Requires-Dist: sphinx_design~=0.7.0; extra == "all"
62
- Requires-Dist: autoapi>=2.0.1; extra == "all"
63
- Requires-Dist: pytest-xdist~=3.8; extra == "all"
64
+ Requires-Dist: pyTooling<11.0,>=10.1.1; extra == "all"
65
+ Requires-Dist: typing_extensions~=4.16; extra == "all"
64
66
  Requires-Dist: pytest~=9.1; extra == "all"
65
67
  Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "all"
66
- Requires-Dist: sphinx~=9.1; extra == "all"
67
- Requires-Dist: mypy[reports]~=2.4; extra == "all"
68
68
  Dynamic: author
69
69
  Dynamic: author-email
70
70
  Dynamic: classifier
@@ -43,8 +43,8 @@ from pyTooling.Decorators import export, readonly
43
43
  from pyTooling.MetaClasses import ExtendedType, abstractclass
44
44
 
45
45
  from pyVHDLModel.Base import ModelEntity
46
- from pyVHDLModel.Exception import AlreadyInDesignError, NotAChildError, AssociationOrderError
47
- from pyVHDLModel.Exception import DuplicateGenericAssociationError, DuplicatePortAssociationError
46
+ from pyVHDLModel.Exception import AlreadyInDesignError, NotAChildError, AssociationOrderError, \
47
+ DuplicateGenericAssociationError, DuplicatePortAssociationError
48
48
  from pyVHDLModel.Name import Name, SimpleName
49
49
  from pyVHDLModel.Symbol import Symbol
50
50
  from pyVHDLModel.Expression import BaseExpression, QualifiedExpression, FunctionCall, TypeConversion, Literal
@@ -203,10 +203,10 @@ class GenericMapAspectMixin(metaclass=ExtendedType, mixin=True):
203
203
 
204
204
  :param genericAssociationItems: List of all generic associations.
205
205
  """
206
- self._genericAssociationItems = []
206
+ self._genericAssociationItems = genericAssociationItemList = []
207
207
  if genericAssociationItems is not None:
208
208
  for association in genericAssociationItems:
209
- self._genericAssociationItems.append(association)
209
+ genericAssociationItemList.append(association)
210
210
  association.Parent = self
211
211
 
212
212
  @readonly
@@ -218,6 +218,26 @@ class GenericMapAspectMixin(metaclass=ExtendedType, mixin=True):
218
218
  """
219
219
  return self._genericAssociationItems
220
220
 
221
+ def _VisitGenericMapAspect(self, visitor: Visitor) -> None:
222
+ """
223
+ Walk the generic map aspect, if there are generic associations, with a visitor.
224
+
225
+ The associations are separated by commas.
226
+
227
+ :param visitor: The visitor receiving the events.
228
+ """
229
+ if len(self._genericAssociationItems) == 0:
230
+ return
231
+
232
+ visitor.VisitGenericMapAspect(self)
233
+ for index, item in enumerate(self._genericAssociationItems):
234
+ if index > 0:
235
+ visitor.VisitAssociationListSeparator(self)
236
+
237
+ item.Visit(visitor)
238
+
239
+ visitor.DepartGenericMapAspect(self)
240
+
221
241
  def AddGenericAssociationItem(self, genericAssociationItem: GenericAssociationItem) -> None:
222
242
  """
223
243
  Add a generic association at the end of the generic map aspect.
@@ -413,10 +433,10 @@ class PortMapAspectMixin(metaclass=ExtendedType, mixin=True):
413
433
 
414
434
  :param portAssociationItems: List of all port associations.
415
435
  """
416
- self._portAssociationItems = []
436
+ self._portAssociationItems = portAssociationItemList = []
417
437
  if portAssociationItems is not None:
418
438
  for association in portAssociationItems:
419
- self._portAssociationItems.append(association)
439
+ portAssociationItemList.append(association)
420
440
  association.Parent = self
421
441
 
422
442
  @readonly
@@ -428,6 +448,26 @@ class PortMapAspectMixin(metaclass=ExtendedType, mixin=True):
428
448
  """
429
449
  return self._portAssociationItems
430
450
 
451
+ def _VisitPortMapAspect(self, visitor: Visitor) -> None:
452
+ """
453
+ Walk the port map aspect, if there are port associations, with a visitor.
454
+
455
+ The associations are separated by commas.
456
+
457
+ :param visitor: The visitor receiving the events.
458
+ """
459
+ if len(self._portAssociationItems) == 0:
460
+ return
461
+
462
+ visitor.VisitPortMapAspect(self)
463
+ for index, item in enumerate(self._portAssociationItems):
464
+ if index > 0:
465
+ visitor.VisitAssociationListSeparator(self)
466
+
467
+ item.Visit(visitor)
468
+
469
+ visitor.DepartPortMapAspect(self)
470
+
431
471
  def AddPortAssociationItem(self, portAssociationItem: PortAssociationItem) -> None:
432
472
  """
433
473
  Add a port association at the end of the port map aspect.
@@ -37,14 +37,15 @@ Base-classes for the VHDL language model.
37
37
  from __future__ import annotations
38
38
 
39
39
  from enum import unique, Enum
40
- from typing import TYPE_CHECKING, Type, Iterable, Optional as Nullable, Union, cast, Self
40
+ from typing import TYPE_CHECKING, ClassVar, Type, Iterable, Optional as Nullable, Union, cast, Self
41
41
 
42
- from pyTooling.Common import getFullyQualifiedName
42
+ from pyTooling.Common import StringEnum, getFullyQualifiedName
43
43
  from pyTooling.Decorators import export, notimplemented, readonly
44
44
  from pyTooling.MetaClasses import ExtendedType, abstractclass
45
45
  if TYPE_CHECKING:
46
- from pyVHDLModel.Symbol import Symbol
47
- from pyVHDLModel.Visitor import Visitor
46
+ from pyVHDLModel.Interface import SingleDeclarationMixin
47
+ from pyVHDLModel.Symbol import Symbol
48
+ from pyVHDLModel.Visitor import Visitor
48
49
 
49
50
 
50
51
  __all__ = ["ExpressionUnion", "ModelElementUnion"]
@@ -66,6 +67,141 @@ A model element a visitor walks or the VHDL writer writes: a :class:`ModelEntity
66
67
  """
67
68
 
68
69
 
70
+ @export
71
+ @unique
72
+ class ReservedWord(StringEnum):
73
+ """
74
+ A ``ReservedWord`` is an enumeration of VHDL's reserved words (IEEE Std 1076-2019, 15.10).
75
+
76
+ A member is a :class:`str`: its value is the reserved word in lower case, e.g. ``ReservedWord.DownTo == "downto"``.
77
+ The VHDL writer (:mod:`pyVHDLModel.Formatting.VHDL`) applies the configured keyword case to it.
78
+
79
+ Each member states the revision of IEEE Std 1076 that first reserved it. Earlier revisions reserved words, which
80
+ VHDL-2019 doesn't: ``procedural`` and ``reference`` (VHDL-2000 and VHDL-2002), ``assume_guarantee`` and
81
+ ``restrict_guarantee`` (VHDL-2008).
82
+ """
83
+
84
+ Abs = "abs" #: Reserved word since VHDL-87.
85
+ Access = "access" #: Reserved word since VHDL-87.
86
+ After = "after" #: Reserved word since VHDL-87.
87
+ Alias = "alias" #: Reserved word since VHDL-87.
88
+ All = "all" #: Reserved word since VHDL-87.
89
+ And = "and" #: Reserved word since VHDL-87.
90
+ Architecture = "architecture" #: Reserved word since VHDL-87.
91
+ Array = "array" #: Reserved word since VHDL-87.
92
+ Assert = "assert" #: Reserved word since VHDL-87.
93
+ Assume = "assume" #: Reserved word since VHDL-2008.
94
+ Attribute = "attribute" #: Reserved word since VHDL-87.
95
+ Begin = "begin" #: Reserved word since VHDL-87.
96
+ Block = "block" #: Reserved word since VHDL-87.
97
+ Body = "body" #: Reserved word since VHDL-87.
98
+ Buffer = "buffer" #: Reserved word since VHDL-87.
99
+ Bus = "bus" #: Reserved word since VHDL-87.
100
+ Case = "case" #: Reserved word since VHDL-87.
101
+ Component = "component" #: Reserved word since VHDL-87.
102
+ Configuration = "configuration" #: Reserved word since VHDL-87.
103
+ Constant = "constant" #: Reserved word since VHDL-87.
104
+ Context = "context" #: Reserved word since VHDL-2008.
105
+ Cover = "cover" #: Reserved word since VHDL-2008.
106
+ Default = "default" #: Reserved word since VHDL-2008.
107
+ Disconnect = "disconnect" #: Reserved word since VHDL-87.
108
+ DownTo = "downto" #: Reserved word since VHDL-87.
109
+ Else = "else" #: Reserved word since VHDL-87.
110
+ ElsIf = "elsif" #: Reserved word since VHDL-87.
111
+ End = "end" #: Reserved word since VHDL-87.
112
+ Entity = "entity" #: Reserved word since VHDL-87.
113
+ Exit = "exit" #: Reserved word since VHDL-87.
114
+ Fairness = "fairness" #: Reserved word since VHDL-2008.
115
+ File = "file" #: Reserved word since VHDL-87.
116
+ For = "for" #: Reserved word since VHDL-87.
117
+ Force = "force" #: Reserved word since VHDL-2008.
118
+ Function = "function" #: Reserved word since VHDL-87.
119
+ Generate = "generate" #: Reserved word since VHDL-87.
120
+ Generic = "generic" #: Reserved word since VHDL-87.
121
+ Group = "group" #: Reserved word since VHDL-93.
122
+ Guarded = "guarded" #: Reserved word since VHDL-87.
123
+ If = "if" #: Reserved word since VHDL-87.
124
+ Impure = "impure" #: Reserved word since VHDL-93.
125
+ In = "in" #: Reserved word since VHDL-87.
126
+ Inertial = "inertial" #: Reserved word since VHDL-93.
127
+ InOut = "inout" #: Reserved word since VHDL-87.
128
+ Is = "is" #: Reserved word since VHDL-87.
129
+ Label = "label" #: Reserved word since VHDL-87.
130
+ Library = "library" #: Reserved word since VHDL-87.
131
+ Linkage = "linkage" #: Reserved word since VHDL-87.
132
+ Literal = "literal" #: Reserved word since VHDL-93.
133
+ Loop = "loop" #: Reserved word since VHDL-87.
134
+ Map = "map" #: Reserved word since VHDL-87.
135
+ Mod = "mod" #: Reserved word since VHDL-87.
136
+ Nand = "nand" #: Reserved word since VHDL-87.
137
+ New = "new" #: Reserved word since VHDL-87.
138
+ Next = "next" #: Reserved word since VHDL-87.
139
+ Nor = "nor" #: Reserved word since VHDL-87.
140
+ Not = "not" #: Reserved word since VHDL-87.
141
+ Null = "null" #: Reserved word since VHDL-87.
142
+ Of = "of" #: Reserved word since VHDL-87.
143
+ On = "on" #: Reserved word since VHDL-87.
144
+ Open = "open" #: Reserved word since VHDL-87.
145
+ Or = "or" #: Reserved word since VHDL-87.
146
+ Others = "others" #: Reserved word since VHDL-87.
147
+ Out = "out" #: Reserved word since VHDL-87.
148
+ Package = "package" #: Reserved word since VHDL-87.
149
+ Parameter = "parameter" #: Reserved word since VHDL-2008.
150
+ Port = "port" #: Reserved word since VHDL-87.
151
+ Postponed = "postponed" #: Reserved word since VHDL-93.
152
+ Private = "private" #: Reserved word since VHDL-2019.
153
+ Procedure = "procedure" #: Reserved word since VHDL-87.
154
+ Process = "process" #: Reserved word since VHDL-87.
155
+ Property = "property" #: Reserved word since VHDL-2008.
156
+ Protected = "protected" #: Reserved word since VHDL-2000.
157
+ Pure = "pure" #: Reserved word since VHDL-93.
158
+ Range = "range" #: Reserved word since VHDL-87.
159
+ Record = "record" #: Reserved word since VHDL-87.
160
+ Register = "register" #: Reserved word since VHDL-87.
161
+ Reject = "reject" #: Reserved word since VHDL-93.
162
+ Release = "release" #: Reserved word since VHDL-2008.
163
+ Rem = "rem" #: Reserved word since VHDL-87.
164
+ Report = "report" #: Reserved word since VHDL-87.
165
+ Restrict = "restrict" #: Reserved word since VHDL-2008.
166
+ Return = "return" #: Reserved word since VHDL-87.
167
+ Rol = "rol" #: Reserved word since VHDL-93.
168
+ Ror = "ror" #: Reserved word since VHDL-93.
169
+ Select = "select" #: Reserved word since VHDL-87.
170
+ Sequence = "sequence" #: Reserved word since VHDL-2008.
171
+ Severity = "severity" #: Reserved word since VHDL-87.
172
+ Shared = "shared" #: Reserved word since VHDL-93.
173
+ Signal = "signal" #: Reserved word since VHDL-87.
174
+ Sla = "sla" #: Reserved word since VHDL-93.
175
+ Sll = "sll" #: Reserved word since VHDL-93.
176
+ Sra = "sra" #: Reserved word since VHDL-93.
177
+ Srl = "srl" #: Reserved word since VHDL-93.
178
+ Strong = "strong" #: Reserved word since VHDL-2008.
179
+ Subtype = "subtype" #: Reserved word since VHDL-87.
180
+ Then = "then" #: Reserved word since VHDL-87.
181
+ To = "to" #: Reserved word since VHDL-87.
182
+ Transport = "transport" #: Reserved word since VHDL-87.
183
+ Type = "type" #: Reserved word since VHDL-87.
184
+ Unaffected = "unaffected" #: Reserved word since VHDL-93.
185
+ Units = "units" #: Reserved word since VHDL-87.
186
+ Until = "until" #: Reserved word since VHDL-87.
187
+ Use = "use" #: Reserved word since VHDL-87.
188
+ Variable = "variable" #: Reserved word since VHDL-87.
189
+ View = "view" #: Reserved word since VHDL-2019.
190
+ VMode = "vmode" #: Reserved word since VHDL-2008.
191
+ VPkg = "vpkg" #: Reserved word since VHDL-2019.
192
+ VProp = "vprop" #: Reserved word since VHDL-2008.
193
+ VUnit = "vunit" #: Reserved word since VHDL-2008.
194
+ Wait = "wait" #: Reserved word since VHDL-87.
195
+ When = "when" #: Reserved word since VHDL-87.
196
+ While = "while" #: Reserved word since VHDL-87.
197
+ With = "with" #: Reserved word since VHDL-87.
198
+ Xnor = "xnor" #: Reserved word since VHDL-93.
199
+ Xor = "xor" #: Reserved word since VHDL-87.
200
+
201
+
202
+ _ReservedWord = ReservedWord #: Alias of :class:`ReservedWord` for annotations in classes with a property of that name.
203
+
204
+
69
205
  @export
70
206
  @unique
71
207
  class Direction(Enum):
@@ -74,6 +210,20 @@ class Direction(Enum):
74
210
  To = 0 #: Ascending direction
75
211
  DownTo = 1 #: Descending direction
76
212
 
213
+ __RESERVED_WORDS: ClassVar[dict[int, _ReservedWord]] = {
214
+ 0: _ReservedWord.To,
215
+ 1: _ReservedWord.DownTo
216
+ } #: The reserved word of each direction, by value.
217
+
218
+ @readonly
219
+ def ReservedWord(self) -> _ReservedWord:
220
+ """
221
+ Read-only property to return the reserved word of the direction.
222
+
223
+ :returns: The reserved word, ``to`` or ``downto``.
224
+ """
225
+ return self.__RESERVED_WORDS[self.value]
226
+
77
227
  def __str__(self) -> str:
78
228
  """
79
229
  Formats the direction to ``to`` or ``downto``.
@@ -100,6 +250,23 @@ class Mode(Enum):
100
250
  Buffer = 4 #: Buffered output
101
251
  Linkage = 5 #: undocumented
102
252
 
253
+ __RESERVED_WORDS: ClassVar[dict[int, _ReservedWord]] = {
254
+ 1: _ReservedWord.In,
255
+ 2: _ReservedWord.Out,
256
+ 3: _ReservedWord.InOut,
257
+ 4: _ReservedWord.Buffer,
258
+ 5: _ReservedWord.Linkage
259
+ } #: The reserved word of each mode, by value; ``Default`` has none.
260
+
261
+ @readonly
262
+ def ReservedWord(self) -> Nullable[_ReservedWord]:
263
+ """
264
+ Read-only property to return the reserved word of the mode.
265
+
266
+ :returns: The reserved word, or ``None`` for ``Mode.Default``.
267
+ """
268
+ return self.__RESERVED_WORDS.get(self.value, None)
269
+
103
270
  def __str__(self) -> str:
104
271
  """
105
272
  Formats the mode.
@@ -282,7 +449,11 @@ class OptionallyNamedEntityMixin(metaclass=ExtendedType, mixin=True):
282
449
 
283
450
 
284
451
  @export
285
- class MultipleNamedEntityMixin(metaclass=ExtendedType, mixin=True):
452
+ class MultipleNamedEntityMixin(
453
+ metaclass=ExtendedType,
454
+ mixin=True,
455
+ expects=("_parent", "Copy", "_SplitInParent")
456
+ ):
286
457
  """
287
458
  A ``MultipleNamedEntityMixin`` is a mixin class for all VHDL entities that declare multiple instances at once by
288
459
  defining multiple identifiers.
@@ -290,6 +461,10 @@ class MultipleNamedEntityMixin(metaclass=ExtendedType, mixin=True):
290
461
  Protected variables :attr:`_identifiers` and :attr:`_normalizedIdentifiers` are available to derived classes as well
291
462
  as two readonly properties :attr:`Identifiers` and :attr:`NormalizedIdentifiers` for public access.
292
463
 
464
+ The host class provides ``Copy()`` and ``_SplitInParent()``, called by :meth:`Split`: the latter calls the parent's
465
+ mutator splitting the declaration, e.g.
466
+ :meth:`DeclarationRegionMixin.SplitDeclaredItem <pyVHDLModel.Regions.DeclarationRegionMixin.SplitDeclaredItem>`.
467
+
293
468
  .. seealso::
294
469
 
295
470
  * :class:`Mode view element <pyVHDLModel.Interface.ModeViewElement>`
@@ -297,17 +472,19 @@ class MultipleNamedEntityMixin(metaclass=ExtendedType, mixin=True):
297
472
  * :class:`Record type element <pyVHDLModel.Type.RecordTypeElement>`
298
473
  """
299
474
 
300
- _identifiers: tuple[str] #: A list of identifiers.
301
- _normalizedIdentifiers: tuple[str] #: A list of normalized (lower case) identifiers.
475
+ _identifiers: tuple[str] #: A list of identifiers.
476
+ _normalizedIdentifiers: tuple[str] #: A list of normalized (lower case) identifiers.
477
+ _singleDeclarations: Nullable[list[SingleDeclarationMixin]] #: Cached single declarations, or ``None``.
302
478
 
303
479
  def __init__(self, identifiers: Iterable[str]) -> None:
304
480
  """
305
- Initializes a multiple-named entity.
481
+ Initializes a multiple-named entity without single declarations yet.
306
482
 
307
483
  :param identifiers: Sequence of identifiers (names) of the model entity.
308
484
  """
309
485
  self._identifiers = tuple(identifiers)
310
486
  self._normalizedIdentifiers = tuple([identifier.lower() for identifier in self._identifiers])
487
+ self._singleDeclarations = None
311
488
 
312
489
  @readonly
313
490
  def Identifiers(self) -> tuple[str]:
@@ -327,6 +504,61 @@ class MultipleNamedEntityMixin(metaclass=ExtendedType, mixin=True):
327
504
  """
328
505
  return self._normalizedIdentifiers
329
506
 
507
+ def Split(self) -> tuple[Self, ...]:
508
+ """
509
+ Split this declaration into one declaration per identifier.
510
+
511
+ IEEE Std 1076 defines a declaration with an identifier list as equivalent to a sequence of single declarations,
512
+ one per identifier, in list order: ``signal a, b : bit;`` declares the same as ``signal a : bit; signal b : bit;``.
513
+ This declaration keeps its first identifier. For every other identifier, a new declaration is created by
514
+ ``Copy()``: it has its own copy of the subtype indication and of the default expression, and the same
515
+ documentation. Single declarations created before are dropped.
516
+
517
+ Without a parent, the new declarations have no parent either: the caller places them. With a parent, the parent's
518
+ mutator splits the declaration and inserts the new declarations right after it, e.g.
519
+ :meth:`WithPortsMixin.SplitPortItem <pyVHDLModel.Regions.WithPortsMixin.SplitPortItem>` for a port.
520
+
521
+ A declaration with one identifier is unchanged.
522
+
523
+ :returns: Tuple of declarations, one per identifier in list order, starting with this
524
+ declaration.
525
+ :raises NotAChildError: If this declaration's parent doesn't list it.
526
+ :raises NotInNamespaceError: If the parent is an indexed declarative region, and an identifier of this declaration
527
+ refers to another element, e.g. a duplicate declaration.
528
+ """
529
+ if self._parent is not None:
530
+ return self._SplitInParent()
531
+ elif len(self._identifiers) == 1:
532
+ return (self, )
533
+
534
+ declarations = self._SplitCopies()
535
+ self._KeepIdentifier(0)
536
+ return (self, *declarations)
537
+
538
+ def _SplitCopies(self) -> list[Self]:
539
+ """
540
+ Create one parentless copy of this declaration per identifier after the first, each keeping its identifier.
541
+
542
+ :returns: List of new declarations, in list order.
543
+ """
544
+ declarations = []
545
+ for position in range(1, len(self._identifiers)):
546
+ declaration = self.Copy()
547
+ declaration._KeepIdentifier(position)
548
+ declarations.append(declaration)
549
+
550
+ return declarations
551
+
552
+ def _KeepIdentifier(self, position: int) -> None:
553
+ """
554
+ Reduce the identifier list to the identifier at a position and drop the single declarations.
555
+
556
+ :param position: The position of the identifier to keep.
557
+ """
558
+ self._identifiers = (self._identifiers[position], )
559
+ self._normalizedIdentifiers = (self._normalizedIdentifiers[position], )
560
+ self._singleDeclarations = None
561
+
330
562
 
331
563
  @export
332
564
  def identifiersOf(item) -> tuple[str, ...]:
@@ -626,6 +858,20 @@ class ReportStatementMixin(metaclass=ExtendedType, mixin=True):
626
858
  if severity is not None:
627
859
  severity.Parent = self
628
860
 
861
+ def _VisitReportAndSeverity(self, visitor: Visitor) -> None:
862
+ """
863
+ Walk the message and the severity, if given, each after its reserved word, with a visitor.
864
+
865
+ :param visitor: The visitor receiving the events.
866
+ """
867
+ if self._message is not None:
868
+ visitor.VisitReport(self)
869
+ self._message.Visit(visitor)
870
+
871
+ if self._severity is not None:
872
+ visitor.VisitSeverity(self)
873
+ self._severity.Visit(visitor)
874
+
629
875
  @readonly
630
876
  def Message(self) -> Nullable[ExpressionUnion]:
631
877
  """
@@ -667,6 +913,15 @@ class AssertStatementMixin(ReportStatementMixin, ConditionalMixin, mixin=True):
667
913
  super().__init__(message, severity)
668
914
  ConditionalMixin.__init__(self, condition)
669
915
 
916
+ def _VisitAssertion(self, visitor: Visitor) -> None:
917
+ """
918
+ Walk the condition, the message and the severity of an assertion with a visitor.
919
+
920
+ :param visitor: The visitor receiving the events.
921
+ """
922
+ self._condition.Visit(visitor)
923
+ self._VisitReportAndSeverity(visitor)
924
+
670
925
 
671
926
  class BlockStatementMixin(metaclass=ExtendedType, mixin=True):
672
927
  """
@@ -735,10 +990,10 @@ class ChoicesMixin(metaclass=ExtendedType, mixin=True):
735
990
 
736
991
  :param choices: List of all choices selecting this alternative.
737
992
  """
738
- self._choices = []
993
+ self._choices = choiceList = []
739
994
  if choices is not None:
740
995
  for choice in choices:
741
- self._choices.append(choice)
996
+ choiceList.append(choice)
742
997
  choice.Parent = self
743
998
 
744
999
  @readonly
@@ -973,6 +1228,20 @@ class WaveformElement(ModelEntity):
973
1228
  if after is not None:
974
1229
  after.Parent = self
975
1230
 
1231
+ def Visit(self, visitor: Visitor) -> None:
1232
+ """
1233
+ Walk this waveform element, its value and its delay (if any) with a visitor.
1234
+
1235
+ :param visitor: The visitor receiving the events.
1236
+ """
1237
+ visitor.VisitWaveformElement(self)
1238
+ self._expression.Visit(visitor)
1239
+ if self._after is not None:
1240
+ visitor.VisitAfter(self)
1241
+ self._after.Visit(visitor)
1242
+
1243
+ visitor.DepartWaveformElement(self)
1244
+
976
1245
  @readonly
977
1246
  def Expression(self) -> ExpressionUnion:
978
1247
  """