Coverage for pyVHDLModel/DesignUnit.py: 71%
287 statements
« prev ^ index » next coverage.py v7.15.1, created at 2026-07-13 17:58 +0000
« prev ^ index » next coverage.py v7.15.1, created at 2026-07-13 17:58 +0000
1# ==================================================================================================================== #
2# __ ___ _ ____ _ __ __ _ _ #
3# _ __ _ \ \ / / | | | _ \| | | \/ | ___ __| | ___| | #
4# | '_ \| | | \ \ / /| |_| | | | | | | |\/| |/ _ \ / _` |/ _ \ | #
5# | |_) | |_| |\ V / | _ | |_| | |___| | | | (_) | (_| | __/ | #
6# | .__/ \__, | \_/ |_| |_|____/|_____|_| |_|\___/ \__,_|\___|_| #
7# |_| |___/ #
8# ==================================================================================================================== #
9# Authors: #
10# Patrick Lehmann #
11# #
12# License: #
13# ==================================================================================================================== #
14# Copyright 2017-2026 Patrick Lehmann - Boetzingen, Germany #
15# Copyright 2016-2017 Patrick Lehmann - Dresden, Germany #
16# #
17# Licensed under the Apache License, Version 2.0 (the "License"); #
18# you may not use this file except in compliance with the License. #
19# You may obtain a copy of the License at #
20# #
21# http://www.apache.org/licenses/LICENSE-2.0 #
22# #
23# Unless required by applicable law or agreed to in writing, software #
24# distributed under the License is distributed on an "AS IS" BASIS, #
25# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
26# See the License for the specific language governing permissions and #
27# limitations under the License. #
28# #
29# SPDX-License-Identifier: Apache-2.0 #
30# ==================================================================================================================== #
31#
32"""
33This module contains parts of an abstract document language model for VHDL.
35Design units are contexts, entities, architectures, packages and their bodies as well as configurations.
36"""
37from typing import List, Dict, Union, Iterable, Optional as Nullable
39from pyTooling.Decorators import export, readonly
40from pyTooling.MetaClasses import ExtendedType
41from pyTooling.Graph import Vertex
43from pyVHDLModel.Common import AllowBlackboxMixin
44from pyVHDLModel.Exception import VHDLModelException
45from pyVHDLModel.Base import ModelEntity, NamedEntityMixin, DocumentedEntityMixin
46from pyVHDLModel.Namespace import Namespace
47from pyVHDLModel.Regions import ConcurrentDeclarationRegionMixin
48from pyVHDLModel.Symbol import Symbol, PackageSymbol, EntitySymbol, LibraryReferenceSymbol
49from pyVHDLModel.Interface import GenericInterfaceItemMixin, PortInterfaceItemMixin, WithGenericsMixin, WithPortsMixin
50from pyVHDLModel.Object import DeferredConstant
51from pyVHDLModel.Concurrent import ConcurrentStatement, ConcurrentStatementsMixin
54@export
55class Reference(ModelEntity):
56 """
57 A base-class for all references.
59 .. seealso::
61 * :class:`~pyVHDLModel.DesignUnit.LibraryClause`
62 * :class:`~pyVHDLModel.DesignUnit.UseClause`
63 * :class:`~pyVHDLModel.DesignUnit.ContextReference`
64 """
66 _symbols: List[Symbol]
68 def __init__(self, symbols: Iterable[Symbol], parent: Nullable[ModelEntity] = None) -> None:
69 """
70 Initializes a reference by taking a list of symbols and a parent reference.
72 :param symbols: A list of symbols this reference references to.
73 :param parent: Reference to the logical parent in the model hierarchy.
74 """
75 super().__init__(parent)
77 self._symbols = [s for s in symbols]
79 @readonly
80 def Symbols(self) -> List[Symbol]:
81 """
82 Read-only property to access the symbols this reference references to (:attr:`_symbols`).
84 :returns: A list of symbols.
85 """
86 return self._symbols
89@export
90class LibraryClause(Reference):
91 """
92 Represents a library clause.
94 .. admonition:: Example
96 .. code-block:: VHDL
98 library std, ieee;
99 """
101 @readonly
102 def Symbols(self) -> List[LibraryReferenceSymbol]:
103 """
104 Read-only property to access the symbols this library clause references to (:attr:`_symbols`).
106 :returns: A list of library reference symbols.
107 """
108 return self._symbols
111@export
112class UseClause(Reference):
113 """
114 Represents a use clause.
116 .. admonition:: Example
118 .. code-block:: VHDL
120 use std.text_io.all, ieee.numeric_std.all;
121 """
124@export
125class ContextReference(Reference):
126 """
127 Represents a context reference.
129 .. hint:: It's called *context reference* not *context clause* by the LRM.
131 .. admonition:: Example
133 .. code-block:: VHDL
135 context ieee.ieee_std_context;
136 """
139ContextUnion = Union[
140 LibraryClause,
141 UseClause,
142 ContextReference
143]
146@export
147class DesignUnitWithContextMixin(metaclass=ExtendedType, mixin=True):
148 """
149 A mixin-class for all design units with a context.
150 """
153@export
154class DesignUnit(ModelEntity, NamedEntityMixin, DocumentedEntityMixin):
155 """
156 A base-class for all design units.
158 .. seealso::
160 * :class:`Primary design units <pyVHDLModel.DesignUnit.PrimaryUnit>`
162 * :class:`~pyVHDLModel.DesignUnit.Context`
163 * :class:`~pyVHDLModel.DesignUnit.Entity`
164 * :class:`~pyVHDLModel.DesignUnit.Package`
165 * :class:`~pyVHDLModel.DesignUnit.Configuration`
167 * :class:`Secondary design units <pyVHDLModel.DesignUnit.SecondaryUnit>`
169 * :class:`~pyVHDLModel.DesignUnit.Architecture`
170 * :class:`~pyVHDLModel.DesignUnit.PackageBody`
171 """
173 _document: 'Document' #: The VHDL library, the design unit was analyzed into.
175 # Either written as statements before (e.g. entity, architecture, package, ...), or as statements inside (context)
176 _contextItems: List['ContextUnion'] #: List of all context items (library, use and context clauses).
177 _libraryReferences: List['LibraryClause'] #: List of library clauses.
178 _packageReferences: List['UseClause'] #: List of use clauses.
179 _contextReferences: List['ContextReference'] #: List of context clauses.
181 _referencedLibraries: Dict[str, 'Library'] #: Referenced libraries based on explicit library clauses or implicit inheritance
182 _referencedPackages: Dict[str, Dict[str, 'Package']] #: Referenced packages based on explicit use clauses or implicit inheritance
183 _referencedContexts: Dict[str, 'Context'] #: Referenced contexts based on explicit context references or implicit inheritance
185 _dependencyVertex: Vertex[None, None, str, 'DesignUnit', None, None, None, None, None, None, None, None, None, None, None, None, None] #: Reference to the vertex in the dependency graph representing the design unit. |br| This reference is set by :meth:`~pyVHDLModel.Design.CreateDependencyGraph`.
186 _hierarchyVertex: Vertex[None, None, str, 'DesignUnit', None, None, None, None, None, None, None, None, None, None, None, None, None] #: The vertex in the hierarchy graph
188 _namespace: 'Namespace'
190 def __init__(self, identifier: str, contextItems: Nullable[Iterable[ContextUnion]] = None, documentation: Nullable[str] = None, parent: Nullable[ModelEntity] = None) -> None:
191 """
192 Initializes a design unit.
194 :param identifier: Identifier (name) of the design unit.
195 :param contextItems: A sequence of library, use or context clauses.
196 :param documentation: Associated documentation of the design unit.
197 :param parent: Reference to the logical parent in the model hierarchy.
198 """
199 super().__init__(parent)
200 NamedEntityMixin.__init__(self, identifier)
201 DocumentedEntityMixin.__init__(self, documentation)
203 self._document = None
205 self._contextItems = []
206 self._libraryReferences = []
207 self._packageReferences = []
208 self._contextReferences = []
210 if contextItems is not None:
211 for item in contextItems:
212 self._contextItems.append(item)
213 if isinstance(item, UseClause):
214 self._packageReferences.append(item)
215 elif isinstance(item, LibraryClause):
216 self._libraryReferences.append(item)
217 elif isinstance(item, ContextReference): 217 ↛ 211line 217 didn't jump to line 211 because the condition on line 217 was always true
218 self._contextReferences.append(item)
220 self._referencedLibraries = {}
221 self._referencedPackages = {}
222 self._referencedContexts = {}
224 self._dependencyVertex = None
225 self._hierarchyVertex = None
227 self._namespace = Namespace(self._normalizedIdentifier)
229 @readonly
230 def Document(self) -> 'Document':
231 return self._document
233 @Document.setter
234 def Document(self, document: 'Document') -> None:
235 self._document = document
237 @property
238 def Library(self) -> 'Library':
239 return self._parent
241 @Library.setter
242 def Library(self, library: 'Library') -> None:
243 self._parent = library
245 @property
246 def ContextItems(self) -> List['ContextUnion']:
247 """
248 Read-only property to access the sequence of all context items comprising library, use and context clauses
249 (:attr:`_contextItems`).
251 :returns: Sequence of context items.
252 """
253 return self._contextItems
255 @property
256 def ContextReferences(self) -> List['ContextReference']:
257 """
258 Read-only property to access the sequence of context clauses (:attr:`_contextReferences`).
260 :returns: Sequence of context clauses.
261 """
262 return self._contextReferences
264 @property
265 def LibraryReferences(self) -> List['LibraryClause']:
266 """
267 Read-only property to access the sequence of library clauses (:attr:`_libraryReferences`).
269 :returns: Sequence of library clauses.
270 """
271 return self._libraryReferences
273 @property
274 def PackageReferences(self) -> List['UseClause']:
275 """
276 Read-only property to access the sequence of use clauses (:attr:`_packageReferences`).
278 :returns: Sequence of use clauses.
279 """
280 return self._packageReferences
282 @property
283 def ReferencedLibraries(self) -> Dict[str, 'Library']:
284 return self._referencedLibraries
286 @property
287 def ReferencedPackages(self) -> Dict[str, 'Package']:
288 return self._referencedPackages
290 @property
291 def ReferencedContexts(self) -> Dict[str, 'Context']:
292 return self._referencedContexts
294 @property
295 def DependencyVertex(self) -> Vertex:
296 """
297 Read-only property to access the corresponding dependency vertex (:attr:`_dependencyVertex`).
299 The dependency vertex references this design unit by its value field.
301 :returns: The corresponding dependency vertex.
302 """
303 return self._dependencyVertex
305 @property
306 def HierarchyVertex(self) -> Vertex:
307 """
308 Read-only property to access the corresponding hierarchy vertex (:attr:`_hierarchyVertex`).
310 The hierarchy vertex references this design unit by its value field.
312 :returns: The corresponding hierarchy vertex.
313 """
314 return self._hierarchyVertex
317@export
318class PrimaryUnit(DesignUnit):
319 """
320 A base-class for all primary design units.
322 .. seealso::
324 * :class:`~pyVHDLModel.DesignUnit.Context`
325 * :class:`~pyVHDLModel.DesignUnit.Entity`
326 * :class:`~pyVHDLModel.DesignUnit.Package`
327 * :class:`~pyVHDLModel.DesignUnit.Configuration`
328 """
331@export
332class SecondaryUnit(DesignUnit):
333 """
334 A base-class for all secondary design units.
336 .. seealso::
338 * :class:`~pyVHDLModel.DesignUnit.Architecture`
339 * :class:`~pyVHDLModel.DesignUnit.PackageBody`
340 """
343@export
344class Context(PrimaryUnit):
345 """
346 Represents a context declaration.
348 A context contains a generic list of all its items (library clauses, use clauses and context references) in
349 :data:`_references`.
351 Furthermore, when a context gets initialized, the item kinds get separated into individual lists:
353 * :class:`~pyVHDLModel.DesignUnit.LibraryClause` |rarr| :data:`_libraryReferences`
354 * :class:`~pyVHDLModel.DesignUnit.UseClause` |rarr| :data:`_packageReferences`
355 * :class:`~pyVHDLModel.DesignUnit.ContextReference` |rarr| :data:`_contextReferences`
357 When :meth:`pyVHDLModel.Design.LinkContexts` got called, these lists were processed and the fields:
359 * :data:`_referencedLibraries` (:pycode:`Dict[libName, Library]`)
360 * :data:`_referencedPackages` (:pycode:`Dict[libName, [pkgName, Package]]`)
361 * :data:`_referencedContexts` (:pycode:`Dict[libName, [ctxName, Context]]`)
363 are populated.
365 .. admonition:: Example
367 .. code-block:: VHDL
369 context ctx is
370 -- ...
371 end context;
372 """
374 _references: List[ContextUnion]
376 def __init__(self, identifier: str, references: Nullable[Iterable[ContextUnion]] = None, documentation: Nullable[str] = None, parent: Nullable[ModelEntity] = None) -> None:
377 super().__init__(identifier, None, documentation, parent)
379 self._references = []
380 self._libraryReferences = []
381 self._packageReferences = []
382 self._contextReferences = []
384 if references is not None:
385 for reference in references:
386 self._references.append(reference)
387 reference.Parent = self
389 if isinstance(reference, LibraryClause):
390 self._libraryReferences.append(reference)
391 elif isinstance(reference, UseClause): 391 ↛ 393line 391 didn't jump to line 393 because the condition on line 391 was always true
392 self._packageReferences.append(reference)
393 elif isinstance(reference, ContextReference):
394 self._contextReferences.append(reference)
395 else:
396 raise VHDLModelException() # FIXME: needs exception message
398 @property
399 def LibraryReferences(self) -> List[LibraryClause]:
400 return self._libraryReferences
402 @property
403 def PackageReferences(self) -> List[UseClause]:
404 return self._packageReferences
406 @property
407 def ContextReferences(self) -> List[ContextReference]:
408 return self._contextReferences
410 def __str__(self) -> str:
411 lib = self._parent._identifier + "?" if self._parent is not None else ""
413 return f"Context: {lib}.{self._identifier}"
416@export
417class Package(PrimaryUnit, DesignUnitWithContextMixin, WithGenericsMixin, ConcurrentDeclarationRegionMixin, AllowBlackboxMixin):
418 """
419 Represents a package declaration.
421 .. admonition:: Example
423 .. code-block:: VHDL
425 package pkg is
426 -- ...
427 end package;
428 """
430 _packageBody: Nullable["PackageBody"]
432 _deferredConstants: Dict[str, DeferredConstant]
433 _components: Dict[str, 'Component']
435 def __init__(
436 self,
437 identifier: str,
438 contextItems: Nullable[Iterable[ContextUnion]] = None,
439 genericItems: Nullable[Iterable[GenericInterfaceItemMixin]] = None,
440 declaredItems: Nullable[Iterable] = None,
441 documentation: Nullable[str] = None,
442 allowBlackbox: Nullable[bool] = None,
443 parent: Nullable[ModelEntity] = None
444 ) -> None:
445 """
446 Initialize a package.
448 :param identifier: Name of the VHDL package.
449 :param contextItems:
450 :param genericItems:
451 :param declaredItems:
452 :param documentation:
453 :param allowBlackbox: Specify if blackboxes are allowed in this design.
454 :param parent: The parent model entity (library) of this VHDL package.
455 """
456 super().__init__(identifier, contextItems, documentation, parent)
457 DesignUnitWithContextMixin.__init__(self)
458 WithGenericsMixin.__init__(self, genericItems)
459 ConcurrentDeclarationRegionMixin.__init__(self, declaredItems)
460 AllowBlackboxMixin.__init__(self, allowBlackbox)
462 self._packageBody = None
464 self._deferredConstants = {}
465 self._components = {}
467 @property
468 def PackageBody(self) -> Nullable["PackageBody"]:
469 return self._packageBody
471 @property
472 def DeclaredItems(self) -> List:
473 return self._declaredItems
475 @property
476 def DeferredConstants(self):
477 return self._deferredConstants
479 @property
480 def Components(self):
481 return self._components
483 def _IndexOtherDeclaredItem(self, item):
484 if isinstance(item, DeferredConstant):
485 for normalizedIdentifier in item.NormalizedIdentifiers:
486 self._deferredConstants[normalizedIdentifier] = item
487 elif isinstance(item, Component):
488 self._components[item._normalizedIdentifier] = item
489 else:
490 super()._IndexOtherDeclaredItem(item)
492 def __str__(self) -> str:
493 lib = self._parent._identifier if self._parent is not None else "%"
495 return f"Package: '{lib}.{self._identifier}'"
497 def __repr__(self) -> str:
498 lib = self._parent._identifier if self._parent is not None else "%"
500 return f"{lib}.{self._identifier}"
503@export
504class PackageBody(SecondaryUnit, DesignUnitWithContextMixin, ConcurrentDeclarationRegionMixin):
505 """
506 Represents a package body declaration.
508 .. admonition:: Example
510 .. code-block:: VHDL
512 package body pkg is
513 -- ...
514 end package body;
515 """
517 _package: PackageSymbol
519 def __init__(
520 self,
521 packageSymbol: PackageSymbol,
522 contextItems: Nullable[Iterable[ContextUnion]] = None,
523 declaredItems: Nullable[Iterable] = None,
524 documentation: Nullable[str] = None,
525 parent: Nullable[ModelEntity] = None
526 ) -> None:
527 super().__init__(packageSymbol.Name.Identifier, contextItems, documentation, parent)
528 DesignUnitWithContextMixin.__init__(self)
529 ConcurrentDeclarationRegionMixin.__init__(self, declaredItems)
531 self._package = packageSymbol
532 packageSymbol.Parent = self
534 @property
535 def Package(self) -> PackageSymbol:
536 return self._package
538 @property
539 def DeclaredItems(self) -> List:
540 return self._declaredItems
542 def LinkDeclaredItemsToPackage(self) -> None:
543 pass
545 def __str__(self) -> str:
546 lib = self._parent._identifier + "?" if self._parent is not None else ""
548 return f"Package Body: {lib}.{self._identifier}(body)"
550 def __repr__(self) -> str:
551 lib = self._parent._identifier + "?" if self._parent is not None else ""
553 return f"{lib}.{self._identifier}(body)"
556@export
557class Entity(PrimaryUnit, DesignUnitWithContextMixin, WithGenericsMixin, WithPortsMixin, ConcurrentDeclarationRegionMixin, ConcurrentStatementsMixin, AllowBlackboxMixin):
558 """
559 Represents an entity declaration.
561 .. admonition:: Example
563 .. code-block:: VHDL
565 entity ent is
566 -- ...
567 end entity;
568 """
570 _architectures: Dict[str, 'Architecture']
572 def __init__(
573 self,
574 identifier: str,
575 contextItems: Nullable[Iterable[ContextUnion]] = None,
576 genericItems: Nullable[Iterable[GenericInterfaceItemMixin]] = None,
577 portItems: Nullable[Iterable[PortInterfaceItemMixin]] = None,
578 declaredItems: Nullable[Iterable] = None,
579 statements: Nullable[Iterable[ConcurrentStatement]] = None,
580 documentation: Nullable[str] = None,
581 allowBlackbox: Nullable[bool] = None,
582 parent: Nullable[ModelEntity] = None
583 ) -> None:
584 super().__init__(identifier, contextItems, documentation, parent)
585 DesignUnitWithContextMixin.__init__(self)
586 WithGenericsMixin.__init__(self, genericItems)
587 WithPortsMixin.__init__(self, portItems)
588 ConcurrentDeclarationRegionMixin.__init__(self, declaredItems)
589 ConcurrentStatementsMixin.__init__(self, statements)
590 AllowBlackboxMixin.__init__(self, allowBlackbox)
592 self._architectures = {}
594 @property
595 def Architectures(self) -> Dict[str, 'Architecture']:
596 return self._architectures
598 def __str__(self) -> str:
599 lib = self._parent._identifier if self._parent is not None else "%"
600 archs = ', '.join(self._architectures.keys()) if self._architectures else "%"
602 return f"Entity: '{lib}.{self._identifier}({archs})'"
604 def __repr__(self) -> str:
605 lib = self._parent._identifier if self._parent is not None else "%"
606 archs = ', '.join(self._architectures.keys()) if self._architectures else "%"
608 return f"{lib}.{self._identifier}({archs})"
611@export
612class Architecture(SecondaryUnit, DesignUnitWithContextMixin, ConcurrentDeclarationRegionMixin, ConcurrentStatementsMixin, AllowBlackboxMixin):
613 """
614 Represents an architecture declaration.
616 .. admonition:: Example
618 .. code-block:: VHDL
620 architecture rtl of ent is
621 -- ...
622 begin
623 -- ...
624 end architecture;
625 """
627 _entity: EntitySymbol
629 def __init__(
630 self,
631 identifier: str,
632 entity: EntitySymbol,
633 contextItems: Nullable[Iterable[Context]] = None,
634 declaredItems: Nullable[Iterable] = None,
635 statements: Iterable['ConcurrentStatement'] = None,
636 documentation: Nullable[str] = None,
637 allowBlackbox: Nullable[bool] = None,
638 parent: Nullable[ModelEntity] = None
639 ) -> None:
640 super().__init__(identifier, contextItems, documentation, parent)
641 DesignUnitWithContextMixin.__init__(self)
642 ConcurrentDeclarationRegionMixin.__init__(self, declaredItems)
643 ConcurrentStatementsMixin.__init__(self, statements)
644 AllowBlackboxMixin.__init__(self, allowBlackbox)
646 self._entity = entity
647 entity.Parent = self
649 @property
650 def Entity(self) -> EntitySymbol: # FIXME: change to entitySymbol, offer entity directly, but raise exception if not resolved.
651 return self._entity
653 def __str__(self) -> str:
654 lib = self._parent._identifier if self._parent is not None else "%"
655 ent = self._entity._name._identifier if self._entity is not None else "%"
657 return f"Architecture: {lib}.{ent}({self._identifier})"
659 def __repr__(self) -> str:
660 lib = self._parent._identifier if self._parent is not None else "%"
661 ent = self._entity._name._identifier if self._entity is not None else "%"
663 return f"{lib}.{ent}({self._identifier})"
666@export
667class Component(ModelEntity, NamedEntityMixin, DocumentedEntityMixin, AllowBlackboxMixin):
668 """
669 Represents a configuration declaration.
671 .. admonition:: Example
673 .. code-block:: VHDL
675 component ent is
676 -- ...
677 end component;
678 """
680 _isBlackBox: Nullable[bool] #: Component is a blackbox.
682 _genericItems: List[GenericInterfaceItemMixin]
683 _portItems: List[PortInterfaceItemMixin]
685 _entity: Nullable[Entity]
687 def __init__(
688 self,
689 identifier: str,
690 genericItems: Nullable[Iterable[GenericInterfaceItemMixin]] = None,
691 portItems: Nullable[Iterable[PortInterfaceItemMixin]] = None,
692 documentation: Nullable[str] = None,
693 allowBlackbox: Nullable[bool] = None,
694 parent: Nullable[ModelEntity] = None
695 ) -> None:
696 super().__init__(parent)
697 NamedEntityMixin.__init__(self, identifier)
698 DocumentedEntityMixin.__init__(self, documentation)
699 AllowBlackboxMixin.__init__(self, allowBlackbox)
701 self._isBlackBox = None
702 self._entity = None
704 # TODO: extract to mixin
705 self._genericItems = []
706 if genericItems is not None:
707 for item in genericItems:
708 self._genericItems.append(item)
709 item.Parent = self
711 # TODO: extract to mixin
712 self._portItems = []
713 if portItems is not None:
714 for item in portItems:
715 self._portItems.append(item)
716 item.Parent = self
718 @property
719 def IsBlackbox(self) -> Nullable[bool]:
720 """
721 Read-only property returning true, if this component is a blackbox (:attr:`_isBlackbox`).
723 If components were not linked to matching entities, this property returns None.
725 :returns: If this component is a blackbox.
726 """
727 return self._isBlackBox
729 @property
730 def GenericItems(self) -> List[GenericInterfaceItemMixin]:
731 return self._genericItems
733 @property
734 def PortItems(self) -> List[PortInterfaceItemMixin]:
735 return self._portItems
737 @property
738 def Entity(self) -> Nullable[Entity]:
739 return self._entity
741 @Entity.setter
742 def Entity(self, value: Entity) -> None:
743 self._entity = value
744 self._isBlackBox = False
746 def __str__(self) -> str:
747 return f"Component: {self._identifier}"
749 def __repr__(self) -> str:
750 if isinstance(self._parent, Package):
751 return f"{self._parent!r}:{self._identifier}"
752 elif isinstance(self._parent, Architecture):
753 return f"{self._parent!r}:{self._identifier}"
756@export
757class Configuration(PrimaryUnit, DesignUnitWithContextMixin):
758 """
759 Represents a configuration declaration.
761 .. admonition:: Example
763 .. code-block:: VHDL
765 configuration cfg of ent is
766 for rtl
767 -- ...
768 end for;
769 end configuration;
770 """
772 def __init__(
773 self,
774 identifier: str,
775 contextItems: Nullable[Iterable[Context]] = None,
776 documentation: Nullable[str] = None,
777 parent: Nullable[ModelEntity] = None
778 ) -> None:
779 super().__init__(identifier, contextItems, documentation, parent)
780 DesignUnitWithContextMixin.__init__(self)
782 def __str__(self) -> str:
783 lib = self._parent._identifier if self._parent is not None else "%"
785 return f"Configuration: {lib}.{self._identifier}"
787 def __repr__(self) -> str:
788 lib = self._parent._identifier if self._parent is not None else "%"
790 return f"{lib}.{self._identifier}"