pyVHDLModel 0.42.0__tar.gz → 0.44.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.42.0 → pyvhdlmodel-0.44.0}/PKG-INFO +22 -22
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Association.py +1 -2
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Base.py +163 -25
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Common.py +18 -12
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Concurrent.py +167 -54
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Configuration.py +14 -5
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Declaration.py +139 -3
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/DesignUnit.py +214 -64
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Exception.py +1156 -140
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Expression.py +67 -14
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Formatting/VHDL.py +24 -24
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/IEEE.py +17 -9
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Instantiation.py +34 -3
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Interface.py +40 -16
- pyvhdlmodel-0.44.0/pyVHDLModel/Name.py +988 -0
- pyvhdlmodel-0.44.0/pyVHDLModel/Namespace.py +857 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Object.py +63 -6
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Predefined.py +10 -1
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Regions.py +512 -185
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/STD.py +17 -10
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Sequential.py +309 -123
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Subprogram.py +37 -10
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Symbol.py +443 -176
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Type.py +379 -43
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Visitor.py +47 -16
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/__init__.py +952 -584
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/PKG-INFO +22 -22
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/requires.txt +21 -21
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyproject.toml +1 -1
- pyvhdlmodel-0.42.0/pyVHDLModel/Name.py +0 -558
- pyvhdlmodel-0.42.0/pyVHDLModel/Namespace.py +0 -462
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/LICENSE.md +0 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/README.md +0 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Formatting/__init__.py +0 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/PSLModel.py +0 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/py.typed +0 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/SOURCES.txt +0 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/dependency_links.txt +0 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/top_level.txt +0 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.0}/setup.cfg +0 -0
- {pyvhdlmodel-0.42.0 → pyvhdlmodel-0.44.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.44.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: pyTooling.
|
|
32
|
-
Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
|
|
33
|
-
Requires-Dist: pyTooling<11.0,>=10.1.1; extra == "doc"
|
|
31
|
+
Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "doc"
|
|
34
32
|
Requires-Dist: sphinx_rtd_theme~=3.1; extra == "doc"
|
|
33
|
+
Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
|
|
34
|
+
Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "doc"
|
|
35
35
|
Requires-Dist: sphinx-copybutton>=0.5.2; extra == "doc"
|
|
36
36
|
Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "doc"
|
|
37
|
+
Requires-Dist: sphinx_design~=0.7.0; extra == "doc"
|
|
38
|
+
Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "doc"
|
|
37
39
|
Requires-Dist: sphinx~=9.2; extra == "doc"
|
|
38
40
|
Requires-Dist: autoapi>=2.0.1; extra == "doc"
|
|
39
|
-
Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "doc"
|
|
40
|
-
Requires-Dist: sphinx_design~=0.7.0; extra == "doc"
|
|
41
41
|
Provides-Extra: test
|
|
42
|
-
Requires-Dist:
|
|
43
|
-
Requires-Dist:
|
|
42
|
+
Requires-Dist: typing_extensions~=4.16; extra == "test"
|
|
43
|
+
Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "test"
|
|
44
44
|
Requires-Dist: pytest-xdist~=3.8; extra == "test"
|
|
45
|
-
Requires-Dist: pyTooling<11.0,>=10.1.1; extra == "test"
|
|
46
45
|
Requires-Dist: pytest-cov~=7.1; extra == "test"
|
|
47
|
-
Requires-Dist:
|
|
46
|
+
Requires-Dist: pytest~=9.2; extra == "test"
|
|
47
|
+
Requires-Dist: Coverage~=7.17; extra == "test"
|
|
48
48
|
Requires-Dist: lxml<7.0,>=6.1.3; extra == "test"
|
|
49
49
|
Requires-Dist: mypy[reports]~=2.4; extra == "test"
|
|
50
50
|
Provides-Extra: all
|
|
51
|
-
Requires-Dist:
|
|
52
|
-
Requires-Dist:
|
|
53
|
-
Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "all"
|
|
51
|
+
Requires-Dist: typing_extensions~=4.16; extra == "all"
|
|
52
|
+
Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "all"
|
|
54
53
|
Requires-Dist: docutils_stubs~=0.0.22; extra == "all"
|
|
55
|
-
Requires-Dist: pytest-xdist~=3.8; extra == "all"
|
|
56
|
-
Requires-Dist: pyTooling<11.0,>=10.1.1; extra == "all"
|
|
57
54
|
Requires-Dist: sphinx_rtd_theme~=3.1; extra == "all"
|
|
58
|
-
Requires-Dist: pytest-cov~=7.1; extra == "all"
|
|
59
|
-
Requires-Dist: mypy[reports]~=2.4; extra == "all"
|
|
60
55
|
Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
|
|
61
|
-
Requires-Dist:
|
|
56
|
+
Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "all"
|
|
62
57
|
Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "all"
|
|
63
|
-
Requires-Dist:
|
|
58
|
+
Requires-Dist: pytest-xdist~=3.8; extra == "all"
|
|
59
|
+
Requires-Dist: pytest-cov~=7.1; extra == "all"
|
|
60
|
+
Requires-Dist: sphinx_design~=0.7.0; extra == "all"
|
|
61
|
+
Requires-Dist: pytest~=9.2; extra == "all"
|
|
62
|
+
Requires-Dist: Coverage~=7.17; extra == "all"
|
|
63
|
+
Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "all"
|
|
64
64
|
Requires-Dist: lxml<7.0,>=6.1.3; extra == "all"
|
|
65
|
+
Requires-Dist: sphinx~=9.2; extra == "all"
|
|
66
|
+
Requires-Dist: mypy[reports]~=2.4; extra == "all"
|
|
65
67
|
Requires-Dist: autoapi>=2.0.1; extra == "all"
|
|
66
|
-
Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "all"
|
|
67
|
-
Requires-Dist: sphinx_design~=0.7.0; 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
|
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -108,16 +108,19 @@ class AllowBlackboxMixin(metaclass=ExtendedType, mixin=True, expects=("_parent",
|
|
|
108
108
|
1. If allow blackbox property is locally set, return the local value,
|
|
109
109
|
2. Otherwise, return allow blackbox value from parent object.
|
|
110
110
|
|
|
111
|
-
:returns:
|
|
112
|
-
:raises
|
|
113
|
-
|
|
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.
|
|
114
114
|
"""
|
|
115
115
|
if self._allowBlackbox is not None:
|
|
116
116
|
return self._allowBlackbox
|
|
117
117
|
elif self._parent is None:
|
|
118
|
-
from pyVHDLModel.Exception import
|
|
118
|
+
from pyVHDLModel.Exception import AllowBlackboxNotSetError
|
|
119
119
|
|
|
120
|
-
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
|
+
)
|
|
121
124
|
else:
|
|
122
125
|
return self._parent.AllowBlackbox
|
|
123
126
|
|
|
@@ -128,7 +131,7 @@ class AllowBlackboxMixin(metaclass=ExtendedType, mixin=True, expects=("_parent",
|
|
|
128
131
|
|
|
129
132
|
@export
|
|
130
133
|
@abstractclass
|
|
131
|
-
class Statement(ModelEntity, LabeledEntityMixin):
|
|
134
|
+
class Statement(ModelEntity, LabeledEntityMixin, DocumentedEntityMixin):
|
|
132
135
|
"""
|
|
133
136
|
A ``Statement`` is a base-class for all statements.
|
|
134
137
|
|
|
@@ -137,15 +140,18 @@ class Statement(ModelEntity, LabeledEntityMixin):
|
|
|
137
140
|
* :class:`Concurrent statement <pyVHDLModel.Concurrent.ConcurrentStatement>`
|
|
138
141
|
* :class:`Sequential statement <pyVHDLModel.Sequential.SequentialStatement>`
|
|
139
142
|
"""
|
|
140
|
-
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:
|
|
141
144
|
"""
|
|
142
145
|
Initializes a statement.
|
|
143
146
|
|
|
144
|
-
:param label:
|
|
145
|
-
: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.
|
|
146
151
|
"""
|
|
147
152
|
super().__init__(parent)
|
|
148
153
|
LabeledEntityMixin.__init__(self, label)
|
|
154
|
+
DocumentedEntityMixin.__init__(self, documentation)
|
|
149
155
|
|
|
150
156
|
|
|
151
157
|
@export
|
|
@@ -176,7 +182,7 @@ class ProcedureCallMixin(metaclass=ExtendedType, mixin=True):
|
|
|
176
182
|
:param parameterAssociationItems: Optional, list of all parameter associations of the call.
|
|
177
183
|
Default: ``None``, no parameter associations.
|
|
178
184
|
"""
|
|
179
|
-
self._procedure =
|
|
185
|
+
self._procedure = procedureName
|
|
180
186
|
procedureName.Parent = self
|
|
181
187
|
|
|
182
188
|
# TODO: extract to mixin
|