pyVHDLModel 0.41.0__tar.gz → 0.43.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.
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/PKG-INFO +25 -25
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Association.py +4 -4
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Base.py +174 -36
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Common.py +32 -22
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Concurrent.py +311 -146
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Configuration.py +27 -16
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Declaration.py +149 -10
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/DesignUnit.py +298 -108
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Exception.py +1201 -185
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Expression.py +82 -29
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Formatting/VHDL.py +12 -13
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/IEEE.py +17 -8
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Instantiation.py +108 -27
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Interface.py +303 -155
- pyvhdlmodel-0.43.0/pyVHDLModel/Name.py +988 -0
- pyvhdlmodel-0.43.0/pyVHDLModel/Namespace.py +857 -0
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Object.py +82 -20
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/PSLModel.py +2 -1
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Predefined.py +16 -6
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Regions.py +1177 -241
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/STD.py +17 -10
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Sequential.py +336 -147
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Subprogram.py +221 -105
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Symbol.py +242 -140
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Type.py +423 -71
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Visitor.py +4 -4
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/__init__.py +973 -597
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel.egg-info/PKG-INFO +25 -25
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel.egg-info/requires.txt +24 -24
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyproject.toml +1 -1
- pyvhdlmodel-0.41.0/pyVHDLModel/Name.py +0 -558
- pyvhdlmodel-0.41.0/pyVHDLModel/Namespace.py +0 -461
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/LICENSE.md +0 -0
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/README.md +0 -0
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/Formatting/__init__.py +0 -0
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel/py.typed +0 -0
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel.egg-info/SOURCES.txt +0 -0
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel.egg-info/dependency_links.txt +0 -0
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/pyVHDLModel.egg-info/top_level.txt +0 -0
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/setup.cfg +0 -0
- {pyvhdlmodel-0.41.0 → pyvhdlmodel-0.43.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyVHDLModel
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.43.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.
|
|
29
|
+
Requires-Dist: pyTooling<11.0,>=10.2.0
|
|
30
30
|
Provides-Extra: doc
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
|
|
33
|
-
Requires-Dist: autoapi>=2.0.1; extra == "doc"
|
|
31
|
+
Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "doc"
|
|
34
32
|
Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "doc"
|
|
35
33
|
Requires-Dist: sphinx-copybutton>=0.5.2; extra == "doc"
|
|
36
|
-
Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "doc"
|
|
37
|
-
Requires-Dist: sphinx_rtd_theme~=3.1; extra == "doc"
|
|
38
34
|
Requires-Dist: sphinx_design~=0.7.0; extra == "doc"
|
|
39
|
-
Requires-Dist:
|
|
35
|
+
Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
|
|
36
|
+
Requires-Dist: sphinx~=9.2; extra == "doc"
|
|
40
37
|
Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "doc"
|
|
38
|
+
Requires-Dist: sphinx_rtd_theme~=3.1; extra == "doc"
|
|
39
|
+
Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "doc"
|
|
40
|
+
Requires-Dist: autoapi>=2.0.1; extra == "doc"
|
|
41
41
|
Provides-Extra: test
|
|
42
|
-
Requires-Dist: pytest-xdist~=3.8; extra == "test"
|
|
43
|
-
Requires-Dist: lxml<7.0,>=6.1.3; extra == "test"
|
|
44
42
|
Requires-Dist: Coverage~=7.17; extra == "test"
|
|
43
|
+
Requires-Dist: typing_extensions~=4.16; extra == "test"
|
|
45
44
|
Requires-Dist: pytest-cov~=7.1; extra == "test"
|
|
45
|
+
Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "test"
|
|
46
|
+
Requires-Dist: pytest-xdist~=3.8; extra == "test"
|
|
46
47
|
Requires-Dist: mypy[reports]~=2.4; extra == "test"
|
|
47
|
-
Requires-Dist:
|
|
48
|
-
Requires-Dist:
|
|
49
|
-
Requires-Dist: pytest~=9.1; extra == "test"
|
|
48
|
+
Requires-Dist: pytest~=9.2; extra == "test"
|
|
49
|
+
Requires-Dist: lxml<7.0,>=6.1.3; extra == "test"
|
|
50
50
|
Provides-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"
|
|
56
|
-
Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "all"
|
|
57
|
-
Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
|
|
58
|
-
Requires-Dist: lxml<7.0,>=6.1.3; extra == "all"
|
|
59
51
|
Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "all"
|
|
52
|
+
Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "all"
|
|
60
53
|
Requires-Dist: Coverage~=7.17; extra == "all"
|
|
54
|
+
Requires-Dist: typing_extensions~=4.16; extra == "all"
|
|
55
|
+
Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
|
|
61
56
|
Requires-Dist: pytest-cov~=7.1; extra == "all"
|
|
57
|
+
Requires-Dist: docutils_stubs~=0.0.22; extra == "all"
|
|
58
|
+
Requires-Dist: sphinx~=9.2; extra == "all"
|
|
59
|
+
Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "all"
|
|
62
60
|
Requires-Dist: sphinx_rtd_theme~=3.1; extra == "all"
|
|
61
|
+
Requires-Dist: autoapi>=2.0.1; extra == "all"
|
|
62
|
+
Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "all"
|
|
63
|
+
Requires-Dist: pytest-xdist~=3.8; extra == "all"
|
|
64
|
+
Requires-Dist: mypy[reports]~=2.4; extra == "all"
|
|
65
|
+
Requires-Dist: pytest~=9.2; extra == "all"
|
|
66
|
+
Requires-Dist: lxml<7.0,>=6.1.3; extra == "all"
|
|
63
67
|
Requires-Dist: sphinx_design~=0.7.0; extra == "all"
|
|
64
|
-
Requires-Dist: pyTooling<11.0,>=10.1.1; extra == "all"
|
|
65
|
-
Requires-Dist: typing_extensions~=4.16; extra == "all"
|
|
66
|
-
Requires-Dist: pytest~=9.1; extra == "all"
|
|
67
|
-
Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "all"
|
|
68
68
|
Dynamic: author
|
|
69
69
|
Dynamic: author-email
|
|
70
70
|
Dynamic: classifier
|
|
@@ -68,8 +68,7 @@ class AssociationItem(ModelEntity):
|
|
|
68
68
|
"""
|
|
69
69
|
A base-class for all association items.
|
|
70
70
|
|
|
71
|
-
The association item is the parent of its formal and its actual, if they are model entities
|
|
72
|
-
:class:`~pyVHDLModel.Symbol.Symbol` has no parent.
|
|
71
|
+
The association item is the parent of its formal and its actual, if they are model entities.
|
|
73
72
|
|
|
74
73
|
.. seealso::
|
|
75
74
|
|
|
@@ -201,7 +200,8 @@ class GenericMapAspectMixin(metaclass=ExtendedType, mixin=True):
|
|
|
201
200
|
"""
|
|
202
201
|
Initializes a generic map aspect.
|
|
203
202
|
|
|
204
|
-
:param genericAssociationItems:
|
|
203
|
+
:param genericAssociationItems: Optional, list of all generic associations.
|
|
204
|
+
Default: ``None``, no generic associations.
|
|
205
205
|
"""
|
|
206
206
|
self._genericAssociationItems = genericAssociationItemList = []
|
|
207
207
|
if genericAssociationItems is not None:
|
|
@@ -431,7 +431,7 @@ class PortMapAspectMixin(metaclass=ExtendedType, mixin=True):
|
|
|
431
431
|
"""
|
|
432
432
|
Initializes a port map aspect.
|
|
433
433
|
|
|
434
|
-
:param portAssociationItems:
|
|
434
|
+
:param portAssociationItems: Optional, list of all port associations. Default: ``None``, no port associations.
|
|
435
435
|
"""
|
|
436
436
|
self._portAssociationItems = portAssociationItemList = []
|
|
437
437
|
if portAssociationItems is not None:
|
|
@@ -34,21 +34,26 @@ This module contains parts of an abstract document language model for VHDL.
|
|
|
34
34
|
|
|
35
35
|
Base-classes for the VHDL language model.
|
|
36
36
|
"""
|
|
37
|
-
from __future__
|
|
37
|
+
from __future__ import annotations
|
|
38
38
|
|
|
39
|
-
from enum
|
|
40
|
-
from typing
|
|
39
|
+
from enum import unique, Enum
|
|
40
|
+
from typing import TYPE_CHECKING, ClassVar, Generator, Type, Iterable, Optional as Nullable, Union, \
|
|
41
|
+
cast, Self
|
|
41
42
|
|
|
42
|
-
from pyTooling.Common
|
|
43
|
-
from pyTooling.Decorators
|
|
44
|
-
from pyTooling.MetaClasses
|
|
43
|
+
from pyTooling.Common import StringEnum, getFullyQualifiedName
|
|
44
|
+
from pyTooling.Decorators import export, notimplemented, readonly
|
|
45
|
+
from pyTooling.MetaClasses import ExtendedType, abstractclass
|
|
46
|
+
from pyTooling.Warning import WarningCollector
|
|
45
47
|
if TYPE_CHECKING:
|
|
48
|
+
from pyVHDLModel.DesignUnit import DesignUnit
|
|
46
49
|
from pyVHDLModel.Interface import SingleDeclarationMixin
|
|
47
|
-
from pyVHDLModel.
|
|
50
|
+
from pyVHDLModel.Name import Name
|
|
51
|
+
from pyVHDLModel.Regions import DeclarativeRegionMixin
|
|
52
|
+
from pyVHDLModel.Symbol import Symbol, SubtypeSymbol
|
|
48
53
|
from pyVHDLModel.Visitor import Visitor
|
|
49
54
|
|
|
50
55
|
|
|
51
|
-
__all__ = ["ExpressionUnion"
|
|
56
|
+
__all__ = ["ExpressionUnion"]
|
|
52
57
|
|
|
53
58
|
|
|
54
59
|
ExpressionUnion = Union[
|
|
@@ -60,12 +65,6 @@ ExpressionUnion = Union[
|
|
|
60
65
|
'Literal',
|
|
61
66
|
]
|
|
62
67
|
|
|
63
|
-
ModelElementUnion = Union['ModelEntity', 'Symbol']
|
|
64
|
-
"""
|
|
65
|
-
A model element a visitor walks or the VHDL writer writes: a :class:`ModelEntity` or a
|
|
66
|
-
:class:`~pyVHDLModel.Symbol.Symbol`.
|
|
67
|
-
"""
|
|
68
|
-
|
|
69
68
|
|
|
70
69
|
@export
|
|
71
70
|
@unique
|
|
@@ -293,7 +292,7 @@ class ModelEntity(metaclass=ExtendedType, slots=True):
|
|
|
293
292
|
"""
|
|
294
293
|
Initializes a VHDL model entity.
|
|
295
294
|
|
|
296
|
-
:param parent:
|
|
295
|
+
:param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
|
|
297
296
|
"""
|
|
298
297
|
self._parent = parent
|
|
299
298
|
|
|
@@ -320,13 +319,13 @@ class ModelEntity(metaclass=ExtendedType, slots=True):
|
|
|
320
319
|
Iterates the parent chain - starting at this model entity - upwards (toward the root of the model) until an
|
|
321
320
|
ancestor of the requested type is found.
|
|
322
321
|
|
|
323
|
-
:param type:
|
|
324
|
-
:returns:
|
|
325
|
-
:raises
|
|
326
|
-
|
|
322
|
+
:param type: Class (type) of the ancestor to find.
|
|
323
|
+
:returns: The closest ancestor of the requested type.
|
|
324
|
+
:raises AncestorNotFoundError: If the root of the model is reached without finding an ancestor of the requested
|
|
325
|
+
type.
|
|
327
326
|
"""
|
|
328
327
|
# Deferred import to avoid a circular import: Base -> Exception -> Symbol -> Base.
|
|
329
|
-
from pyVHDLModel.Exception import
|
|
328
|
+
from pyVHDLModel.Exception import AncestorNotFoundError
|
|
330
329
|
|
|
331
330
|
parent = self._parent
|
|
332
331
|
while parent is not None:
|
|
@@ -335,10 +334,115 @@ class ModelEntity(metaclass=ExtendedType, slots=True):
|
|
|
335
334
|
|
|
336
335
|
parent = parent._parent
|
|
337
336
|
else:
|
|
338
|
-
raise
|
|
337
|
+
raise AncestorNotFoundError(
|
|
338
|
+
f"No ancestor of type '{type.__name__}' found for {self!r}.",
|
|
339
|
+
element=self,
|
|
340
|
+
ancestorType=type
|
|
341
|
+
)
|
|
339
342
|
|
|
340
343
|
return parent
|
|
341
344
|
|
|
345
|
+
@readonly
|
|
346
|
+
def IsOverloadable(self) -> bool:
|
|
347
|
+
"""
|
|
348
|
+
Check if this model entity is an overloadable declaration: it may share its designator with other overloadable
|
|
349
|
+
declarations.
|
|
350
|
+
|
|
351
|
+
Subprograms, enumeration literals and aliases, which may denote one of them, are overloadable; they override this
|
|
352
|
+
property.
|
|
353
|
+
|
|
354
|
+
:returns: ``True``, if this model entity is an overloadable declaration.
|
|
355
|
+
"""
|
|
356
|
+
return False
|
|
357
|
+
|
|
358
|
+
def IterateImplicitDeclarations(self) -> Generator[tuple[str, ModelEntity], None, None]:
|
|
359
|
+
"""
|
|
360
|
+
Iterate the declarations this declaration implies.
|
|
361
|
+
|
|
362
|
+
An enumerated type implies its enumeration literals, a physical type its units; they override this method.
|
|
363
|
+
|
|
364
|
+
:returns: A generator to iterate (normalized designator, declaration) pairs, in declaration order: none.
|
|
365
|
+
"""
|
|
366
|
+
yield from ()
|
|
367
|
+
|
|
368
|
+
def IterateTypeMarks(
|
|
369
|
+
self,
|
|
370
|
+
region: DeclarativeRegionMixin
|
|
371
|
+
) -> Generator[tuple[DeclarativeRegionMixin, ModelEntity, SubtypeSymbol], None, None]:
|
|
372
|
+
"""
|
|
373
|
+
Iterate the type marks of this declaration, each with the region and the place to look it up.
|
|
374
|
+
|
|
375
|
+
The place of a type mark is the declaration containing it. Declarations with type marks override this method,
|
|
376
|
+
e.g. an object yields the type mark of its subtype indication, an array type its index and element subtypes.
|
|
377
|
+
|
|
378
|
+
:param region: The declarative region declaring this declaration.
|
|
379
|
+
:returns: A generator to iterate (region, place, type mark) tuples, in declaration order: none.
|
|
380
|
+
"""
|
|
381
|
+
yield from ()
|
|
382
|
+
|
|
383
|
+
def ResolveReferences(self, designUnit: DesignUnit, region: DeclarativeRegionMixin) -> None:
|
|
384
|
+
"""
|
|
385
|
+
Resolve the references of this declaration: its type marks (:meth:`IterateTypeMarks`).
|
|
386
|
+
|
|
387
|
+
Each type mark is resolved at its place by the region it is looked up in
|
|
388
|
+
(:meth:`~pyVHDLModel.Regions.DeclarativeRegionMixin.ResolveTypeMark`). An incomplete type, an alias and a subtype
|
|
389
|
+
extend this method.
|
|
390
|
+
|
|
391
|
+
:param designUnit: The design unit containing this declaration.
|
|
392
|
+
:param region: The declarative region declaring this declaration.
|
|
393
|
+
:raises UnhandledCriticalWarningError: If a type mark can't be resolved, and no
|
|
394
|
+
:class:`~pyTooling.Warning.WarningCollector` collects the
|
|
395
|
+
:exc:`~pyVHDLModel.Exception.UnresolvedTypeMarkWarning`.
|
|
396
|
+
"""
|
|
397
|
+
for typeMarkRegion, place, typeMark in self.IterateTypeMarks(region):
|
|
398
|
+
typeMarkRegion.ResolveTypeMark(place, typeMark)
|
|
399
|
+
|
|
400
|
+
def ResetReferences(self, designUnit: DesignUnit, region: DeclarativeRegionMixin) -> None:
|
|
401
|
+
"""
|
|
402
|
+
Reset the references :meth:`ResolveReferences` derived: the references of this declaration's type marks.
|
|
403
|
+
|
|
404
|
+
A use clause, an alias and a subtype extend this method.
|
|
405
|
+
|
|
406
|
+
:param designUnit: The design unit containing this declaration.
|
|
407
|
+
:param region: The declarative region declaring this declaration.
|
|
408
|
+
"""
|
|
409
|
+
for _, _, typeMark in self.IterateTypeMarks(region):
|
|
410
|
+
typeMark._reference = None
|
|
411
|
+
|
|
412
|
+
def DenoteBy(
|
|
413
|
+
self,
|
|
414
|
+
name: Name,
|
|
415
|
+
region: DeclarativeRegionMixin,
|
|
416
|
+
place: ModelEntity,
|
|
417
|
+
symbol: Symbol
|
|
418
|
+
) -> Nullable[ModelEntity]:
|
|
419
|
+
"""
|
|
420
|
+
Determine the model entity a name denoting this declaration denotes, as a part of a type mark (:meth:`Name.Denote
|
|
421
|
+
<pyVHDLModel.Name.Name.Denote>`).
|
|
422
|
+
|
|
423
|
+
A declaration, which a name in a type mark can denote, overrides this method and returns itself: an object, an
|
|
424
|
+
alias, a type or subtype, a record element, a package. Any other declaration (e.g. a subprogram) is reported.
|
|
425
|
+
|
|
426
|
+
:param name: The name denoting this declaration, a part of the type mark.
|
|
427
|
+
:param region: The declarative region containing the type mark.
|
|
428
|
+
:param place: The declaration containing the type mark.
|
|
429
|
+
:param symbol: The type mark.
|
|
430
|
+
:returns: ``None``, as a name in a type mark can't denote this declaration (reported
|
|
431
|
+
as a warning).
|
|
432
|
+
:raises UnhandledCriticalWarningError: Always, if no :class:`~pyTooling.Warning.WarningCollector` collects the
|
|
433
|
+
:exc:`~pyVHDLModel.Exception.UnresolvedTypeMarkWarning`.
|
|
434
|
+
"""
|
|
435
|
+
from pyVHDLModel.Exception import UnresolvedTypeMarkWarning
|
|
436
|
+
|
|
437
|
+
WarningCollector.Raise(UnresolvedTypeMarkWarning(
|
|
438
|
+
f"Prefix '{name!s}' of type mark '{symbol._name!s}' is neither an object, a type nor a package: "
|
|
439
|
+
f"{self.__class__.__name__}.",
|
|
440
|
+
symbol=symbol,
|
|
441
|
+
place=place,
|
|
442
|
+
namespaces=(region._namespace, )
|
|
443
|
+
))
|
|
444
|
+
return None
|
|
445
|
+
|
|
342
446
|
@notimplemented("Model element has no walk for a visitor.")
|
|
343
447
|
def Visit(self, visitor: Visitor) -> None:
|
|
344
448
|
"""
|
|
@@ -399,10 +503,23 @@ class NamedEntityMixin(metaclass=ExtendedType, mixin=True):
|
|
|
399
503
|
"""
|
|
400
504
|
Read-only property to access the model entity's normalized identifier (:attr:`_normalizedIdentifier`).
|
|
401
505
|
|
|
506
|
+
.. seealso::
|
|
507
|
+
|
|
508
|
+
* :term:`Normalized`
|
|
509
|
+
|
|
402
510
|
:returns: Normalized name of a model entity.
|
|
403
511
|
"""
|
|
404
512
|
return self._normalizedIdentifier
|
|
405
513
|
|
|
514
|
+
def GetIdentifier(self, normalizedIdentifier: str) -> str:
|
|
515
|
+
"""
|
|
516
|
+
Return the identifier as declared, for the model entity's normalized identifier.
|
|
517
|
+
|
|
518
|
+
:param normalizedIdentifier: The model entity's normalized (lower case) identifier.
|
|
519
|
+
:returns: The identifier in its declared spelling.
|
|
520
|
+
"""
|
|
521
|
+
return self._identifier
|
|
522
|
+
|
|
406
523
|
|
|
407
524
|
@export
|
|
408
525
|
class OptionallyNamedEntityMixin(metaclass=ExtendedType, mixin=True):
|
|
@@ -443,6 +560,10 @@ class OptionallyNamedEntityMixin(metaclass=ExtendedType, mixin=True):
|
|
|
443
560
|
"""
|
|
444
561
|
Read-only property to access the model entity's optional normalized identifier (:attr:`_normalizedIdentifier`).
|
|
445
562
|
|
|
563
|
+
.. seealso::
|
|
564
|
+
|
|
565
|
+
* :term:`Normalized`
|
|
566
|
+
|
|
446
567
|
:returns: Normalized name of a model entity, or ``None`` if unnamed.
|
|
447
568
|
"""
|
|
448
569
|
return self._normalizedIdentifier
|
|
@@ -463,7 +584,7 @@ class MultipleNamedEntityMixin(
|
|
|
463
584
|
|
|
464
585
|
The host class provides ``Copy()`` and ``_SplitInParent()``, called by :meth:`Split`: the latter calls the parent's
|
|
465
586
|
mutator splitting the declaration, e.g.
|
|
466
|
-
:meth:`
|
|
587
|
+
:meth:`DeclarativePartMixin.SplitDeclaredItem <pyVHDLModel.Regions.DeclarativePartMixin.SplitDeclaredItem>`.
|
|
467
588
|
|
|
468
589
|
.. seealso::
|
|
469
590
|
|
|
@@ -500,10 +621,23 @@ class MultipleNamedEntityMixin(
|
|
|
500
621
|
"""
|
|
501
622
|
Read-only property to access the model entity's normalized identifiers (:attr:`_normalizedIdentifiers`).
|
|
502
623
|
|
|
624
|
+
.. seealso::
|
|
625
|
+
|
|
626
|
+
* :term:`Normalized`
|
|
627
|
+
|
|
503
628
|
:returns: Tuple of normalized identifiers.
|
|
504
629
|
"""
|
|
505
630
|
return self._normalizedIdentifiers
|
|
506
631
|
|
|
632
|
+
def GetIdentifier(self, normalizedIdentifier: str) -> str:
|
|
633
|
+
"""
|
|
634
|
+
Return the identifier as declared, for one of the model entity's normalized identifiers.
|
|
635
|
+
|
|
636
|
+
:param normalizedIdentifier: One of the model entity's normalized (lower case) identifiers.
|
|
637
|
+
:returns: The identifier in its declared spelling.
|
|
638
|
+
"""
|
|
639
|
+
return self._identifiers[self._normalizedIdentifiers.index(normalizedIdentifier)]
|
|
640
|
+
|
|
507
641
|
def Split(self) -> tuple[Self, ...]:
|
|
508
642
|
"""
|
|
509
643
|
Split this declaration into one declaration per identifier.
|
|
@@ -570,8 +704,8 @@ def identifiersOf(item) -> tuple[str, ...]:
|
|
|
570
704
|
:class:`MultipleNamedEntityMixin`, where one declaration names several items at once
|
|
571
705
|
(``port (p1, p2 : in bit)``, and every ``Constant``/``Signal``/``Variable``/``File``-derived item).
|
|
572
706
|
|
|
573
|
-
:param item:
|
|
574
|
-
:returns:
|
|
707
|
+
:param item: A singularly or plurally named entity.
|
|
708
|
+
:returns: The item's identifiers.
|
|
575
709
|
:raises TypeError: If the item is neither singularly nor plurally named.
|
|
576
710
|
|
|
577
711
|
.. seealso::
|
|
@@ -597,8 +731,8 @@ def normalizedIdentifiersOf(item) -> tuple[str, ...]:
|
|
|
597
731
|
This is the form used as dictionary keys and for name resolution, because VHDL identifiers are
|
|
598
732
|
case-insensitive.
|
|
599
733
|
|
|
600
|
-
:param item:
|
|
601
|
-
:returns:
|
|
734
|
+
:param item: A singularly or plurally named entity.
|
|
735
|
+
:returns: The item's normalized identifiers.
|
|
602
736
|
:raises TypeError: If the item is neither singularly nor plurally named.
|
|
603
737
|
|
|
604
738
|
.. seealso::
|
|
@@ -681,6 +815,10 @@ class LabeledEntityMixin(metaclass=ExtendedType, mixin=True):
|
|
|
681
815
|
"""
|
|
682
816
|
Read-only property to access the model entity's normalized label (:attr:`_normalizedLabel`).
|
|
683
817
|
|
|
818
|
+
.. seealso::
|
|
819
|
+
|
|
820
|
+
* :term:`Normalized`
|
|
821
|
+
|
|
684
822
|
:returns: Normalized label of a model entity.
|
|
685
823
|
"""
|
|
686
824
|
return self._normalizedLabel
|
|
@@ -739,7 +877,7 @@ class ConditionalMixin(metaclass=ExtendedType, mixin=True):
|
|
|
739
877
|
|
|
740
878
|
When the condition is not None, the condition's parent reference is set to this statement.
|
|
741
879
|
|
|
742
|
-
:param condition:
|
|
880
|
+
:param condition: Optional, the expression representing the condition. Default: ``None``, no condition.
|
|
743
881
|
"""
|
|
744
882
|
self._condition = condition
|
|
745
883
|
if condition is not None:
|
|
@@ -847,8 +985,8 @@ class ReportStatementMixin(metaclass=ExtendedType, mixin=True):
|
|
|
847
985
|
"""
|
|
848
986
|
Initializes a report statement.
|
|
849
987
|
|
|
850
|
-
:param message:
|
|
851
|
-
:param severity:
|
|
988
|
+
:param message: Optional, the reported message. Default: ``None``, no message.
|
|
989
|
+
:param severity: Optional, the reported severity level. Default: ``None``, no severity level.
|
|
852
990
|
"""
|
|
853
991
|
self._message = message
|
|
854
992
|
if message is not None:
|
|
@@ -907,8 +1045,8 @@ class AssertStatementMixin(ReportStatementMixin, ConditionalMixin, mixin=True):
|
|
|
907
1045
|
Initializes an assert statement.
|
|
908
1046
|
|
|
909
1047
|
:param condition: The condition guarding this statement.
|
|
910
|
-
:param message:
|
|
911
|
-
:param severity:
|
|
1048
|
+
:param message: Optional, the reported message. Default: ``None``, no message.
|
|
1049
|
+
:param severity: Optional, the reported severity level. Default: ``None``, no severity level.
|
|
912
1050
|
"""
|
|
913
1051
|
super().__init__(message, severity)
|
|
914
1052
|
ConditionalMixin.__init__(self, condition)
|
|
@@ -988,7 +1126,7 @@ class ChoicesMixin(metaclass=ExtendedType, mixin=True):
|
|
|
988
1126
|
"""
|
|
989
1127
|
Initializes choices.
|
|
990
1128
|
|
|
991
|
-
:param choices:
|
|
1129
|
+
:param choices: Optional, list of all choices selecting this alternative. Default: ``None``, no choices.
|
|
992
1130
|
"""
|
|
993
1131
|
self._choices = choiceList = []
|
|
994
1132
|
if choices is not None:
|
|
@@ -1040,7 +1178,7 @@ class SimpleRange(Range):
|
|
|
1040
1178
|
:param leftBound: The range's left bound.
|
|
1041
1179
|
:param rightBound: The range's right bound.
|
|
1042
1180
|
:param direction: The range's direction (``to`` or ``downto``).
|
|
1043
|
-
:param parent:
|
|
1181
|
+
:param parent: Optional, the parent model entity. Default: ``None``, no parent.
|
|
1044
1182
|
"""
|
|
1045
1183
|
super().__init__(parent)
|
|
1046
1184
|
|
|
@@ -1140,7 +1278,7 @@ class RangeFromName(Range):
|
|
|
1140
1278
|
Initialize a range denoted by a name.
|
|
1141
1279
|
|
|
1142
1280
|
:param symbol: The symbol referencing the range attribute or discrete subtype.
|
|
1143
|
-
:param parent:
|
|
1281
|
+
:param parent: Optional, the parent model entity. Default: ``None``, no parent.
|
|
1144
1282
|
"""
|
|
1145
1283
|
super().__init__(parent)
|
|
1146
1284
|
|
|
@@ -1216,8 +1354,8 @@ class WaveformElement(ModelEntity):
|
|
|
1216
1354
|
Initializes a waveform element.
|
|
1217
1355
|
|
|
1218
1356
|
:param expression: The value this waveform element assigns.
|
|
1219
|
-
:param after:
|
|
1220
|
-
:param parent:
|
|
1357
|
+
:param after: Optional, the delay after which the value is assigned. Default: ``None``, no delay.
|
|
1358
|
+
:param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
|
|
1221
1359
|
"""
|
|
1222
1360
|
super().__init__(parent)
|
|
1223
1361
|
|
|
@@ -42,8 +42,8 @@ from pyTooling.Common import getFullyQualifiedName, getTypeName
|
|
|
42
42
|
from pyTooling.Decorators import export, readonly
|
|
43
43
|
from pyTooling.MetaClasses import ExtendedType, abstractclass
|
|
44
44
|
|
|
45
|
-
from pyVHDLModel.Base import ModelEntity, LabeledEntityMixin, BaseCase, BaseChoice,
|
|
46
|
-
ConditionalMixin, ChoicesMixin
|
|
45
|
+
from pyVHDLModel.Base import ModelEntity, LabeledEntityMixin, DocumentedEntityMixin, BaseCase, BaseChoice, \
|
|
46
|
+
WaveformElement, ConditionalMixin, ChoicesMixin
|
|
47
47
|
from pyVHDLModel.Exception import AlreadyInDesignError, NotAChildError, AssociationOrderError, \
|
|
48
48
|
DuplicateParameterAssociationError
|
|
49
49
|
from pyVHDLModel.Expression import BaseExpression, QualifiedExpression, FunctionCall, TypeConversion, Literal
|
|
@@ -92,7 +92,8 @@ class AllowBlackboxMixin(metaclass=ExtendedType, mixin=True, expects=("_parent",
|
|
|
92
92
|
"""
|
|
93
93
|
Initializes a hierarchical model entity allow for blackboxes.
|
|
94
94
|
|
|
95
|
-
:param allowBlackbox:
|
|
95
|
+
:param allowBlackbox: Optional, allow blackboxes for components in language entity.
|
|
96
|
+
Default: ``None``, inherited from the parent.
|
|
96
97
|
"""
|
|
97
98
|
self._allowBlackbox = allowBlackbox
|
|
98
99
|
|
|
@@ -107,16 +108,19 @@ class AllowBlackboxMixin(metaclass=ExtendedType, mixin=True, expects=("_parent",
|
|
|
107
108
|
1. If allow blackbox property is locally set, return the local value,
|
|
108
109
|
2. Otherwise, return allow blackbox value from parent object.
|
|
109
110
|
|
|
110
|
-
:returns:
|
|
111
|
-
:raises
|
|
112
|
-
|
|
111
|
+
:returns: ``True``, if blackboxes are allowed.
|
|
112
|
+
:raises AllowBlackboxNotSetError: If neither a local value is set nor a parent object is available to inherit
|
|
113
|
+
the value from.
|
|
113
114
|
"""
|
|
114
115
|
if self._allowBlackbox is not None:
|
|
115
116
|
return self._allowBlackbox
|
|
116
117
|
elif self._parent is None:
|
|
117
|
-
from pyVHDLModel.Exception import
|
|
118
|
+
from pyVHDLModel.Exception import AllowBlackboxNotSetError
|
|
118
119
|
|
|
119
|
-
raise
|
|
120
|
+
raise AllowBlackboxNotSetError(
|
|
121
|
+
f"AllowBlackbox is not set on {self!r} and no parent is available to inherit it from.",
|
|
122
|
+
element=self
|
|
123
|
+
)
|
|
120
124
|
else:
|
|
121
125
|
return self._parent.AllowBlackbox
|
|
122
126
|
|
|
@@ -127,7 +131,7 @@ class AllowBlackboxMixin(metaclass=ExtendedType, mixin=True, expects=("_parent",
|
|
|
127
131
|
|
|
128
132
|
@export
|
|
129
133
|
@abstractclass
|
|
130
|
-
class Statement(ModelEntity, LabeledEntityMixin):
|
|
134
|
+
class Statement(ModelEntity, LabeledEntityMixin, DocumentedEntityMixin):
|
|
131
135
|
"""
|
|
132
136
|
A ``Statement`` is a base-class for all statements.
|
|
133
137
|
|
|
@@ -136,15 +140,18 @@ class Statement(ModelEntity, LabeledEntityMixin):
|
|
|
136
140
|
* :class:`Concurrent statement <pyVHDLModel.Concurrent.ConcurrentStatement>`
|
|
137
141
|
* :class:`Sequential statement <pyVHDLModel.Sequential.SequentialStatement>`
|
|
138
142
|
"""
|
|
139
|
-
def __init__(self, label: Nullable[str] = None, parent=None) -> None:
|
|
143
|
+
def __init__(self, label: Nullable[str] = None, documentation: Nullable[str] = None, parent=None) -> None:
|
|
140
144
|
"""
|
|
141
145
|
Initializes a statement.
|
|
142
146
|
|
|
143
|
-
:param label:
|
|
144
|
-
:param
|
|
147
|
+
:param label: Optional, the label of a model entity. Default: ``None``, no label.
|
|
148
|
+
:param documentation: Optional, the documentation comment associated with this declaration.
|
|
149
|
+
Default: ``None``, no documentation.
|
|
150
|
+
:param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
|
|
145
151
|
"""
|
|
146
152
|
super().__init__(parent)
|
|
147
153
|
LabeledEntityMixin.__init__(self, label)
|
|
154
|
+
DocumentedEntityMixin.__init__(self, documentation)
|
|
148
155
|
|
|
149
156
|
|
|
150
157
|
@export
|
|
@@ -172,9 +179,10 @@ class ProcedureCallMixin(metaclass=ExtendedType, mixin=True):
|
|
|
172
179
|
Initializes a procedure call.
|
|
173
180
|
|
|
174
181
|
:param procedureName: Reference to the called procedure.
|
|
175
|
-
:param parameterAssociationItems:
|
|
182
|
+
:param parameterAssociationItems: Optional, list of all parameter associations of the call.
|
|
183
|
+
Default: ``None``, no parameter associations.
|
|
176
184
|
"""
|
|
177
|
-
self._procedure =
|
|
185
|
+
self._procedure = procedureName
|
|
178
186
|
procedureName.Parent = self
|
|
179
187
|
|
|
180
188
|
# TODO: extract to mixin
|
|
@@ -616,8 +624,9 @@ class ConditionalWaveform(ModelEntity, WaveformMixin, ConditionalMixin):
|
|
|
616
624
|
Initializes a conditional waveform.
|
|
617
625
|
|
|
618
626
|
:param waveform: List of all waveform elements, in the order they were written.
|
|
619
|
-
:param condition:
|
|
620
|
-
|
|
627
|
+
:param condition: Optional, the condition selecting this alternative.
|
|
628
|
+
Default: ``None``, the final alternative without ``when``.
|
|
629
|
+
:param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
|
|
621
630
|
"""
|
|
622
631
|
super().__init__(parent)
|
|
623
632
|
WaveformMixin.__init__(self, waveform)
|
|
@@ -669,8 +678,9 @@ class ConditionalExpression(ModelEntity, ExpressionMixin, ConditionalMixin):
|
|
|
669
678
|
Initializes a conditional expression.
|
|
670
679
|
|
|
671
680
|
:param expression: The value assigned when the condition holds.
|
|
672
|
-
:param condition:
|
|
673
|
-
|
|
681
|
+
:param condition: Optional, the condition selecting this alternative.
|
|
682
|
+
Default: ``None``, the final alternative without ``when``.
|
|
683
|
+
:param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
|
|
674
684
|
"""
|
|
675
685
|
super().__init__(parent)
|
|
676
686
|
ExpressionMixin.__init__(self, expression)
|
|
@@ -769,7 +779,7 @@ class SelectedWaveform(BaseCase, WaveformMixin, ChoicesMixin):
|
|
|
769
779
|
|
|
770
780
|
:param choices: List of all choices selecting this alternative.
|
|
771
781
|
:param waveform: List of all waveform elements, in the order they were written.
|
|
772
|
-
:param parent:
|
|
782
|
+
:param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
|
|
773
783
|
"""
|
|
774
784
|
super().__init__(parent)
|
|
775
785
|
WaveformMixin.__init__(self, waveform)
|
|
@@ -813,7 +823,7 @@ class OthersSelectedWaveform(BaseCase, WaveformMixin):
|
|
|
813
823
|
Initializes an others selected waveform.
|
|
814
824
|
|
|
815
825
|
:param waveform: List of all waveform elements, in the order they were written.
|
|
816
|
-
:param parent:
|
|
826
|
+
:param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
|
|
817
827
|
"""
|
|
818
828
|
super().__init__(parent)
|
|
819
829
|
WaveformMixin.__init__(self, waveform)
|
|
@@ -861,7 +871,7 @@ class SelectedExpression(BaseCase, ExpressionMixin, ChoicesMixin):
|
|
|
861
871
|
|
|
862
872
|
:param choices: List of all choices selecting this alternative.
|
|
863
873
|
:param expression: The value assigned for the matching choices.
|
|
864
|
-
:param parent:
|
|
874
|
+
:param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
|
|
865
875
|
"""
|
|
866
876
|
super().__init__(parent)
|
|
867
877
|
ExpressionMixin.__init__(self, expression)
|
|
@@ -905,7 +915,7 @@ class OthersSelectedExpression(BaseCase, ExpressionMixin):
|
|
|
905
915
|
Initializes an others selected expression.
|
|
906
916
|
|
|
907
917
|
:param expression: The value assigned for every unnamed choice.
|
|
908
|
-
:param parent:
|
|
918
|
+
:param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
|
|
909
919
|
"""
|
|
910
920
|
super().__init__(parent)
|
|
911
921
|
ExpressionMixin.__init__(self, expression)
|