Coverage for pyVHDLModel/Exception.py: 98%
864 statements
« prev ^ index » next coverage.py v7.17.5, created at 2026-11-27 21:08 +0000
« prev ^ index » next coverage.py v7.17.5, created at 2026-11-27 21:08 +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.
35The module ``Exceptions`` contains all structured errors that are raised by pyVHDLModel. Besides a default error
36message in english, each exception object contains one or multiple references to the exception's context.
37"""
38from __future__ import annotations
40from pathlib import Path
41from typing import TYPE_CHECKING, ClassVar, Generic, Optional as Nullable, TypeVar
43from pyTooling.Decorators import export, readonly
44from pyTooling.Exceptions import ExceptionBase, AlreadyInHierarchyError, DuplicateElementError, InUseError, \
45 NotAChildError as CommonNotAChildError, ElementNotFoundError, AmbiguousError, \
46 UnknownKindError as CommonUnknownKindError
47from pyTooling.Warning import Warning, CriticalWarning
49from pyVHDLModel.Symbol import Symbol
51if TYPE_CHECKING: # pragma: no cover
52 from pyVHDLModel import Document, IEEEFlavor, Library
53 from pyVHDLModel.Base import ModelEntity
54 from pyVHDLModel.Concurrent import ComponentInstantiation, EntityInstantiation
55 from pyVHDLModel.DesignUnit import Component as _Component, Context as _Context, DesignUnit as _DesignUnit, \
56 Architecture, Package as _Package, SecondaryUnit
57 from pyVHDLModel.Expression import Literal as _Literal
58 from pyVHDLModel.Instantiation import PackageInstantiation as _PackageInstantiation
59 from pyVHDLModel.Namespace import Namespace as _Namespace, Import as _Import
62ElementType = TypeVar("ElementType", bound="ModelEntity") #: Type of the model entity to remove, which is still in use.
63UsersType = TypeVar("UsersType", bound="ModelEntity") #: Type of the model entities still using it.
65_Symbol = Symbol # A field annotation of class Symbol, where the class has a property 'Symbol'.
68@export
69class VHDLModelWarning(Warning):
70 """
71 Base-class for the non-critical warnings raised by pyVHDLModel.
73 .. attention::
75 It's a non-critical warning: without a :class:`~pyTooling.Warning.WarningCollector` up the call-hierarchy, it's
76 dropped silently.
78 .. seealso::
80 * :class:`Not implemented warning <pyVHDLModel.Exception.NotImplementedWarning>`
81 * :class:`Blackbox warning <pyVHDLModel.Exception.BlackboxWarning>`
82 """
83 pass
86@export
87class NotImplementedWarning(VHDLModelWarning):
88 """
89 Raised when a language construct is recognised but not yet modelled.
91 .. attention::
93 It's a non-critical warning: without a :class:`~pyTooling.Warning.WarningCollector` up the call-hierarchy, it's
94 dropped silently.
95 """
97 _item: Nullable[ModelEntity] #: The model element of the construct.
99 def __init__(self, message: str, /, *, item: Nullable[ModelEntity] = None) -> None:
100 """
101 Initializes the warning with the construct that isn't modelled yet.
103 :param message: The warning's message.
104 :param item: Optional, the model element of the construct - a declared item, an expression, a symbol or an
105 instantiation. Default: ``None``.
106 """
107 super().__init__(message)
108 self._item = item
110 @readonly
111 def Item(self) -> Nullable[ModelEntity]:
112 """
113 Read-only property to access the model element of the construct (:attr:`_item`).
115 :returns: The model element, or ``None`` if the construct has none or it wasn't recorded.
116 """
117 return self._item
120@export
121class VHDLModelCriticalWarning(CriticalWarning):
122 """
123 Base-class for critical warnings that likely indicate a defect in the model or its input.
125 .. important::
127 As a critical warning, it must be collected by a :class:`~pyTooling.Warning.WarningCollector` up the
128 call-hierarchy, otherwise :exc:`~pyTooling.Warning.UnhandledCriticalWarningError` is raised.
130 .. seealso::
132 * :class:`Duplicate declaration warning <pyVHDLModel.Exception.DuplicateDeclarationWarning>`
133 * :class:`Unresolved name warning <pyVHDLModel.Exception.UnresolvedNameWarning>`
134 * :class:`Unresolved type mark warning <pyVHDLModel.Exception.UnresolvedTypeMarkWarning>`
135 * :class:`Incomplete type warning <pyVHDLModel.Exception.IncompleteTypeWarning>`
136 """
137 pass
140@export
141class DuplicateDeclarationWarning(VHDLModelCriticalWarning):
142 """
143 Raised when two declarations in one declarative region share an identifier.
145 VHDL rejects this as *identifier already used for a declaration*. Overloadable declarations -
146 subprograms differing in signature - are not reported. Afterwards, the namespace refers to the later declaration.
148 It's also raised, when a package linked to a package body is linked to another one
149 (:meth:`Library.LinkPackageBodies() <pyVHDLModel.Library.LinkPackageBodies>`). Afterwards, the package refers to the
150 later package body.
152 .. important::
154 As a critical warning, it must be collected by a :class:`~pyTooling.Warning.WarningCollector` up the
155 call-hierarchy, otherwise :exc:`~pyTooling.Warning.UnhandledCriticalWarningError` is raised.
156 """
158 _identifier: Nullable[str] #: The identifier declared twice.
159 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
160 _namespace: Nullable[_Namespace] #: The namespace of the declarative region declaring it.
161 _element: Nullable[ModelEntity] #: The new declaration.
162 _existing: Nullable[ModelEntity] #: The earlier declaration.
164 def __init__(
165 self,
166 message: str,
167 /, *,
168 identifier: Nullable[str] = None,
169 namespace: Nullable[_Namespace] = None,
170 element: Nullable[ModelEntity] = None,
171 existing: Nullable[ModelEntity] = None
172 ) -> None:
173 """
174 Initializes the warning with the identifier, the namespace and both declarations.
176 :param message: The warning's message.
177 :param identifier: Optional, the identifier declared twice. Default: ``None``.
178 :param namespace: Optional, the namespace of the declarative region declaring it. Default: ``None``.
179 :param element: Optional, the new declaration. Default: ``None``.
180 :param existing: Optional, the earlier declaration. Default: ``None``.
181 """
182 super().__init__(message)
183 self._identifier = identifier
184 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
185 self._namespace = namespace
186 self._element = element
187 self._existing = existing
189 @readonly
190 def Identifier(self) -> Nullable[str]:
191 """
192 Read-only property to access the identifier declared twice (:attr:`_identifier`).
194 :returns: The identifier, or ``None`` if it wasn't recorded.
195 """
196 return self._identifier
198 @readonly
199 def NormalizedIdentifier(self) -> Nullable[str]:
200 """
201 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
203 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
204 """
205 return self._normalizedIdentifier
207 @readonly
208 def Namespace(self) -> Nullable[_Namespace]:
209 """
210 Read-only property to access the namespace of the declarative region declaring it (:attr:`_namespace`).
212 :returns: The namespace, or ``None`` if it wasn't recorded.
213 """
214 return self._namespace
216 @readonly
217 def Element(self) -> Nullable[ModelEntity]:
218 """
219 Read-only property to access the new declaration (:attr:`_element`).
221 :returns: The declaration, or ``None`` if it wasn't recorded.
222 """
223 return self._element
225 @readonly
226 def Existing(self) -> Nullable[ModelEntity]:
227 """
228 Read-only property to access the earlier declaration (:attr:`_existing`).
230 :returns: The declaration, or ``None`` if it wasn't recorded.
231 """
232 return self._existing
235@export
236class UnresolvedNameWarning(VHDLModelCriticalWarning):
237 """
238 Raised when a name can't be resolved: no declaration of it is visible, or use clauses made conflicting declarations
239 potentially visible.
241 Also a use clause naming something it can't use is reported, e.g. an uninstantiated generic package. The model stays
242 usable, but the symbol of the name stays unresolved or imports nothing.
244 .. important::
246 As a critical warning, it must be collected by a :class:`~pyTooling.Warning.WarningCollector` up the
247 call-hierarchy, otherwise :exc:`~pyTooling.Warning.UnhandledCriticalWarningError` is raised.
248 """
250 _LABEL: ClassVar[str] = "Name" #: The kind of name, which starts the messages of a name lookup.
252 _symbol: _Symbol #: The unresolved symbol.
253 _place: ModelEntity #: The model entity containing the name, e.g. a use clause.
254 _namespaces: tuple[_Namespace, ...] #: The namespaces searched for the name, innermost first.
255 _conflicts: tuple[_Import, ...] #: The imported declarations conflicting with each other.
257 def __init__(
258 self,
259 message: str,
260 /, *,
261 symbol: _Symbol,
262 place: ModelEntity,
263 namespaces: tuple[_Namespace, ...],
264 conflicts: tuple[_Import, ...] = ()
265 ) -> None:
266 """
267 Initializes the warning with the unresolved symbol, its place, the searched namespaces and the conflicts.
269 :param message: The warning's message.
270 :param symbol: The unresolved symbol.
271 :param place: The model entity containing the name, e.g. a use clause or a declaration.
272 :param namespaces: The namespaces searched for the name, innermost first.
273 :param conflicts: Optional, the imported declarations conflicting with each other. Default: ``()``.
274 """
275 super().__init__(message)
276 self._symbol = symbol
277 self._place = place
278 self._namespaces = namespaces
279 self._conflicts = conflicts
281 @readonly
282 def Symbol(self) -> _Symbol:
283 """
284 Read-only property to access the unresolved symbol (:attr:`_symbol`).
286 :returns: The symbol.
287 """
288 return self._symbol
290 @readonly
291 def Place(self) -> ModelEntity:
292 """
293 Read-only property to access the model entity containing the name (:attr:`_place`).
295 :returns: The model entity, e.g. a use clause or a declaration.
296 """
297 return self._place
299 @readonly
300 def Namespaces(self) -> tuple[_Namespace, ...]:
301 """
302 Read-only property to access the namespaces searched for the name (:attr:`_namespaces`).
304 :returns: Tuple of namespaces, innermost first.
305 """
306 return self._namespaces
308 @readonly
309 def Conflicts(self) -> tuple[_Import, ...]:
310 """
311 Read-only property to access the imported declarations conflicting with each other (:attr:`_conflicts`).
313 :returns: Tuple of imported declarations with their use clauses, empty if there is no conflict.
314 """
315 return self._conflicts
318@export
319class UnresolvedTypeMarkWarning(UnresolvedNameWarning):
320 """
321 Raised when a type mark can't be resolved (:meth:`~pyVHDLModel.Design.ResolveTypeMarks`): no declaration of it is
322 visible, use clauses made conflicting declarations potentially visible, the prefix of an expanded name isn't a visible
323 package, or it denotes something else than a type or subtype.
325 Its place (:attr:`~UnresolvedNameWarning.Place`) is the declaration containing the type mark.
327 .. important::
329 As a critical warning, it must be collected by a :class:`~pyTooling.Warning.WarningCollector` up the
330 call-hierarchy, otherwise :exc:`~pyTooling.Warning.UnhandledCriticalWarningError` is raised.
331 """
333 _LABEL: ClassVar[str] = "Type mark" #: The kind of name, which starts the messages of a type mark lookup.
336@export
337class IncompleteTypeWarning(VHDLModelCriticalWarning):
338 """
339 Raised when an incomplete type declaration has no full type declaration later in the same declarative region.
341 .. important::
343 As a critical warning, it must be collected by a :class:`~pyTooling.Warning.WarningCollector` up the
344 call-hierarchy, otherwise :exc:`~pyTooling.Warning.UnhandledCriticalWarningError` is raised.
345 """
347 _incompleteType: ModelEntity #: The incomplete type declaration.
349 def __init__(self, message: str, /, *, incompleteType: ModelEntity) -> None:
350 """
351 Initializes the warning with the incomplete type declaration.
353 :param message: The warning's message.
354 :param incompleteType: The incomplete type declaration.
355 """
356 super().__init__(message)
357 self._incompleteType = incompleteType
359 @readonly
360 def IncompleteType(self) -> ModelEntity:
361 """
362 Read-only property to access the incomplete type declaration (:attr:`_incompleteType`).
364 :returns: The incomplete type declaration.
365 """
366 return self._incompleteType
369@export
370class BlackboxWarning(VHDLModelWarning):
371 """
372 Raised when a component could not be bound and is treated as a blackbox.
374 Only a component allowing blackboxes - set on it or inherited, e.g. from its library or design
375 (:attr:`~pyVHDLModel.Common.AllowBlackboxMixin.AllowBlackbox`) - becomes a blackbox, recorded in
376 :attr:`Component.IsBlackbox <pyVHDLModel.DesignUnit.Component.IsBlackbox>`. For any other component without an
377 entity, analysis raises a :exc:`VHDLModelException`.
379 .. attention::
381 It's a non-critical warning: without a :class:`~pyTooling.Warning.WarningCollector` up the call-hierarchy, it's
382 dropped silently.
383 """
385 _instance: Nullable[ComponentInstantiation] #: The component instantiation treated as a blackbox.
386 _component: Nullable[_Component] #: The component that couldn't be bound.
388 def __init__(
389 self,
390 message: str,
391 /, *,
392 instance: Nullable[ComponentInstantiation] = None,
393 component: Nullable[_Component] = None
394 ) -> None:
395 """
396 Initializes the warning with the instantiation and the component that couldn't be bound.
398 :param message: The warning's message.
399 :param instance: Optional, the component instantiation treated as a blackbox. Default: ``None``.
400 :param component: Optional, the component that couldn't be bound. Default: ``None``.
401 """
402 super().__init__(message)
403 self._instance = instance
404 self._component = component
406 @readonly
407 def Instance(self) -> Nullable[ComponentInstantiation]:
408 """
409 Read-only property to access the component instantiation treated as a blackbox (:attr:`_instance`).
411 :returns: The instantiation, or ``None`` if it wasn't recorded.
412 """
413 return self._instance
415 @readonly
416 def Component(self) -> Nullable[_Component]:
417 """
418 Read-only property to access the component that couldn't be bound (:attr:`_component`).
420 :returns: The component, or ``None`` if it wasn't recorded.
421 """
422 return self._component
425@export
426class VHDLModelException(ExceptionBase):
427 """
428 Base-class for all exceptions (errors) raised by pyVHDLModel.
430 .. seealso::
432 * :class:`Library exists in design error <pyVHDLModel.Exception.LibraryExistsInDesignError>`
433 * :class:`Registered to foreign design error <pyVHDLModel.Exception.LibraryRegisteredToForeignDesignError>`
434 * :class:`Library not registered error <pyVHDLModel.Exception.LibraryNotRegisteredError>`
435 * :class:`Entity exists in library error <pyVHDLModel.Exception.EntityExistsInLibraryError>`
436 * :class:`Architecture exists in library error <pyVHDLModel.Exception.ArchitectureExistsInLibraryError>`
437 * :class:`Package exists in library error <pyVHDLModel.Exception.PackageExistsInLibraryError>`
438 * :class:`Package body exists error <pyVHDLModel.Exception.PackageBodyExistsError>`
439 * :class:`Configuration exists in library error <pyVHDLModel.Exception.ConfigurationExistsInLibraryError>`
440 * :class:`Context exists in library error <pyVHDLModel.Exception.ContextExistsInLibraryError>`
441 * :class:`Referenced library not existing error <pyVHDLModel.Exception.ReferencedLibraryNotExistingError>`
442 * :class:`Already in design error <pyVHDLModel.Exception.AlreadyInDesignError>`
443 * :class:`Not a child error <pyVHDLModel.Exception.NotAChildError>`
444 * :class:`Duplicate generic error <pyVHDLModel.Exception.DuplicateGenericError>`
445 * :class:`Duplicate port error <pyVHDLModel.Exception.DuplicatePortError>`
446 * :class:`Duplicate parameter error <pyVHDLModel.Exception.DuplicateParameterError>`
447 * :class:`Not in namespace error <pyVHDLModel.Exception.NotInNamespaceError>`
448 * :class:`Duplicate declaration error <pyVHDLModel.Exception.DuplicateDeclarationError>`
449 * :class:`Duplicate association error <pyVHDLModel.Exception.DuplicateAssociationError>`
450 * :class:`Association order error <pyVHDLModel.Exception.AssociationOrderError>`
451 * :class:`Duplicate document error <pyVHDLModel.Exception.DuplicateDocumentError>`
452 * :class:`Duplicate design unit error <pyVHDLModel.Exception.DuplicateDesignUnitError>`
453 * :class:`Library in use error <pyVHDLModel.Exception.LibraryInUseError>`
454 * :class:`Library not found error <pyVHDLModel.Exception.LibraryNotFoundError>`
455 * :class:`Entity not found error <pyVHDLModel.Exception.EntityNotFoundError>`
456 * :class:`Package not found error <pyVHDLModel.Exception.PackageNotFoundError>`
457 * :class:`Configuration not found error <pyVHDLModel.Exception.ConfigurationNotFoundError>`
458 * :class:`Context not found error <pyVHDLModel.Exception.ContextNotFoundError>`
459 * :class:`VHDL writer error <pyVHDLModel.Exception.VHDLWriterError>`
460 * :class:`Literal error <pyVHDLModel.Exception.LiteralError>`
461 """
464@export
465class LibraryExistsInDesignError(VHDLModelException, DuplicateElementError):
466 """
467 This exception is raised, when the library is already existing in the design.
468 """
470 _library: Library #: The library involved in this error.
472 def __init__(self, message: str, /, *, library: Library) -> None:
473 """
474 Initializes the exception with a message and the library, which already exists in the design.
476 :param message: The exception message.
477 :param library: The library that already exists in the design.
478 """
479 super().__init__(message)
480 self._library = library
482 @readonly
483 def Library(self) -> Library:
484 """
485 Read-only property to access the duplicate library (:attr:`_library`).
487 :returns: Duplicate library (by name).
488 """
489 return self._library
492@export
493class LibraryRegisteredToForeignDesignError(VHDLModelException, AlreadyInHierarchyError):
494 """
495 This exception is raised, when the library is already registered to a foreign design.
496 """
498 _library: Library #: The library involved in this error.
500 def __init__(self, message: str, /, *, library: Library) -> None:
501 """
502 Initializes the exception with a message and the library, which is already registered to another design.
504 :param message: The exception message.
505 :param library: The library that is already registered to another design.
506 """
507 super().__init__(message)
508 self._library = library
510 @readonly
511 def Library(self) -> Library:
512 """
513 Read-only property to access the library (:attr:`_library`).
515 :returns: The library.
516 """
517 return self._library
520@export
521class LibraryNotRegisteredError(VHDLModelException):
522 """
523 This exception is raised, when the library is not registered in the design.
524 """
526 _library: Library #: The library involved in this error.
528 def __init__(self, message: str, /, *, library: Library) -> None:
529 """
530 Initializes the exception with a message and the library, which isn't registered in the design.
532 :param message: The exception message.
533 :param library: The library that isn't registered in the design.
534 """
535 super().__init__(message)
536 self._library = library
538 @readonly
539 def Library(self) -> Library:
540 """
541 Read-only property to access the library (:attr:`_library`).
543 :returns: The library.
544 """
545 return self._library
548@export
549class EntityExistsInLibraryError(VHDLModelException, DuplicateElementError):
550 """
551 This exception is raised, when the entity already existing in the library.
552 """
554 _library: Library #: The library involved in this error.
555 _entity: Entity #: The entity involved in this error.
557 def __init__(self, message: str, /, *, entity: Entity, library: Library) -> None:
558 """
559 Initializes the exception with a message, the entity and the library, which already contains it.
561 :param message: The exception message.
562 :param entity: The entity that already exists in the library.
563 :param library: The library that already contains the entity.
564 """
565 super().__init__(message)
566 self._library = library
567 self._entity = entity
569 @readonly
570 def Library(self) -> Library:
571 """
572 Read-only property to access the library (:attr:`_library`).
574 :returns: The library.
575 """
576 return self._library
578 @readonly
579 def Entity(self) -> Entity:
580 """
581 Read-only property to access the entity (:attr:`_entity`).
583 :returns: The entity.
584 """
585 return self._entity
588@export
589class ArchitectureExistsInLibraryError(VHDLModelException, DuplicateElementError):
590 """
591 This exception is raised, when the architecture already existing in the library.
592 """
594 _library: Library #: The library involved in this error.
595 _architecture: Architecture #: The architecture involved in this error.
597 def __init__(self, message: str, /, *, architecture: Architecture, library: Library) -> None:
598 """
599 Initializes the exception with a message, the architecture and the library, which already contains it.
601 :param message: The exception message.
602 :param architecture: The architecture that already exists in the library.
603 :param library: The library that already contains the architecture.
604 """
605 super().__init__(message)
606 self._library = library
607 self._architecture = architecture
609 @readonly
610 def Library(self) -> Library:
611 """
612 Read-only property to access the library (:attr:`_library`).
614 :returns: The library.
615 """
616 return self._library
618 @readonly
619 def Architecture(self) -> Architecture:
620 """
621 Read-only property to access the architecture (:attr:`_architecture`).
623 :returns: The architecture.
624 """
625 return self._architecture
628@export
629class PackageExistsInLibraryError(VHDLModelException, DuplicateElementError):
630 """
631 This exception is raised, when the package already existing in the library.
632 """
634 _library: Library #: The library involved in this error.
635 _package: Package #: The package involved in this error.
637 def __init__(self, message: str, /, *, package: Package, library: Library) -> None:
638 """
639 Initializes the exception with a message, the package and the library, which already contains it.
641 :param message: The exception message.
642 :param package: The package that already exists in the library.
643 :param library: The library that already contains the package.
644 """
645 super().__init__(message)
646 self._library = library
647 self._package = package
649 @readonly
650 def Library(self) -> Library:
651 """
652 Read-only property to access the library (:attr:`_library`).
654 :returns: The library.
655 """
656 return self._library
658 @readonly
659 def Package(self) -> Package:
660 """
661 Read-only property to access the package (:attr:`_package`).
663 :returns: The package.
664 """
665 return self._package
668@export
669class PackageBodyExistsError(VHDLModelException, DuplicateElementError):
670 """
671 This exception is raised, when the package body already existing in the library.
672 """
674 _library: Library #: The library involved in this error.
675 _packageBody: PackageBody #: The package body involved in this error.
677 def __init__(self, message: str, /, *, packageBody: PackageBody, library: Library) -> None:
678 """
679 Initializes the exception with a message, the package body and the library, which already contains it.
681 :param message: The exception message.
682 :param packageBody: The package body that already exists in the library.
683 :param library: The library that already contains the package body.
684 """
685 super().__init__(message)
686 self._library = library
687 self._packageBody = packageBody
689 @readonly
690 def Library(self) -> Library:
691 """
692 Read-only property to access the library (:attr:`_library`).
694 :returns: The library.
695 """
696 return self._library
698 @readonly
699 def PackageBody(self) -> PackageBody:
700 """
701 Read-only property to access the package body (:attr:`_packageBody`).
703 :returns: The package body.
704 """
705 return self._packageBody
708@export
709class ConfigurationExistsInLibraryError(VHDLModelException, DuplicateElementError):
710 """
711 This exception is raised, when the configuration already existing in the library.
712 """
714 _library: Library #: The library involved in this error.
715 _configuration: Configuration #: The configuration involved in this error.
717 def __init__(self, message: str, /, *, configuration: Configuration, library: Library) -> None:
718 """
719 Initializes the exception with a message, the configuration and the library, which already contains it.
721 :param message: The exception message.
722 :param configuration: The configuration that already exists in the library.
723 :param library: The library that already contains the configuration.
724 """
725 super().__init__(message)
726 self._library = library
727 self._configuration = configuration
729 @readonly
730 def Library(self) -> Library:
731 """
732 Read-only property to access the library (:attr:`_library`).
734 :returns: The library.
735 """
736 return self._library
738 @readonly
739 def Configuration(self) -> Configuration:
740 """
741 Read-only property to access the configuration (:attr:`_configuration`).
743 :returns: The configuration.
744 """
745 return self._configuration
748@export
749class ContextExistsInLibraryError(VHDLModelException, DuplicateElementError):
750 """
751 This exception is raised, when the context already existing in the library.
752 """
754 _library: Library #: The library involved in this error.
755 _context: Context #: The context involved in this error.
757 def __init__(self, message: str, /, *, context: Context, library: Library) -> None:
758 """
759 Initializes the exception with a message, the context and the library, which already contains it.
761 :param message: The exception message.
762 :param context: The context that already exists in the library.
763 :param library: The library that already contains the context.
764 """
765 super().__init__(message)
766 self._library = library
767 self._context = context
769 @readonly
770 def Library(self) -> Library:
771 """
772 Read-only property to access the library (:attr:`_library`).
774 :returns: The library.
775 """
776 return self._library
778 @readonly
779 def Context(self) -> Context:
780 """
781 Read-only property to access the context (:attr:`_context`).
783 :returns: The context.
784 """
785 return self._context
788@export
789class LibraryNotInDesignError(VHDLModelException, ElementNotFoundError):
790 """
791 The exception is raised when a library is referenced or looked up by name, but doesn't exist in the design.
793 It's a :exc:`VHDLModelException` and a common base: a kind-specific exception derives from it, e.g.
794 ``class LibraryNotFoundError(LibraryNotInDesignError)``. It has no initializer of its own; the
795 derived exception sets the fields.
796 It also derives from pyTooling's common base :exc:`pyTooling.Exceptions.ElementNotFoundError`, so it's a
797 :exc:`LookupError`.
799 .. seealso::
801 :exc:`~pyVHDLModel.Exception.LibraryNotFoundError`
802 |rarr| Library looked up by name not found.
803 :exc:`~pyVHDLModel.Exception.ReferencedLibraryNotExistingError`
804 |rarr| Library of a context declaration's library clause not found.
805 :exc:`~pyVHDLModel.Exception.LibraryClauseLibraryNotFoundError`
806 |rarr| Library of a design unit's library clause not found.
807 :exc:`~pyVHDLModel.Exception.PackageInstantiationLibraryNotFoundError`
808 |rarr| Library of a package instantiation's generic package not found.
809 :exc:`~pyVHDLModel.Exception.EntityInstantiationLibraryNotFoundError`
810 |rarr| Library of a direct entity instantiation not found.
811 """
813 _libraryName: str #: The name of the library, which was not found.
815 @readonly
816 def LibraryName(self) -> str:
817 """
818 Read-only property to access the library name (:attr:`_libraryName`).
820 :returns: The name of the library, which was not found.
821 """
822 return self._libraryName
825@export
826class ReferencedLibraryNotExistingError(LibraryNotInDesignError):
827 """
828 This exception is raised, when a library is referenced by a `library clause`, but doesn't exist in the design.
829 """
831 _librarySymbol: Symbol #: The library symbol that could not be resolved.
832 _context: Context #: The context involved in this error.
834 def __init__(self, message: str, /, *, context: Context, librarySymbol: Symbol) -> None:
835 """
836 Initializes the exception with a message, the context and the unresolved library symbol of its library clause.
838 :param message: The exception message.
839 :param context: The context containing the library clause.
840 :param librarySymbol: The library symbol that could not be resolved.
841 """
842 super().__init__(message)
843 self._libraryName = librarySymbol.Name._identifier
844 self._librarySymbol = librarySymbol
845 self._context = context
847 @readonly
848 def LibrarySymbol(self) -> Symbol:
849 """
850 Read-only property to access the library symbol (:attr:`_librarySymbol`).
852 :returns: The library symbol.
853 """
854 return self._librarySymbol
856 @readonly
857 def Context(self) -> Context:
858 """
859 Read-only property to access the context (:attr:`_context`).
861 :returns: The context.
862 """
863 return self._context
866@export
867class AlreadyInDesignError(VHDLModelException, AlreadyInHierarchyError):
868 """
869 This exception is raised, when a model entity is added to a parent, but it already has a parent.
871 .. hint::
873 Remove the model entity from its current parent first, e.g. by
874 :meth:`~pyVHDLModel.Regions.WithGenericsMixin.RemoveGenericItem`.
875 """
877 _element: Nullable[ModelEntity] #: The model entity to add.
878 _parent: Nullable[ModelEntity] #: The model entity's current parent.
880 def __init__(
881 self,
882 message: str,
883 /, *,
884 element: Nullable[ModelEntity] = None,
885 parent: Nullable[ModelEntity] = None
886 ) -> None:
887 """
888 Initializes the exception with the model entity and its current parent.
890 :param message: The error message.
891 :param element: Optional, the model entity to add. Default: ``None``.
892 :param parent: Optional, the model entity's current parent. Default: ``None``.
893 """
894 super().__init__(message)
895 self._element = element
896 self._parent = parent
898 @readonly
899 def Element(self) -> Nullable[ModelEntity]:
900 """
901 Read-only property to access the model entity to add (:attr:`_element`).
903 :returns: The model entity, or ``None`` if it wasn't recorded.
904 """
905 return self._element
907 @readonly
908 def Parent(self) -> Nullable[ModelEntity]:
909 """
910 Read-only property to access the model entity's current parent (:attr:`_parent`).
912 :returns: The parent, or ``None`` if it wasn't recorded.
913 """
914 return self._parent
917@export
918class NotAChildError(VHDLModelException, CommonNotAChildError):
919 """
920 This exception is raised, when a model entity is removed from a parent, but it isn't a child of that parent.
921 """
923 _element: Nullable[ModelEntity] #: The model entity, which isn't a child.
924 _parent: Nullable[ModelEntity] #: The model entity searched for the child.
926 def __init__(
927 self,
928 message: str,
929 /, *,
930 element: Nullable[ModelEntity] = None,
931 parent: Nullable[ModelEntity] = None
932 ) -> None:
933 """
934 Initializes the exception with the model entity and the parent searched for it.
936 :param message: The error message.
937 :param element: Optional, the model entity, which isn't a child. Default: ``None``.
938 :param parent: Optional, the model entity searched for the child. Default: ``None``.
939 """
940 super().__init__(message)
941 self._element = element
942 self._parent = parent
944 @readonly
945 def Element(self) -> Nullable[ModelEntity]:
946 """
947 Read-only property to access the model entity, which isn't a child (:attr:`_element`).
949 :returns: The model entity, or ``None`` if it wasn't recorded.
950 """
951 return self._element
953 @readonly
954 def Parent(self) -> Nullable[ModelEntity]:
955 """
956 Read-only property to access the model entity searched for the child (:attr:`_parent`).
958 :returns: The parent, or ``None`` if it wasn't recorded.
959 """
960 return self._parent
963@export
964class NotInNamespaceError(VHDLModelException, KeyError):
965 """
966 This exception is raised, when an element isn't declared in a namespace under the given identifier.
968 It's a :exc:`KeyError` too, like removing a missing key from a dictionary.
969 """
971 _identifier: Nullable[str] #: The identifier looked up.
972 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
973 _namespace: Nullable[_Namespace] #: The namespace searched for the identifier.
975 def __init__(
976 self,
977 message: str,
978 /, *,
979 identifier: Nullable[str] = None,
980 namespace: Nullable[_Namespace] = None
981 ) -> None:
982 """
983 Initializes the exception with the identifier and the namespace searched for it.
985 :param message: The error message.
986 :param identifier: Optional, the identifier looked up. Default: ``None``.
987 :param namespace: Optional, the namespace searched for the identifier. Default: ``None``.
988 """
989 super().__init__(message)
990 self._identifier = identifier
991 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
992 self._namespace = namespace
994 @readonly
995 def Identifier(self) -> Nullable[str]:
996 """
997 Read-only property to access the identifier looked up (:attr:`_identifier`).
999 :returns: The identifier, or ``None`` if it wasn't recorded.
1000 """
1001 return self._identifier
1003 @readonly
1004 def NormalizedIdentifier(self) -> Nullable[str]:
1005 """
1006 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
1008 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1009 """
1010 return self._normalizedIdentifier
1012 @readonly
1013 def Namespace(self) -> Nullable[_Namespace]:
1014 """
1015 Read-only property to access the namespace searched for the identifier (:attr:`_namespace`).
1017 :returns: The namespace, or ``None`` if it wasn't recorded.
1018 """
1019 return self._namespace
1021 def __str__(self) -> str:
1022 """
1023 Return the exception's message.
1025 :returns: The message, without the quotes :exc:`KeyError` adds.
1026 """
1027 return self.args[0]
1030@export
1031class DuplicateGenericError(VHDLModelException, DuplicateElementError):
1032 """
1033 This exception is raised, when a language construct already has a generic of the same identifier.
1034 """
1036 _identifier: Nullable[str] #: The identifier declared twice.
1037 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
1038 _parent: Nullable[ModelEntity] #: The language construct owning the generic clause.
1039 _element: Nullable[ModelEntity] #: The new generic.
1040 _existing: Nullable[ModelEntity] #: The existing declaration.
1042 def __init__(
1043 self,
1044 message: str,
1045 /, *,
1046 identifier: Nullable[str] = None,
1047 parent: Nullable[ModelEntity] = None,
1048 element: Nullable[ModelEntity] = None,
1049 existing: Nullable[ModelEntity] = None
1050 ) -> None:
1051 """
1052 Initializes the exception with the identifier, the language construct and both declarations.
1054 :param message: The error message.
1055 :param identifier: Optional, the identifier declared twice. Default: ``None``.
1056 :param parent: Optional, the language construct owning the generic clause. Default: ``None``.
1057 :param element: Optional, the new generic. Default: ``None``.
1058 :param existing: Optional, the existing declaration. Default: ``None``.
1059 """
1060 super().__init__(message)
1061 self._identifier = identifier
1062 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
1063 self._parent = parent
1064 self._element = element
1065 self._existing = existing
1067 @readonly
1068 def Identifier(self) -> Nullable[str]:
1069 """
1070 Read-only property to access the identifier declared twice (:attr:`_identifier`).
1072 :returns: The identifier, or ``None`` if it wasn't recorded.
1073 """
1074 return self._identifier
1076 @readonly
1077 def NormalizedIdentifier(self) -> Nullable[str]:
1078 """
1079 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
1081 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1082 """
1083 return self._normalizedIdentifier
1085 @readonly
1086 def Parent(self) -> Nullable[ModelEntity]:
1087 """
1088 Read-only property to access the language construct owning the generic clause (:attr:`_parent`).
1090 :returns: The language construct, or ``None`` if it wasn't recorded.
1091 """
1092 return self._parent
1094 @readonly
1095 def Element(self) -> Nullable[ModelEntity]:
1096 """
1097 Read-only property to access the new generic (:attr:`_element`).
1099 :returns: The generic, or ``None`` if it wasn't recorded.
1100 """
1101 return self._element
1103 @readonly
1104 def Existing(self) -> Nullable[ModelEntity]:
1105 """
1106 Read-only property to access the existing declaration (:attr:`_existing`).
1108 :returns: The declaration, or ``None`` if it wasn't recorded.
1109 """
1110 return self._existing
1113@export
1114class DuplicatePortError(VHDLModelException, DuplicateElementError):
1115 """
1116 This exception is raised, when a language construct already has a port of the same identifier.
1117 """
1119 _identifier: Nullable[str] #: The identifier declared twice.
1120 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
1121 _parent: Nullable[ModelEntity] #: The language construct owning the port clause.
1122 _element: Nullable[ModelEntity] #: The new port.
1123 _existing: Nullable[ModelEntity] #: The existing declaration.
1125 def __init__(
1126 self,
1127 message: str,
1128 /, *,
1129 identifier: Nullable[str] = None,
1130 parent: Nullable[ModelEntity] = None,
1131 element: Nullable[ModelEntity] = None,
1132 existing: Nullable[ModelEntity] = None
1133 ) -> None:
1134 """
1135 Initializes the exception with the identifier, the language construct and both declarations.
1137 :param message: The error message.
1138 :param identifier: Optional, the identifier declared twice. Default: ``None``.
1139 :param parent: Optional, the language construct owning the port clause. Default: ``None``.
1140 :param element: Optional, the new port. Default: ``None``.
1141 :param existing: Optional, the existing declaration. Default: ``None``.
1142 """
1143 super().__init__(message)
1144 self._identifier = identifier
1145 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
1146 self._parent = parent
1147 self._element = element
1148 self._existing = existing
1150 @readonly
1151 def Identifier(self) -> Nullable[str]:
1152 """
1153 Read-only property to access the identifier declared twice (:attr:`_identifier`).
1155 :returns: The identifier, or ``None`` if it wasn't recorded.
1156 """
1157 return self._identifier
1159 @readonly
1160 def NormalizedIdentifier(self) -> Nullable[str]:
1161 """
1162 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
1164 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1165 """
1166 return self._normalizedIdentifier
1168 @readonly
1169 def Parent(self) -> Nullable[ModelEntity]:
1170 """
1171 Read-only property to access the language construct owning the port clause (:attr:`_parent`).
1173 :returns: The language construct, or ``None`` if it wasn't recorded.
1174 """
1175 return self._parent
1177 @readonly
1178 def Element(self) -> Nullable[ModelEntity]:
1179 """
1180 Read-only property to access the new port (:attr:`_element`).
1182 :returns: The port, or ``None`` if it wasn't recorded.
1183 """
1184 return self._element
1186 @readonly
1187 def Existing(self) -> Nullable[ModelEntity]:
1188 """
1189 Read-only property to access the existing declaration (:attr:`_existing`).
1191 :returns: The declaration, or ``None`` if it wasn't recorded.
1192 """
1193 return self._existing
1196@export
1197class DuplicateParameterError(VHDLModelException, DuplicateElementError):
1198 """
1199 This exception is raised, when a language construct already has a parameter of the same identifier.
1200 """
1202 _identifier: Nullable[str] #: The identifier declared twice.
1203 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
1204 _parent: Nullable[ModelEntity] #: The language construct owning the parameter list.
1205 _element: Nullable[ModelEntity] #: The new parameter.
1206 _existing: Nullable[ModelEntity] #: The existing declaration.
1208 def __init__(
1209 self,
1210 message: str,
1211 /, *,
1212 identifier: Nullable[str] = None,
1213 parent: Nullable[ModelEntity] = None,
1214 element: Nullable[ModelEntity] = None,
1215 existing: Nullable[ModelEntity] = None
1216 ) -> None:
1217 """
1218 Initializes the exception with the identifier, the language construct and both declarations.
1220 :param message: The error message.
1221 :param identifier: Optional, the identifier declared twice. Default: ``None``.
1222 :param parent: Optional, the language construct owning the parameter list. Default: ``None``.
1223 :param element: Optional, the new parameter. Default: ``None``.
1224 :param existing: Optional, the existing declaration. Default: ``None``.
1225 """
1226 super().__init__(message)
1227 self._identifier = identifier
1228 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
1229 self._parent = parent
1230 self._element = element
1231 self._existing = existing
1233 @readonly
1234 def Identifier(self) -> Nullable[str]:
1235 """
1236 Read-only property to access the identifier declared twice (:attr:`_identifier`).
1238 :returns: The identifier, or ``None`` if it wasn't recorded.
1239 """
1240 return self._identifier
1242 @readonly
1243 def NormalizedIdentifier(self) -> Nullable[str]:
1244 """
1245 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
1247 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1248 """
1249 return self._normalizedIdentifier
1251 @readonly
1252 def Parent(self) -> Nullable[ModelEntity]:
1253 """
1254 Read-only property to access the language construct owning the parameter list (:attr:`_parent`).
1256 :returns: The language construct, or ``None`` if it wasn't recorded.
1257 """
1258 return self._parent
1260 @readonly
1261 def Element(self) -> Nullable[ModelEntity]:
1262 """
1263 Read-only property to access the new parameter (:attr:`_element`).
1265 :returns: The parameter, or ``None`` if it wasn't recorded.
1266 """
1267 return self._element
1269 @readonly
1270 def Existing(self) -> Nullable[ModelEntity]:
1271 """
1272 Read-only property to access the existing declaration (:attr:`_existing`).
1274 :returns: The declaration, or ``None`` if it wasn't recorded.
1275 """
1276 return self._existing
1279@export
1280class DuplicateDeclarationError(VHDLModelException, DuplicateElementError):
1281 """
1282 This exception is raised, when a declarative region already declares an identifier of a declared item.
1284 It's raised for declared items without a more specific error, and it's the base-class of the more specific errors.
1285 Subprograms are overloadable, so a subprogram sharing its identifier with another subprogram is no duplicate.
1287 .. seealso::
1289 * :class:`Duplicate type error <pyVHDLModel.Exception.DuplicateTypeError>`
1290 * :class:`Duplicate subtype error <pyVHDLModel.Exception.DuplicateSubtypeError>`
1291 * :class:`Duplicate constant error <pyVHDLModel.Exception.DuplicateConstantError>`
1292 * :class:`Duplicate signal error <pyVHDLModel.Exception.DuplicateSignalError>`
1293 * :class:`Duplicate variable error <pyVHDLModel.Exception.DuplicateVariableError>`
1294 * :class:`Duplicate file error <pyVHDLModel.Exception.DuplicateFileError>`
1295 * :class:`Duplicate component error <pyVHDLModel.Exception.DuplicateComponentError>`
1296 * :class:`Duplicate subprogram error <pyVHDLModel.Exception.DuplicateSubprogramError>`
1297 * :class:`Duplicate label error <pyVHDLModel.Exception.DuplicateLabelError>`
1298 """
1300 _identifier: Nullable[str] #: The identifier declared twice.
1301 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
1302 _namespace: Nullable[_Namespace] #: The namespace of the declarative region declaring it.
1303 _element: Nullable[ModelEntity] #: The new declaration.
1304 _existing: Nullable[ModelEntity] #: The existing declaration.
1306 def __init__(
1307 self,
1308 message: str,
1309 /, *,
1310 identifier: Nullable[str] = None,
1311 namespace: Nullable[_Namespace] = None,
1312 element: Nullable[ModelEntity] = None,
1313 existing: Nullable[ModelEntity] = None
1314 ) -> None:
1315 """
1316 Initializes the exception with the identifier, the namespace and both declarations.
1318 :param message: The error message.
1319 :param identifier: Optional, the identifier declared twice. Default: ``None``.
1320 :param namespace: Optional, the namespace of the declarative region declaring it. Default: ``None``.
1321 :param element: Optional, the new declaration. Default: ``None``.
1322 :param existing: Optional, the existing declaration. Default: ``None``.
1323 """
1324 super().__init__(message)
1325 self._identifier = identifier
1326 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
1327 self._namespace = namespace
1328 self._element = element
1329 self._existing = existing
1331 @readonly
1332 def Identifier(self) -> Nullable[str]:
1333 """
1334 Read-only property to access the identifier declared twice (:attr:`_identifier`).
1336 :returns: The identifier, or ``None`` if it wasn't recorded.
1337 """
1338 return self._identifier
1340 @readonly
1341 def NormalizedIdentifier(self) -> Nullable[str]:
1342 """
1343 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
1345 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1346 """
1347 return self._normalizedIdentifier
1349 @readonly
1350 def Namespace(self) -> Nullable[_Namespace]:
1351 """
1352 Read-only property to access the namespace of the declarative region declaring it (:attr:`_namespace`).
1354 :returns: The namespace, or ``None`` if it wasn't recorded.
1355 """
1356 return self._namespace
1358 @readonly
1359 def Element(self) -> Nullable[ModelEntity]:
1360 """
1361 Read-only property to access the new declaration (:attr:`_element`).
1363 :returns: The declaration, or ``None`` if it wasn't recorded.
1364 """
1365 return self._element
1367 @readonly
1368 def Existing(self) -> Nullable[ModelEntity]:
1369 """
1370 Read-only property to access the existing declaration (:attr:`_existing`).
1372 :returns: The declaration, or ``None`` if it wasn't recorded.
1373 """
1374 return self._existing
1377@export
1378class DuplicateTypeError(DuplicateDeclarationError):
1379 """
1380 This exception is raised, when a declarative region already declares the identifier of a new type.
1381 """
1384@export
1385class DuplicateSubtypeError(DuplicateDeclarationError):
1386 """
1387 This exception is raised, when a declarative region already declares the identifier of a new subtype.
1388 """
1391@export
1392class DuplicateConstantError(DuplicateDeclarationError):
1393 """
1394 This exception is raised, when a declarative region already declares the identifier of a new constant.
1395 """
1398@export
1399class DuplicateSignalError(DuplicateDeclarationError):
1400 """
1401 This exception is raised, when a declarative region already declares the identifier of a new signal.
1402 """
1405@export
1406class DuplicateVariableError(DuplicateDeclarationError):
1407 """
1408 This exception is raised, when a declarative region already declares the identifier of a new (shared) variable.
1409 """
1412@export
1413class DuplicateFileError(DuplicateDeclarationError):
1414 """
1415 This exception is raised, when a declarative region already declares the identifier of a new file.
1416 """
1419@export
1420class DuplicateComponentError(DuplicateDeclarationError):
1421 """
1422 This exception is raised, when a declarative region already declares the identifier of a new component.
1423 """
1426@export
1427class DuplicateSubprogramError(DuplicateDeclarationError):
1428 """
1429 This exception is raised, when a declarative region already declares the identifier of a new subprogram.
1431 Subprograms are overloadable, so only a declaration other than a subprogram is a duplicate.
1432 """
1435@export
1436class DuplicateLabelError(DuplicateDeclarationError):
1437 """
1438 This exception is raised, when a declarative region already declares the label of a new statement.
1440 A statement label is declared implicitly in the declarative region enclosing the statement, so it clashes with
1441 another label and with a declaration of the same identifier.
1442 """
1445@export
1446class DuplicateAssociationError(VHDLModelException, DuplicateElementError):
1447 """
1448 This exception is raised, when an association list already associates the formal of a new named association.
1450 It's the base-class of the errors for generic, port and parameter associations.
1452 .. seealso::
1454 * :class:`Duplicate generic association error <pyVHDLModel.Exception.DuplicateGenericAssociationError>`
1455 * :class:`Duplicate port association error <pyVHDLModel.Exception.DuplicatePortAssociationError>`
1456 * :class:`Duplicate parameter association error <pyVHDLModel.Exception.DuplicateParameterAssociationError>`
1457 """
1459 _identifier: Nullable[str] #: The formal associated twice.
1460 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) formal.
1461 _parent: Nullable[ModelEntity] #: The language construct owning the association list.
1462 _element: Nullable[ModelEntity] #: The new association.
1463 _existing: Nullable[ModelEntity] #: The existing association.
1465 def __init__(
1466 self,
1467 message: str,
1468 /, *,
1469 identifier: Nullable[str] = None,
1470 parent: Nullable[ModelEntity] = None,
1471 element: Nullable[ModelEntity] = None,
1472 existing: Nullable[ModelEntity] = None
1473 ) -> None:
1474 """
1475 Initializes the exception with the formal, the language construct and both associations.
1477 :param message: The error message.
1478 :param identifier: Optional, the formal associated twice. Default: ``None``.
1479 :param parent: Optional, the language construct owning the association list. Default: ``None``.
1480 :param element: Optional, the new association. Default: ``None``.
1481 :param existing: Optional, the existing association. Default: ``None``.
1482 """
1483 super().__init__(message)
1484 self._identifier = identifier
1485 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
1486 self._parent = parent
1487 self._element = element
1488 self._existing = existing
1490 @readonly
1491 def Identifier(self) -> Nullable[str]:
1492 """
1493 Read-only property to access the formal associated twice (:attr:`_identifier`).
1495 :returns: The formal's identifier, or ``None`` if it wasn't recorded.
1496 """
1497 return self._identifier
1499 @readonly
1500 def NormalizedIdentifier(self) -> Nullable[str]:
1501 """
1502 Read-only property to access the normalized (lower case) formal (:attr:`_normalizedIdentifier`).
1504 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1505 """
1506 return self._normalizedIdentifier
1508 @readonly
1509 def Parent(self) -> Nullable[ModelEntity]:
1510 """
1511 Read-only property to access the language construct owning the association list (:attr:`_parent`).
1513 :returns: The language construct, or ``None`` if it wasn't recorded.
1514 """
1515 return self._parent
1517 @readonly
1518 def Element(self) -> Nullable[ModelEntity]:
1519 """
1520 Read-only property to access the new association (:attr:`_element`).
1522 :returns: The association, or ``None`` if it wasn't recorded.
1523 """
1524 return self._element
1526 @readonly
1527 def Existing(self) -> Nullable[ModelEntity]:
1528 """
1529 Read-only property to access the existing association (:attr:`_existing`).
1531 :returns: The association, or ``None`` if it wasn't recorded.
1532 """
1533 return self._existing
1536@export
1537class DuplicateGenericAssociationError(DuplicateAssociationError):
1538 """
1539 This exception is raised, when a generic map aspect already associates the formal of a new generic association.
1540 """
1543@export
1544class DuplicatePortAssociationError(DuplicateAssociationError):
1545 """
1546 This exception is raised, when a port map aspect already associates the formal of a new port association.
1547 """
1550@export
1551class DuplicateParameterAssociationError(DuplicateAssociationError):
1552 """
1553 This exception is raised, when a procedure call already associates the formal of a new parameter association.
1554 """
1557@export
1558class AssociationOrderError(VHDLModelException):
1559 """
1560 This exception is raised, when a new association breaks the order of an association list.
1562 All positional associations of an association list precede its named associations: the existing association is a
1563 named association preceding a new positional association, or a positional association following a new named
1564 association.
1565 """
1567 _parent: Nullable[ModelEntity] #: The language construct owning the association list.
1568 _element: Nullable[ModelEntity] #: The new association.
1569 _existing: Nullable[ModelEntity] #: The existing association, the new association is out of order with.
1571 def __init__(
1572 self,
1573 message: str,
1574 /, *,
1575 parent: Nullable[ModelEntity] = None,
1576 element: Nullable[ModelEntity] = None,
1577 existing: Nullable[ModelEntity] = None
1578 ) -> None:
1579 """
1580 Initializes the exception with the language construct and both associations.
1582 :param message: The error message.
1583 :param parent: Optional, the language construct owning the association list. Default: ``None``.
1584 :param element: Optional, the new association. Default: ``None``.
1585 :param existing: Optional, the existing association, the new association is out of order with. Default: ``None``.
1586 """
1587 super().__init__(message)
1588 self._parent = parent
1589 self._element = element
1590 self._existing = existing
1592 @readonly
1593 def Parent(self) -> Nullable[ModelEntity]:
1594 """
1595 Read-only property to access the language construct owning the association list (:attr:`_parent`).
1597 :returns: The language construct, or ``None`` if it wasn't recorded.
1598 """
1599 return self._parent
1601 @readonly
1602 def Element(self) -> Nullable[ModelEntity]:
1603 """
1604 Read-only property to access the new association (:attr:`_element`).
1606 :returns: The association, or ``None`` if it wasn't recorded.
1607 """
1608 return self._element
1610 @readonly
1611 def Existing(self) -> Nullable[ModelEntity]:
1612 """
1613 Read-only property to access the existing association, the new association is out of order with
1614 (:attr:`_existing`).
1616 :returns: The association, or ``None`` if it wasn't recorded.
1617 """
1618 return self._existing
1621@export
1622class DuplicateDocumentError(VHDLModelException, DuplicateElementError):
1623 """
1624 This exception is raised, when a design already contains a document of the same path.
1625 """
1627 _path: Nullable[Path] #: The path of both documents.
1628 _parent: Nullable[ModelEntity] #: The design containing the existing document.
1629 _element: Nullable[ModelEntity] #: The new document.
1630 _existing: Nullable[ModelEntity] #: The existing document.
1632 def __init__(
1633 self,
1634 message: str,
1635 /, *,
1636 path: Nullable[Path] = None,
1637 parent: Nullable[ModelEntity] = None,
1638 element: Nullable[ModelEntity] = None,
1639 existing: Nullable[ModelEntity] = None
1640 ) -> None:
1641 """
1642 Initializes the exception with the path, the design and both documents.
1644 :param message: The error message.
1645 :param path: Optional, the path of both documents. Default: ``None``.
1646 :param parent: Optional, the design containing the existing document. Default: ``None``.
1647 :param element: Optional, the new document. Default: ``None``.
1648 :param existing: Optional, the existing document. Default: ``None``.
1649 """
1650 super().__init__(message)
1651 self._path = path
1652 self._parent = parent
1653 self._element = element
1654 self._existing = existing
1656 @readonly
1657 def Path(self) -> Nullable[Path]:
1658 """
1659 Read-only property to access the path of both documents (:attr:`_path`).
1661 :returns: The path, or ``None`` if it wasn't recorded.
1662 """
1663 return self._path
1665 @readonly
1666 def Parent(self) -> Nullable[ModelEntity]:
1667 """
1668 Read-only property to access the design containing the existing document (:attr:`_parent`).
1670 :returns: The design, or ``None`` if it wasn't recorded.
1671 """
1672 return self._parent
1674 @readonly
1675 def Element(self) -> Nullable[ModelEntity]:
1676 """
1677 Read-only property to access the new document (:attr:`_element`).
1679 :returns: The document, or ``None`` if it wasn't recorded.
1680 """
1681 return self._element
1683 @readonly
1684 def Existing(self) -> Nullable[ModelEntity]:
1685 """
1686 Read-only property to access the existing document (:attr:`_existing`).
1688 :returns: The document, or ``None`` if it wasn't recorded.
1689 """
1690 return self._existing
1693@export
1694class DuplicateDesignUnitError(VHDLModelException, DuplicateElementError):
1695 """
1696 This exception is raised, when a document already contains a design unit of the same kind and identifier.
1698 An architecture is a duplicate, if the document contains an architecture of the same identifier for the same entity.
1699 """
1701 _identifier: Nullable[str] #: The identifier of both design units.
1702 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
1703 _parent: Nullable[ModelEntity] #: The document containing the existing design unit.
1704 _element: Nullable[ModelEntity] #: The new design unit.
1705 _existing: Nullable[ModelEntity] #: The existing design unit.
1707 def __init__(
1708 self,
1709 message: str,
1710 /, *,
1711 identifier: Nullable[str] = None,
1712 parent: Nullable[ModelEntity] = None,
1713 element: Nullable[ModelEntity] = None,
1714 existing: Nullable[ModelEntity] = None
1715 ) -> None:
1716 """
1717 Initializes the exception with the identifier, the document and both design units.
1719 :param message: The error message.
1720 :param identifier: Optional, the identifier of both design units. Default: ``None``.
1721 :param parent: Optional, the document containing the existing design unit. Default: ``None``.
1722 :param element: Optional, the new design unit. Default: ``None``.
1723 :param existing: Optional, the existing design unit. Default: ``None``.
1724 """
1725 super().__init__(message)
1726 self._identifier = identifier
1727 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
1728 self._parent = parent
1729 self._element = element
1730 self._existing = existing
1732 @readonly
1733 def Identifier(self) -> Nullable[str]:
1734 """
1735 Read-only property to access the identifier of both design units (:attr:`_identifier`).
1737 :returns: The identifier, or ``None`` if it wasn't recorded.
1738 """
1739 return self._identifier
1741 @readonly
1742 def NormalizedIdentifier(self) -> Nullable[str]:
1743 """
1744 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
1746 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1747 """
1748 return self._normalizedIdentifier
1750 @readonly
1751 def Parent(self) -> Nullable[ModelEntity]:
1752 """
1753 Read-only property to access the document containing the existing design unit (:attr:`_parent`).
1755 :returns: The document, or ``None`` if it wasn't recorded.
1756 """
1757 return self._parent
1759 @readonly
1760 def Element(self) -> Nullable[ModelEntity]:
1761 """
1762 Read-only property to access the new design unit (:attr:`_element`).
1764 :returns: The design unit, or ``None`` if it wasn't recorded.
1765 """
1766 return self._element
1768 @readonly
1769 def Existing(self) -> Nullable[ModelEntity]:
1770 """
1771 Read-only property to access the existing design unit (:attr:`_existing`).
1773 :returns: The design unit, or ``None`` if it wasn't recorded.
1774 """
1775 return self._existing
1778@export
1779class ElementInUseError(VHDLModelException, InUseError, Generic[ElementType, UsersType]):
1780 """
1781 The exception is raised when a model entity is removed, but other model entities still use it.
1783 It's the common base of the kind-specific exceptions: it carries the model entity to remove and the model entities
1784 still using it, whose types a derived exception states, e.g. ``LibraryInUseError(ElementInUseError[Library,
1785 Document])``.
1787 .. seealso::
1789 :exc:`~pyVHDLModel.Exception.LibraryInUseError`
1790 |rarr| Library still used by documents.
1791 """
1793 _element: Nullable[ElementType] #: The model entity to remove.
1794 _users: tuple[UsersType, ...] #: The model entities still using it.
1796 def __init__(
1797 self,
1798 message: str,
1799 /, *,
1800 element: Nullable[ElementType] = None,
1801 users: Nullable[tuple[UsersType, ...]] = None
1802 ) -> None:
1803 """
1804 Initializes the exception with the model entity to remove and the model entities still using it.
1806 :param message: The error message.
1807 :param element: Optional, the model entity to remove. Default: ``None``.
1808 :param users: Optional, the model entities still using it. Default: ``None``.
1809 """
1810 super().__init__(message)
1811 self._element = element
1812 self._users = () if users is None else users
1814 @readonly
1815 def Element(self) -> Nullable[ElementType]:
1816 """
1817 Read-only property to access the model entity to remove (:attr:`_element`).
1819 :returns: The model entity, or ``None`` if it wasn't recorded.
1820 """
1821 return self._element
1823 @readonly
1824 def Users(self) -> tuple[UsersType, ...]:
1825 """
1826 Read-only property to access the model entities still using the model entity to remove (:attr:`_users`).
1828 :returns: Tuple of model entities, empty if they weren't recorded.
1829 """
1830 return self._users
1833@export
1834class LibraryInUseError(ElementInUseError["Library", "Document"]):
1835 """
1836 This exception is raised, when a library is removed from a design, but documents of the design still use it.
1838 :attr:`Element` is the library, :attr:`Users` are the documents.
1840 .. hint::
1842 Remove the documents from the design first, e.g. by :meth:`~pyVHDLModel.Design.RemoveDocument`.
1843 """
1846@export
1847class LibraryNotFoundError(LibraryNotInDesignError):
1848 """
1849 This exception is raised, when a library is looked up by name, but doesn't exist in the design.
1850 """
1852 def __init__(self, message: str, /, *, libraryName: str) -> None:
1853 """
1854 Initializes the exception with a message and the name of the library, which was not found.
1856 :param message: The exception message.
1857 :param libraryName: The name of the library, which was not found.
1858 """
1859 super().__init__(message)
1860 self._libraryName = libraryName
1863@export
1864class LibraryClauseLibraryNotFoundError(LibraryNotInDesignError):
1865 """
1866 This exception is raised, when a library clause of a design unit references a library, which doesn't exist in the
1867 design.
1868 """
1870 _librarySymbol: _Symbol #: The library symbol that could not be resolved.
1871 _designUnit: _DesignUnit #: The design unit containing the library clause.
1873 def __init__(self, message: str, /, *, designUnit: _DesignUnit, librarySymbol: _Symbol) -> None:
1874 """
1875 Initializes the exception with a message, the design unit and the unresolved library symbol.
1877 :param message: The exception message.
1878 :param designUnit: The design unit containing the library clause.
1879 :param librarySymbol: The library symbol that could not be resolved.
1880 """
1881 super().__init__(message)
1882 self._libraryName = librarySymbol._name._identifier
1883 self._librarySymbol = librarySymbol
1884 self._designUnit = designUnit
1886 @readonly
1887 def LibrarySymbol(self) -> _Symbol:
1888 """
1889 Read-only property to access the library symbol (:attr:`_librarySymbol`).
1891 :returns: The library symbol.
1892 """
1893 return self._librarySymbol
1895 @readonly
1896 def DesignUnit(self) -> _DesignUnit:
1897 """
1898 Read-only property to access the design unit containing the library clause (:attr:`_designUnit`).
1900 :returns: The design unit.
1901 """
1902 return self._designUnit
1905@export
1906class PackageInstantiationLibraryNotFoundError(LibraryNotInDesignError):
1907 """
1908 This exception is raised, when a package instantiation references a library, which doesn't exist in the design.
1909 """
1911 _packageInstantiation: _PackageInstantiation #: The package instantiation referencing the library.
1913 def __init__(self, message: str, /, *, libraryName: str, packageInstantiation: _PackageInstantiation) -> None:
1914 """
1915 Initializes the exception with a message, the name of the missing library and the package instantiation.
1917 :param message: The exception message.
1918 :param libraryName: The name of the library, which was not found.
1919 :param packageInstantiation: The package instantiation referencing the generic package in that library.
1920 """
1921 super().__init__(message)
1922 self._libraryName = libraryName
1923 self._packageInstantiation = packageInstantiation
1925 @readonly
1926 def PackageInstantiation(self) -> _PackageInstantiation:
1927 """
1928 Read-only property to access the package instantiation (:attr:`_packageInstantiation`).
1930 :returns: The package instantiation referencing the library.
1931 """
1932 return self._packageInstantiation
1935@export
1936class EntityInstantiationLibraryNotFoundError(LibraryNotInDesignError):
1937 """
1938 This exception is raised, when a direct entity instantiation references a library, which doesn't exist in the design.
1939 """
1941 _instantiation: EntityInstantiation #: The direct entity instantiation referencing the library.
1943 def __init__(self, message: str, /, *, instantiation: EntityInstantiation) -> None:
1944 """
1945 Initializes the exception with a message and the direct entity instantiation referencing the missing library.
1947 :param message: The exception message.
1948 :param instantiation: The direct entity instantiation referencing the library.
1949 """
1950 super().__init__(message)
1951 self._libraryName = instantiation._entity._name._prefix._identifier
1952 self._instantiation = instantiation
1954 @readonly
1955 def Instantiation(self) -> EntityInstantiation:
1956 """
1957 Read-only property to access the direct entity instantiation (:attr:`_instantiation`).
1959 :returns: The direct entity instantiation referencing the library.
1960 """
1961 return self._instantiation
1964@export
1965class DesignUnitNotFoundError(VHDLModelException, ElementNotFoundError):
1966 """
1967 The exception is raised when a design unit is looked up by name, but doesn't exist in the searched library.
1969 It's a :exc:`VHDLModelException` and a common base: a kind-specific exception derives from it, e.g.
1970 ``class EntityNotFoundError(DesignUnitNotFoundError)``. It has no initializer of its own; the
1971 derived exception sets the fields.
1972 It also derives from pyTooling's common base :exc:`pyTooling.Exceptions.ElementNotFoundError`, so it's a
1973 :exc:`LookupError`.
1975 .. seealso::
1977 :exc:`~pyVHDLModel.Exception.EntityNotFoundError`
1978 |rarr| Entity not found.
1979 :exc:`~pyVHDLModel.Exception.PackageNotFoundError`
1980 |rarr| Package not found.
1981 :exc:`~pyVHDLModel.Exception.ConfigurationNotFoundError`
1982 |rarr| Configuration not found.
1983 :exc:`~pyVHDLModel.Exception.ContextNotFoundError`
1984 |rarr| Context not found.
1985 :exc:`~pyVHDLModel.Exception.ComponentEntityNotFoundError`
1986 |rarr| Entity of a component not found.
1987 :exc:`~pyVHDLModel.Exception.InstantiatedEntityNotFoundError`
1988 |rarr| Entity of a direct entity instantiation not found.
1989 :exc:`~pyVHDLModel.Exception.ArchitectureEntityNotFoundError`
1990 |rarr| Entity of architectures not found.
1991 :exc:`~pyVHDLModel.Exception.PackageBodyPackageNotFoundError`
1992 |rarr| Package of a package body not found.
1993 """
1995 _designUnitName: str #: The name of the design unit, which was not found.
1996 _libraryName: str #: The name of the searched library.
1998 @readonly
1999 def DesignUnitName(self) -> str:
2000 """
2001 Read-only property to access the design unit name (:attr:`_designUnitName`).
2003 :returns: The name of the design unit, which was not found.
2004 """
2005 return self._designUnitName
2007 @readonly
2008 def LibraryName(self) -> str:
2009 """
2010 Read-only property to access the library name (:attr:`_libraryName`).
2012 :returns: The name of the searched library.
2013 """
2014 return self._libraryName
2017@export
2018class EntityNotFoundError(DesignUnitNotFoundError):
2019 """
2020 This exception is raised, when an entity is looked up by name, but doesn't exist in the searched library.
2021 """
2023 def __init__(self, message: str, /, *, entityName: str, libraryName: str) -> None:
2024 """
2025 Initializes the exception with a message, the name of the entity, which was not found, and the library name.
2027 :param message: The exception message.
2028 :param entityName: The name of the entity, which was not found.
2029 :param libraryName: The name of the searched library.
2030 """
2031 super().__init__(message)
2032 self._designUnitName = entityName
2033 self._libraryName = libraryName
2036@export
2037class PackageNotFoundError(DesignUnitNotFoundError):
2038 """
2039 This exception is raised, when a package is looked up by name, but doesn't exist in the searched library.
2040 """
2042 def __init__(self, message: str, /, *, packageName: str, libraryName: str) -> None:
2043 """
2044 Initializes the exception with a message, the name of the package, which was not found, and the library name.
2046 :param message: The exception message.
2047 :param packageName: The name of the package, which was not found.
2048 :param libraryName: The name of the searched library.
2049 """
2050 super().__init__(message)
2051 self._designUnitName = packageName
2052 self._libraryName = libraryName
2055@export
2056class ConfigurationNotFoundError(DesignUnitNotFoundError):
2057 """
2058 This exception is raised, when a configuration is looked up by name, but doesn't exist in the searched library.
2059 """
2061 def __init__(self, message: str, /, *, configurationName: str, libraryName: str) -> None:
2062 """
2063 Initializes the exception with a message, the name of the configuration, which was not found, and the library name.
2065 :param message: The exception message.
2066 :param configurationName: The name of the configuration, which was not found.
2067 :param libraryName: The name of the searched library.
2068 """
2069 super().__init__(message)
2070 self._designUnitName = configurationName
2071 self._libraryName = libraryName
2074@export
2075class ContextNotFoundError(DesignUnitNotFoundError):
2076 """
2077 This exception is raised, when a context is looked up by name, but doesn't exist in the searched library.
2078 """
2080 def __init__(self, message: str, /, *, contextName: str, libraryName: str) -> None:
2081 """
2082 Initializes the exception with a message, the name of the context, which was not found, and the library name.
2084 :param message: The exception message.
2085 :param contextName: The name of the context, which was not found.
2086 :param libraryName: The name of the searched library.
2087 """
2088 super().__init__(message)
2089 self._designUnitName = contextName
2090 self._libraryName = libraryName
2093@export
2094class ComponentEntityNotFoundError(DesignUnitNotFoundError):
2095 """
2096 This exception is raised, when no entity matches a component, which doesn't allow blackboxes.
2097 """
2099 _component: _Component #: The component without a matching entity.
2101 def __init__(self, message: str, /, *, component: _Component, libraryName: str) -> None:
2102 """
2103 Initializes the exception with a message, the component without an entity and the name of the searched library.
2105 :param message: The exception message.
2106 :param component: The component without a matching entity.
2107 :param libraryName: The name of the searched library.
2108 """
2109 super().__init__(message)
2110 self._designUnitName = component._identifier
2111 self._libraryName = libraryName
2112 self._component = component
2114 @readonly
2115 def Component(self) -> _Component:
2116 """
2117 Read-only property to access the component (:attr:`_component`).
2119 :returns: The component without a matching entity.
2120 """
2121 return self._component
2124@export
2125class InstantiatedEntityNotFoundError(DesignUnitNotFoundError):
2126 """
2127 This exception is raised, when the entity of a direct entity instantiation doesn't exist in the referenced library.
2128 """
2130 _instantiation: EntityInstantiation #: The direct entity instantiation referencing the entity.
2132 def __init__(self, message: str, /, *, instantiation: EntityInstantiation, libraryName: str) -> None:
2133 """
2134 Initializes the exception with a message, the direct entity instantiation and the name of the searched library.
2136 :param message: The exception message.
2137 :param instantiation: The direct entity instantiation referencing the entity.
2138 :param libraryName: The name of the searched library.
2139 """
2140 super().__init__(message)
2141 self._designUnitName = instantiation._entity._name._identifier
2142 self._libraryName = libraryName
2143 self._instantiation = instantiation
2145 @readonly
2146 def Instantiation(self) -> EntityInstantiation:
2147 """
2148 Read-only property to access the direct entity instantiation (:attr:`_instantiation`).
2150 :returns: The direct entity instantiation referencing the entity.
2151 """
2152 return self._instantiation
2155@export
2156class ArchitectureEntityNotFoundError(DesignUnitNotFoundError):
2157 """
2158 This exception is raised, when the entity of one or more architectures doesn't exist in their library.
2159 """
2161 _architectureNames: tuple[str, ...] #: The names of the architectures referencing the entity.
2163 def __init__(
2164 self,
2165 message: str,
2166 /, *,
2167 entityName: str,
2168 architectureNames: tuple[str, ...],
2169 libraryName: str
2170 ) -> None:
2171 """
2172 Initializes the exception with a message, the missing entity's name, the architectures' names and the library name.
2174 :param message: The exception message.
2175 :param entityName: The name of the entity, which was not found.
2176 :param architectureNames: The names of the architectures referencing the entity.
2177 :param libraryName: The name of the searched library.
2178 """
2179 super().__init__(message)
2180 self._designUnitName = entityName
2181 self._libraryName = libraryName
2182 self._architectureNames = architectureNames
2184 @readonly
2185 def ArchitectureNames(self) -> tuple[str, ...]:
2186 """
2187 Read-only property to access the architecture names (:attr:`_architectureNames`).
2189 :returns: Tuple of names of the architectures referencing the entity.
2190 """
2191 return self._architectureNames
2194@export
2195class PackageBodyPackageNotFoundError(DesignUnitNotFoundError):
2196 """
2197 This exception is raised, when the package of a package body doesn't exist in its library.
2198 """
2200 def __init__(self, message: str, /, *, packageName: str, libraryName: str) -> None:
2201 """
2202 Initializes the exception with a message, the name of the missing package and the name of the searched library.
2204 :param message: The exception message.
2205 :param packageName: The name of the package, which was not found.
2206 :param libraryName: The name of the searched library.
2207 """
2208 super().__init__(message)
2209 self._designUnitName = packageName
2210 self._libraryName = libraryName
2213@export
2214class NotLinkedError(VHDLModelException):
2215 """
2216 The exception is raised when a linking step of the analysis didn't run before a step, which needs its result.
2218 It's a :exc:`VHDLModelException` and a common base: a kind-specific exception derives from it, e.g.
2219 ``class UseClauseNotLinkedError(NotLinkedError)``. It has no initializer and no fields of its
2220 own.
2222 .. seealso::
2224 :exc:`~pyVHDLModel.Exception.InstantiationNotLinkedError`
2225 |rarr| Instantiation of a generic language entity not linked.
2226 :exc:`~pyVHDLModel.Exception.LibraryReferenceNotLinkedError`
2227 |rarr| Implicit library reference of a primary unit not linked.
2228 :exc:`~pyVHDLModel.Exception.UseClauseNotLinkedError`
2229 |rarr| Use clause of a context declaration not linked.
2230 """
2233@export
2234class InstantiationNotLinkedError(NotLinkedError):
2235 """
2236 The exception is raised when an instantiation of a generic language entity isn't linked to it.
2238 A package instantiation is linked to its generic package by :meth:`~pyVHDLModel.Design.LinkPackageInstances`; the
2239 generic language entity's declarations are available only after linking.
2241 It's a :exc:`VHDLModelException` and a common base: a kind-specific exception derives from it, e.g.
2242 ``class PackageInstantiationNotLinkedError(InstantiationNotLinkedError)``. It has no initializer
2243 of its own; the derived exception sets the fields.
2245 .. seealso::
2247 :exc:`~pyVHDLModel.Exception.PackageInstantiationNotLinkedError`
2248 |rarr| Package instantiation not linked to its generic package.
2249 """
2251 _instantiationName: str #: The name of the instantiation, which isn't linked.
2252 _genericName: str #: The name of the generic language entity, as the instantiation references it.
2254 @readonly
2255 def InstantiationName(self) -> str:
2256 """
2257 Read-only property to access the instantiation name (:attr:`_instantiationName`).
2259 :returns: The name of the instantiation, which isn't linked.
2260 """
2261 return self._instantiationName
2263 @readonly
2264 def GenericName(self) -> str:
2265 """
2266 Read-only property to access the name of the generic language entity (:attr:`_genericName`).
2268 :returns: The name of the generic language entity, as the instantiation references it.
2269 """
2270 return self._genericName
2273@export
2274class PackageInstantiationNotLinkedError(InstantiationNotLinkedError):
2275 """
2276 This exception is raised, when a package instantiation isn't linked to its generic package.
2277 """
2279 def __init__(self, message: str, /, *, instantiationName: str, genericPackageName: str) -> None:
2280 """
2281 Initializes the exception with a message, the name of the package instantiation and of its generic package.
2283 :param message: The exception message.
2284 :param instantiationName: The name of the package instantiation, which isn't linked.
2285 :param genericPackageName: The name of the generic package, as the instantiation references it.
2286 """
2287 super().__init__(message)
2288 self._instantiationName = instantiationName
2289 self._genericName = genericPackageName
2292@export
2293class LibraryReferenceNotLinkedError(NotLinkedError):
2294 """
2295 This exception is raised, when a primary unit doesn't reference a library, which every primary unit references
2296 implicitly.
2297 """
2299 _designUnit: _DesignUnit #: The design unit without the library reference.
2300 _libraryName: str #: The name of the implicitly referenced library.
2302 def __init__(self, message: str, /, *, designUnit: _DesignUnit, libraryName: str) -> None:
2303 """
2304 Initializes the exception with a message, the design unit and the name of the library it doesn't reference.
2306 :param message: The exception message.
2307 :param designUnit: The design unit without the library reference.
2308 :param libraryName: The name of the implicitly referenced library.
2309 """
2310 super().__init__(message)
2311 self._designUnit = designUnit
2312 self._libraryName = libraryName
2314 @readonly
2315 def DesignUnit(self) -> _DesignUnit:
2316 """
2317 Read-only property to access the design unit (:attr:`_designUnit`).
2319 :returns: The design unit without the library reference.
2320 """
2321 return self._designUnit
2323 @readonly
2324 def LibraryName(self) -> str:
2325 """
2326 Read-only property to access the library name (:attr:`_libraryName`).
2328 :returns: The name of the implicitly referenced library.
2329 """
2330 return self._libraryName
2333@export
2334class UseClauseNotLinkedError(NotLinkedError):
2335 """
2336 This exception is raised, when a use clause of a context declaration isn't linked to its package.
2337 """
2339 _symbol: _Symbol #: The symbol of the use clause, which isn't linked.
2340 _context: _Context #: The context declaration containing the use clause.
2342 def __init__(self, message: str, /, *, symbol: _Symbol, context: _Context) -> None:
2343 """
2344 Initializes the exception with a message, the unlinked symbol and the context declaration.
2346 :param message: The exception message.
2347 :param symbol: The symbol of the use clause, which isn't linked.
2348 :param context: The context declaration containing the use clause.
2349 """
2350 super().__init__(message)
2351 self._symbol = symbol
2352 self._context = context
2354 @readonly
2355 def Symbol(self) -> _Symbol:
2356 """
2357 Read-only property to access the symbol of the use clause (:attr:`_symbol`).
2359 :returns: The symbol, which isn't linked.
2360 """
2361 return self._symbol
2363 @readonly
2364 def Context(self) -> _Context:
2365 """
2366 Read-only property to access the context declaration (:attr:`_context`).
2368 :returns: The context declaration containing the use clause.
2369 """
2370 return self._context
2373@export
2374class NotComputedError(VHDLModelException):
2375 """
2376 The exception is raised when a graph of the analysis isn't computed before it's used.
2378 It's a :exc:`VHDLModelException` and a common base: a kind-specific exception derives from it, e.g.
2379 ``class HierarchyNotComputedError(NotComputedError)``. It has no initializer and no fields of its
2380 own.
2382 .. seealso::
2384 :exc:`~pyVHDLModel.Exception.HierarchyNotComputedError`
2385 |rarr| Hierarchy graph not computed.
2386 :exc:`~pyVHDLModel.Exception.CompileOrderNotComputedError`
2387 |rarr| Compile order not computed.
2388 """
2391@export
2392class HierarchyNotComputedError(NotComputedError):
2393 """
2394 This exception is raised, when the design's top-level is requested before the hierarchy graph is computed.
2395 """
2398@export
2399class CompileOrderNotComputedError(NotComputedError):
2400 """
2401 This exception is raised, when documents are iterated in compile order before the compile order is computed.
2402 """
2405@export
2406class LibraryNotVisibleError(VHDLModelException):
2407 """
2408 The exception is raised when a design unit references a library, whose name no library clause made visible.
2410 It's a :exc:`VHDLModelException` and a common base: a kind-specific exception derives from it, e.g.
2411 ``class UseClauseLibraryNotVisibleError(LibraryNotVisibleError)``. It has no initializer of its
2412 own; the derived exception sets the fields.
2414 .. seealso::
2416 :exc:`~pyVHDLModel.Exception.UseClauseLibraryNotVisibleError`
2417 |rarr| Library of a use clause not visible.
2418 :exc:`~pyVHDLModel.Exception.ContextReferenceLibraryNotVisibleError`
2419 |rarr| Library of a context reference not visible.
2420 :exc:`~pyVHDLModel.Exception.PackageInstantiationLibraryNotVisibleError`
2421 |rarr| Library of a package instantiation's generic package not visible.
2422 :exc:`~pyVHDLModel.Exception.EntityInstantiationLibraryNotVisibleError`
2423 |rarr| Library of a direct entity instantiation not visible.
2424 """
2426 _libraryName: str #: The name of the library, which isn't visible.
2427 _designUnit: _DesignUnit #: The design unit referencing the library.
2429 @readonly
2430 def LibraryName(self) -> str:
2431 """
2432 Read-only property to access the library name (:attr:`_libraryName`).
2434 :returns: The name of the library, which isn't visible.
2435 """
2436 return self._libraryName
2438 @readonly
2439 def DesignUnit(self) -> _DesignUnit:
2440 """
2441 Read-only property to access the design unit referencing the library (:attr:`_designUnit`).
2443 :returns: The design unit referencing the library.
2444 """
2445 return self._designUnit
2448@export
2449class UseClauseLibraryNotVisibleError(LibraryNotVisibleError):
2450 """
2451 This exception is raised, when a use clause references a library, whose name no library clause made visible.
2452 """
2454 def __init__(self, message: str, /, *, libraryName: str, designUnit: _DesignUnit) -> None:
2455 """
2456 Initializes the exception with a message, the name of the invisible library and the design unit of the use clause.
2458 :param message: The exception message.
2459 :param libraryName: The name of the library, which isn't visible.
2460 :param designUnit: The design unit containing the use clause.
2461 """
2462 super().__init__(message)
2463 self._libraryName = libraryName
2464 self._designUnit = designUnit
2467@export
2468class ContextReferenceLibraryNotVisibleError(LibraryNotVisibleError):
2469 """
2470 This exception is raised, when a context reference references a library, whose name no library clause made visible.
2471 """
2473 def __init__(self, message: str, /, *, libraryName: str, designUnit: _DesignUnit) -> None:
2474 """
2475 Initializes the exception with a message, the name of the invisible library and the design unit of the context
2476 reference.
2478 :param message: The exception message.
2479 :param libraryName: The name of the library, which isn't visible.
2480 :param designUnit: The design unit containing the context reference.
2481 """
2482 super().__init__(message)
2483 self._libraryName = libraryName
2484 self._designUnit = designUnit
2487@export
2488class PackageInstantiationLibraryNotVisibleError(LibraryNotVisibleError):
2489 """
2490 This exception is raised, when a package instantiation references a library, whose name no library clause made
2491 visible.
2492 """
2494 def __init__(self, message: str, /, *, libraryName: str, packageInstantiation: _PackageInstantiation) -> None:
2495 """
2496 Initializes the exception with a message, the name of the invisible library and the package instantiation.
2498 :param message: The exception message.
2499 :param libraryName: The name of the library, which isn't visible.
2500 :param packageInstantiation: The package instantiation referencing the generic package in that library.
2501 """
2502 super().__init__(message)
2503 self._libraryName = libraryName
2504 self._designUnit = packageInstantiation
2507@export
2508class EntityInstantiationLibraryNotVisibleError(LibraryNotVisibleError):
2509 """
2510 This exception is raised, when a direct entity instantiation references a library, whose name no library clause made
2511 visible.
2512 """
2514 _instantiation: EntityInstantiation #: The direct entity instantiation referencing the library.
2516 def __init__(self, message: str, /, *, instantiation: EntityInstantiation, architecture: Architecture) -> None:
2517 """
2518 Initializes the exception with a message, the direct entity instantiation and the architecture containing it.
2520 :param message: The exception message.
2521 :param instantiation: The direct entity instantiation referencing the library.
2522 :param architecture: The architecture containing the instantiation.
2523 """
2524 super().__init__(message)
2525 self._libraryName = instantiation._entity._name._prefix._identifier
2526 self._designUnit = architecture
2527 self._instantiation = instantiation
2529 @readonly
2530 def Instantiation(self) -> EntityInstantiation:
2531 """
2532 Read-only property to access the direct entity instantiation (:attr:`_instantiation`).
2534 :returns: The direct entity instantiation referencing the library.
2535 """
2536 return self._instantiation
2539@export
2540class UnknownKindError(VHDLModelException, CommonUnknownKindError):
2541 """
2542 The exception is raised when a model element is of a kind, which the model doesn't expect at its place.
2544 It's a :exc:`VHDLModelException` and a common base: a kind-specific exception derives from it, e.g.
2545 ``class UnknownSymbolKindError(UnknownKindError)``. It has no initializer of its own; the derived
2546 exception sets the fields. It also derives from pyTooling's common base :exc:`pyTooling.Exceptions.UnknownKindError`.
2548 .. seealso::
2550 :exc:`~pyVHDLModel.Exception.UnknownSymbolKindError`
2551 |rarr| Symbol of a use clause of unknown kind.
2552 :exc:`~pyVHDLModel.Exception.UnknownSecondaryUnitKindError`
2553 |rarr| Secondary unit of unknown kind.
2554 """
2556 _element: ModelEntity #: The model element of unknown kind.
2558 @readonly
2559 def Element(self) -> ModelEntity:
2560 """
2561 Read-only property to access the model element of unknown kind (:attr:`_element`).
2563 :returns: The model element of unknown kind.
2564 """
2565 return self._element
2568@export
2569class UnknownSymbolKindError(UnknownKindError):
2570 """
2571 This exception is raised, when a symbol of a use clause isn't a package reference symbol, which the model supports.
2572 """
2574 _designUnit: _DesignUnit #: The design unit containing the use clause.
2576 def __init__(self, message: str, /, *, symbol: _Symbol, designUnit: _DesignUnit) -> None:
2577 """
2578 Initializes the exception with a message, the symbol of unknown kind and the design unit of the use clause.
2580 :param message: The exception message.
2581 :param symbol: The symbol of unknown kind.
2582 :param designUnit: The design unit containing the use clause.
2583 """
2584 super().__init__(message)
2585 self._element = symbol
2586 self._designUnit = designUnit
2588 @readonly
2589 def DesignUnit(self) -> _DesignUnit:
2590 """
2591 Read-only property to access the design unit containing the use clause (:attr:`_designUnit`).
2593 :returns: The design unit.
2594 """
2595 return self._designUnit
2598@export
2599class UnknownSecondaryUnitKindError(UnknownKindError):
2600 """
2601 This exception is raised, when a secondary unit is neither an architecture nor a package body.
2602 """
2604 def __init__(self, message: str, /, *, secondaryUnit: SecondaryUnit) -> None:
2605 """
2606 Initializes the exception with a message and the secondary unit of unknown kind.
2608 :param message: The exception message.
2609 :param secondaryUnit: The secondary unit of unknown kind.
2610 """
2611 super().__init__(message)
2612 self._element = secondaryUnit
2615@export
2616class IEEEFlavorError(VHDLModelException):
2617 """
2618 The exception is raised when the ``ieee`` library can't provide a requested flavor.
2620 It's a :exc:`VHDLModelException` and a common base: a kind-specific exception derives from it, e.g.
2621 ``class UnknownIEEEFlavorError(IEEEFlavorError)``. It has no initializer of its own; the derived
2622 exception sets the fields.
2624 .. seealso::
2626 :exc:`~pyVHDLModel.Exception.UnknownIEEEFlavorError`
2627 |rarr| Unknown flavor requested.
2628 :exc:`~pyVHDLModel.Exception.IEEEFlavorChangeError`
2629 |rarr| Flavor of a library with a non-IEEE flavor changed.
2630 """
2632 _flavor: IEEEFlavor #: The requested flavor.
2634 @readonly
2635 def Flavor(self) -> IEEEFlavor:
2636 """
2637 Read-only property to access the requested flavor (:attr:`_flavor`).
2639 :returns: The requested flavor.
2640 """
2641 return self._flavor
2644@export
2645class UnknownIEEEFlavorError(IEEEFlavorError):
2646 """
2647 This exception is raised, when the ``ieee`` library is requested with an unknown flavor.
2648 """
2650 def __init__(self, message: str, /, *, flavor: IEEEFlavor) -> None:
2651 """
2652 Initializes the exception with a message and the unknown flavor.
2654 :param message: The exception message.
2655 :param flavor: The requested flavor.
2656 """
2657 super().__init__(message)
2658 self._flavor = flavor
2661@export
2662class IEEEFlavorChangeError(IEEEFlavorError):
2663 """
2664 This exception is raised, when the flavor of an ``ieee`` library, which provides a non-IEEE flavor, is changed.
2665 """
2667 _currentFlavor: IEEEFlavor #: The flavor the library provides.
2669 def __init__(self, message: str, /, *, currentFlavor: IEEEFlavor, flavor: IEEEFlavor) -> None:
2670 """
2671 Initializes the exception with a message, the current and the requested flavor.
2673 :param message: The exception message.
2674 :param currentFlavor: The flavor the library provides.
2675 :param flavor: The requested flavor.
2676 """
2677 super().__init__(message)
2678 self._flavor = flavor
2679 self._currentFlavor = currentFlavor
2681 @readonly
2682 def CurrentFlavor(self) -> IEEEFlavor:
2683 """
2684 Read-only property to access the flavor the library provides (:attr:`_currentFlavor`).
2686 :returns: The flavor the library provides.
2687 """
2688 return self._currentFlavor
2691@export
2692class AncestorNotFoundError(VHDLModelException, ElementNotFoundError):
2693 """
2694 This exception is raised, when the parent chain of a model entity contains no ancestor of the requested type.
2695 """
2697 _element: ModelEntity #: The model entity, whose parent chain was searched.
2698 _ancestorType: type #: The requested type of the ancestor.
2700 def __init__(self, message: str, /, *, element: ModelEntity, ancestorType: type) -> None:
2701 """
2702 Initializes the exception with a message, the searched model entity and the requested ancestor type.
2704 :param message: The exception message.
2705 :param element: The model entity, whose parent chain was searched.
2706 :param ancestorType: The requested type of the ancestor.
2707 """
2708 super().__init__(message)
2709 self._element = element
2710 self._ancestorType = ancestorType
2712 @readonly
2713 def Element(self) -> ModelEntity:
2714 """
2715 Read-only property to access the model entity, whose parent chain was searched (:attr:`_element`).
2717 :returns: The model entity.
2718 """
2719 return self._element
2721 @readonly
2722 def AncestorType(self) -> type:
2723 """
2724 Read-only property to access the requested type of the ancestor (:attr:`_ancestorType`).
2726 :returns: The requested type.
2727 """
2728 return self._ancestorType
2731@export
2732class AllowBlackboxNotSetError(VHDLModelException):
2733 """
2734 This exception is raised, when a model entity has no local *allow blackbox* value and no parent to inherit it from.
2735 """
2737 _element: ModelEntity #: The model entity without an *allow blackbox* value.
2739 def __init__(self, message: str, /, *, element: ModelEntity) -> None:
2740 """
2741 Initializes the exception with a message and the model entity without an *allow blackbox* value.
2743 :param message: The exception message.
2744 :param element: The model entity without an *allow blackbox* value.
2745 """
2746 super().__init__(message)
2747 self._element = element
2749 @readonly
2750 def Element(self) -> ModelEntity:
2751 """
2752 Read-only property to access the model entity without an *allow blackbox* value (:attr:`_element`).
2754 :returns: The model entity.
2755 """
2756 return self._element
2759@export
2760class AmbiguousTopLevelError(VHDLModelException, AmbiguousError):
2761 """
2762 This exception is raised, when the hierarchy graph of a design has more than one root, i.e. top-level.
2763 """
2765 _topLevels: tuple[_DesignUnit, ...] #: The design units at the roots of the hierarchy graph.
2767 def __init__(self, message: str, /, *, topLevels: tuple[_DesignUnit, ...]) -> None:
2768 """
2769 Initializes the exception with a message and the top-level candidates.
2771 :param message: The exception message.
2772 :param topLevels: The design units at the roots of the hierarchy graph.
2773 """
2774 super().__init__(message)
2775 self._topLevels = topLevels
2777 @readonly
2778 def TopLevels(self) -> tuple[_DesignUnit, ...]:
2779 """
2780 Read-only property to access the top-level candidates (:attr:`_topLevels`).
2782 :returns: Tuple of design units at the roots of the hierarchy graph.
2783 """
2784 return self._topLevels
2787@export
2788class UnprefixedEntityInstantiationError(VHDLModelException):
2789 """
2790 This exception is raised, when a direct entity instantiation names its entity without a library prefix.
2791 """
2793 _instantiation: EntityInstantiation #: The direct entity instantiation without a library prefix.
2795 def __init__(self, message: str, /, *, instantiation: EntityInstantiation) -> None:
2796 """
2797 Initializes the exception with a message and the direct entity instantiation without a library prefix.
2799 :param message: The exception message.
2800 :param instantiation: The direct entity instantiation without a library prefix.
2801 """
2802 super().__init__(message)
2803 self._instantiation = instantiation
2805 @readonly
2806 def Instantiation(self) -> EntityInstantiation:
2807 """
2808 Read-only property to access the direct entity instantiation (:attr:`_instantiation`).
2810 :returns: The direct entity instantiation without a library prefix.
2811 """
2812 return self._instantiation
2815@export
2816class NotAGenericPackageError(VHDLModelException):
2817 """
2818 This exception is raised, when a package instantiation references a package, which isn't a generic package.
2819 """
2821 _packageInstantiation: _PackageInstantiation #: The package instantiation referencing the package.
2822 _package: _Package #: The referenced package, which isn't a generic package.
2824 def __init__(self, message: str, /, *, packageInstantiation: _PackageInstantiation, package: _Package) -> None:
2825 """
2826 Initializes the exception with a message, the package instantiation and the referenced non-generic package.
2828 :param message: The exception message.
2829 :param packageInstantiation: The package instantiation referencing the package.
2830 :param package: The referenced package, which isn't a generic package.
2831 """
2832 super().__init__(message)
2833 self._packageInstantiation = packageInstantiation
2834 self._package = package
2836 @readonly
2837 def PackageInstantiation(self) -> _PackageInstantiation:
2838 """
2839 Read-only property to access the package instantiation (:attr:`_packageInstantiation`).
2841 :returns: The package instantiation referencing the package.
2842 """
2843 return self._packageInstantiation
2845 @readonly
2846 def Package(self) -> _Package:
2847 """
2848 Read-only property to access the referenced package (:attr:`_package`).
2850 :returns: The referenced package, which isn't a generic package.
2851 """
2852 return self._package
2855@export
2856class VHDLWriterError(VHDLModelException):
2857 """
2858 This exception is raised, when the VHDL writer can't write a model element as VHDL source text.
2860 The element's content has no VHDL notation, e.g. a string literal containing a control character.
2861 """
2863 _element: ModelEntity #: The model element the writer could not write.
2865 def __init__(self, message: str, element: ModelEntity) -> None:
2866 """
2867 Initializes the exception with a message and the model element that could not be written.
2869 :param message: The error message.
2870 :param element: The model element that could not be written.
2871 """
2872 super().__init__(message)
2873 self._element = element
2875 @readonly
2876 def Element(self) -> ModelEntity:
2877 """
2878 Read-only property to access the model element that could not be written (:attr:`_element`).
2880 :returns: The model element.
2881 """
2882 return self._element
2885@export
2886class LiteralError(VHDLModelException, ValueError):
2887 """
2888 This exception is raised, when a literal's value violates the rules of its literal kind.
2890 E.g. a bit string literal's length truncates significant characters. It's a :exc:`ValueError` too, like
2891 converting an invalid text to a number.
2892 """
2894 _literal: _Literal #: The literal with the invalid value.
2896 def __init__(self, message: str, /, *, literal: _Literal) -> None:
2897 """
2898 Initializes the exception with a message and the literal with the invalid value.
2900 :param message: The error message.
2901 :param literal: The literal with the invalid value.
2902 """
2903 super().__init__(message)
2904 self._literal = literal
2906 @readonly
2907 def Literal(self) -> _Literal:
2908 """
2909 Read-only property to access the literal with the invalid value (:attr:`_literal`).
2911 :returns: The literal with the invalid value.
2912 """
2913 return self._literal