Coverage for pyVHDLModel/Exception.py: 91%

485 statements  

« prev     ^ index     » next       coverage.py v7.17.0, created at 2026-10-22 19:31 +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. 

34 

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 

39 

40from typing import TYPE_CHECKING, Optional as Nullable, Union 

41 

42from pyTooling.Decorators import export, readonly 

43from pyTooling.Exceptions import ExceptionBase, AlreadyInHierarchyError, DuplicateElementError 

44from pyTooling.Warning import Warning, CriticalWarning 

45 

46from pyVHDLModel.Symbol import Symbol 

47 

48if TYPE_CHECKING: # pragma: no cover 

49 from pyVHDLModel.Base import ModelElementUnion, ModelEntity 

50 from pyVHDLModel.Concurrent import ComponentInstantiation 

51 from pyVHDLModel.DesignUnit import Component as _Component 

52 from pyVHDLModel.Namespace import Namespace as _Namespace 

53 

54 

55@export 

56class VHDLModelWarning(Warning): 

57 """ 

58 Base-class for the non-critical warnings raised by pyVHDLModel. 

59 

60 .. attention:: 

61 

62 It's a non-critical warning: without a :class:`~pyTooling.Warning.WarningCollector` up the call-hierarchy, it's 

63 dropped silently. 

64 

65 .. seealso:: 

66 

67 * :class:`Not implemented warning <pyVHDLModel.Exception.NotImplementedWarning>` 

68 * :class:`Blackbox warning <pyVHDLModel.Exception.BlackboxWarning>` 

69 """ 

70 pass 

71 

72 

73@export 

74class NotImplementedWarning(VHDLModelWarning): 

75 """ 

76 Raised when a language construct is recognised but not yet modelled. 

77 

78 .. attention:: 

79 

80 It's a non-critical warning: without a :class:`~pyTooling.Warning.WarningCollector` up the call-hierarchy, it's 

81 dropped silently. 

82 """ 

83 

84 _item: Nullable[Union[ModelEntity, Symbol]] #: The model element or symbol of the construct. 

85 

86 def __init__(self, message: str, /, *, item: Nullable[Union[ModelEntity, Symbol]] = None) -> None: 

87 """ 

88 Initializes the warning with the construct that isn't modelled yet. 

89 

90 :param message: The warning's message. 

91 :param item: Optional, the model element or symbol of the construct - a declared item, an expression, a symbol 

92 or an instantiation. 

93 """ 

94 super().__init__(message) 

95 self._item = item 

96 

97 @readonly 

98 def Item(self) -> Nullable[Union[ModelEntity, Symbol]]: 

99 """ 

100 Read-only property to access the model element or symbol of the construct (:attr:`_item`). 

101 

102 :returns: The model element or symbol, or ``None`` if the construct has none or it wasn't recorded. 

103 """ 

104 return self._item 

105 

106 

107@export 

108class VHDLModelCriticalWarning(CriticalWarning): 

109 """ 

110 Base-class for critical warnings that likely indicate a defect in the model or its input. 

111 

112 .. important:: 

113 

114 As a critical warning, it must be collected by a :class:`~pyTooling.Warning.WarningCollector` up the 

115 call-hierarchy, otherwise :exc:`~pyTooling.Warning.UnhandledCriticalWarningError` is raised. 

116 

117 .. seealso:: 

118 

119 * :class:`Duplicate declaration warning <pyVHDLModel.Exception.DuplicateDeclarationWarning>` 

120 """ 

121 pass 

122 

123 

124@export 

125class DuplicateDeclarationWarning(VHDLModelCriticalWarning): 

126 """ 

127 Raised when two declarations in one declarative region share an identifier. 

128 

129 VHDL rejects this as *identifier already used for a declaration*. Overloadable declarations - 

130 subprograms differing in signature - are not reported. Afterwards, the namespace refers to the later declaration. 

131 

132 .. important:: 

133 

134 As a critical warning, it must be collected by a :class:`~pyTooling.Warning.WarningCollector` up the 

135 call-hierarchy, otherwise :exc:`~pyTooling.Warning.UnhandledCriticalWarningError` is raised. 

136 """ 

137 

138 _identifier: Nullable[str] #: The identifier declared twice. 

139 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier. 

140 _namespace: Nullable[_Namespace] #: The namespace of the declarative region declaring it. 

141 _element: Nullable[ModelEntity] #: The new declaration. 

142 _existing: Nullable[ModelEntity] #: The earlier declaration. 

143 

144 def __init__( 

145 self, 

146 message: str, 

147 /, *, 

148 identifier: Nullable[str] = None, 

149 namespace: Nullable[_Namespace] = None, 

150 element: Nullable[ModelEntity] = None, 

151 existing: Nullable[ModelEntity] = None 

152 ) -> None: 

153 """ 

154 Initializes the warning with the identifier, the namespace and both declarations. 

155 

156 :param message: The warning's message. 

157 :param identifier: Optional, the identifier declared twice. 

158 :param namespace: Optional, the namespace of the declarative region declaring it. 

159 :param element: Optional, the new declaration. 

160 :param existing: Optional, the earlier declaration. 

161 """ 

162 super().__init__(message) 

163 self._identifier = identifier 

164 self._normalizedIdentifier = identifier.lower() if identifier is not None else None 

165 self._namespace = namespace 

166 self._element = element 

167 self._existing = existing 

168 

169 @readonly 

170 def Identifier(self) -> Nullable[str]: 

171 """ 

172 Read-only property to access the identifier declared twice (:attr:`_identifier`). 

173 

174 :returns: The identifier, or ``None`` if it wasn't recorded. 

175 """ 

176 return self._identifier 

177 

178 @readonly 

179 def NormalizedIdentifier(self) -> Nullable[str]: 

180 """ 

181 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`). 

182 

183 :returns: The normalized identifier, or ``None`` if it wasn't recorded. 

184 """ 

185 return self._normalizedIdentifier 

186 

187 @readonly 

188 def Namespace(self) -> Nullable[_Namespace]: 

189 """ 

190 Read-only property to access the namespace of the declarative region declaring it (:attr:`_namespace`). 

191 

192 :returns: The namespace, or ``None`` if it wasn't recorded. 

193 """ 

194 return self._namespace 

195 

196 @readonly 

197 def Element(self) -> Nullable[ModelEntity]: 

198 """ 

199 Read-only property to access the new declaration (:attr:`_element`). 

200 

201 :returns: The declaration, or ``None`` if it wasn't recorded. 

202 """ 

203 return self._element 

204 

205 @readonly 

206 def Existing(self) -> Nullable[ModelEntity]: 

207 """ 

208 Read-only property to access the earlier declaration (:attr:`_existing`). 

209 

210 :returns: The declaration, or ``None`` if it wasn't recorded. 

211 """ 

212 return self._existing 

213 

214 

215@export 

216class BlackboxWarning(VHDLModelWarning): 

217 """ 

218 Raised when a component could not be bound and is treated as a blackbox. 

219 

220 Only a component allowing blackboxes - set on it or inherited, e.g. from its library or design 

221 (:attr:`~pyVHDLModel.Common.AllowBlackboxMixin.AllowBlackbox`) - becomes a blackbox, recorded in 

222 :attr:`Component.IsBlackbox <pyVHDLModel.DesignUnit.Component.IsBlackbox>`. For any other component without an 

223 entity, analysis raises a :exc:`VHDLModelException`. 

224 

225 .. attention:: 

226 

227 It's a non-critical warning: without a :class:`~pyTooling.Warning.WarningCollector` up the call-hierarchy, it's 

228 dropped silently. 

229 """ 

230 

231 _instance: Nullable[ComponentInstantiation] #: The component instantiation treated as a blackbox. 

232 _component: Nullable[_Component] #: The component that couldn't be bound. 

233 

234 def __init__( 

235 self, 

236 message: str, 

237 /, *, 

238 instance: Nullable[ComponentInstantiation] = None, 

239 component: Nullable[_Component] = None 

240 ) -> None: 

241 """ 

242 Initializes the warning with the instantiation and the component that couldn't be bound. 

243 

244 :param message: The warning's message. 

245 :param instance: Optional, the component instantiation treated as a blackbox. 

246 :param component: Optional, the component that couldn't be bound. 

247 """ 

248 super().__init__(message) 

249 self._instance = instance 

250 self._component = component 

251 

252 @readonly 

253 def Instance(self) -> Nullable[ComponentInstantiation]: 

254 """ 

255 Read-only property to access the component instantiation treated as a blackbox (:attr:`_instance`). 

256 

257 :returns: The instantiation, or ``None`` if it wasn't recorded. 

258 """ 

259 return self._instance 

260 

261 @readonly 

262 def Component(self) -> Nullable[_Component]: 

263 """ 

264 Read-only property to access the component that couldn't be bound (:attr:`_component`). 

265 

266 :returns: The component, or ``None`` if it wasn't recorded. 

267 """ 

268 return self._component 

269 

270 

271@export 

272class VHDLModelException(ExceptionBase): 

273 """ 

274 Base-class for all exceptions (errors) raised by pyVHDLModel. 

275 

276 .. seealso:: 

277 

278 * :class:`Library exists in design error <pyVHDLModel.Exception.LibraryExistsInDesignError>` 

279 * :class:`Registered to foreign design error <pyVHDLModel.Exception.LibraryRegisteredToForeignDesignError>` 

280 * :class:`Library not registered error <pyVHDLModel.Exception.LibraryNotRegisteredError>` 

281 * :class:`Entity exists in library error <pyVHDLModel.Exception.EntityExistsInLibraryError>` 

282 * :class:`Architecture exists in library error <pyVHDLModel.Exception.ArchitectureExistsInLibraryError>` 

283 * :class:`Package exists in library error <pyVHDLModel.Exception.PackageExistsInLibraryError>` 

284 * :class:`Package body exists error <pyVHDLModel.Exception.PackageBodyExistsError>` 

285 * :class:`Configuration exists in library error <pyVHDLModel.Exception.ConfigurationExistsInLibraryError>` 

286 * :class:`Context exists in library error <pyVHDLModel.Exception.ContextExistsInLibraryError>` 

287 * :class:`Referenced library not existing error <pyVHDLModel.Exception.ReferencedLibraryNotExistingError>` 

288 * :class:`Already in design error <pyVHDLModel.Exception.AlreadyInDesignError>` 

289 * :class:`Not a child error <pyVHDLModel.Exception.NotAChildError>` 

290 * :class:`Duplicate generic error <pyVHDLModel.Exception.DuplicateGenericError>` 

291 * :class:`Duplicate port error <pyVHDLModel.Exception.DuplicatePortError>` 

292 * :class:`Duplicate parameter error <pyVHDLModel.Exception.DuplicateParameterError>` 

293 * :class:`Not in namespace error <pyVHDLModel.Exception.NotInNamespaceError>` 

294 * :class:`Duplicate declaration error <pyVHDLModel.Exception.DuplicateDeclarationError>` 

295 * :class:`Duplicate association error <pyVHDLModel.Exception.DuplicateAssociationError>` 

296 * :class:`Association order error <pyVHDLModel.Exception.AssociationOrderError>` 

297 * :class:`Library not found error <pyVHDLModel.Exception.LibraryNotFoundError>` 

298 * :class:`Entity not found error <pyVHDLModel.Exception.EntityNotFoundError>` 

299 * :class:`Package not found error <pyVHDLModel.Exception.PackageNotFoundError>` 

300 * :class:`Configuration not found error <pyVHDLModel.Exception.ConfigurationNotFoundError>` 

301 * :class:`Context not found error <pyVHDLModel.Exception.ContextNotFoundError>` 

302 * :class:`VHDL writer error <pyVHDLModel.Exception.VHDLWriterError>` 

303 """ 

304 

305 

306@export 

307class LibraryExistsInDesignError(VHDLModelException): 

308 """ 

309 This exception is raised, when the library is already existing in the design. 

310 

311 Message: :pycode:`f"Library '{library._identifier}' already exists in design."` 

312 """ 

313 

314 _library: Library #: The library involved in this error. 

315 

316 def __init__(self, library: Library) -> None: 

317 """ 

318 Initializes the exception message based on given library object. 

319 

320 :param library: The library that already exists in the design. 

321 """ 

322 super().__init__(f"Library '{library._identifier}' already exists in design.") 

323 self._library = library 

324 

325 @readonly 

326 def Library(self) -> Library: 

327 """ 

328 Read-only property to access the duplicate library (:attr:`_library`). 

329 

330 :returns: Duplicate library (by name). 

331 """ 

332 return self._library 

333 

334 

335@export 

336class LibraryRegisteredToForeignDesignError(VHDLModelException): 

337 """ 

338 This exception is raised, when the library is already registered to a foreign design. 

339 

340 Message: :pycode:`f"Library '{library._identifier}' already registered in design '{library.Parent}'."` 

341 """ 

342 

343 _library: Library #: The library involved in this error. 

344 

345 def __init__(self, library: Library) -> None: 

346 """ 

347 Initializes the exception message based on given library object. 

348 

349 :param library: The library that is already registered to another design. 

350 """ 

351 super().__init__(f"Library '{library._identifier}' already registered in design '{library.Parent}'.") 

352 self._library = library 

353 

354 @readonly 

355 def Library(self) -> Library: 

356 """ 

357 Read-only property to access the library (:attr:`_library`). 

358 

359 :returns: The library. 

360 """ 

361 return self._library 

362 

363 

364@export 

365class LibraryNotRegisteredError(VHDLModelException): 

366 """ 

367 This exception is raised, when the library is not registered in the design. 

368 

369 Message: :pycode:`f"Library '{library._identifier}' is not registered in the design."` 

370 """ 

371 

372 _library: Library #: The library involved in this error. 

373 

374 def __init__(self, library: Library) -> None: 

375 """ 

376 Initializes the exception message based on given library object. 

377 

378 :param library: The library that isn't registered in the design. 

379 """ 

380 super().__init__(f"Library '{library._identifier}' is not registered in the design.") 

381 self._library = library 

382 

383 @readonly 

384 def Library(self) -> Library: 

385 """ 

386 Read-only property to access the library (:attr:`_library`). 

387 

388 :returns: The library. 

389 """ 

390 return self._library 

391 

392 

393@export 

394class EntityExistsInLibraryError(VHDLModelException): 

395 """ 

396 This exception is raised, when the entity already existing in the library. 

397 

398 Message: :pycode:`f"Entity '{entity._identifier}' already exists in library '{library._identifier}'."` 

399 """ 

400 

401 _library: Library #: The library involved in this error. 

402 _entity: Entity #: The entity involved in this error. 

403 

404 def __init__(self, entity: Entity, library: Library) -> None: 

405 """ 

406 Initializes the exception message based on given entity and library objects. 

407 

408 :param entity: The entity that already exists in the library. 

409 :param library: The library that already contains the entity. 

410 """ 

411 super().__init__(f"Entity '{entity._identifier}' already exists in library '{library._identifier}'.") 

412 self._library = library 

413 self._entity = entity 

414 

415 @readonly 

416 def Library(self) -> Library: 

417 """ 

418 Read-only property to access the library (:attr:`_library`). 

419 

420 :returns: The library. 

421 """ 

422 return self._library 

423 

424 @readonly 

425 def Entity(self) -> Entity: 

426 """ 

427 Read-only property to access the entity (:attr:`_entity`). 

428 

429 :returns: The entity. 

430 """ 

431 return self._entity 

432 

433 

434@export 

435class ArchitectureExistsInLibraryError(VHDLModelException): 

436 """ 

437 This exception is raised, when the architecture already existing in the library. 

438 

439 Message: :pycode:`f"Architecture '{architecture._identifier}' for entity '{entity._identifier}' already exists in library '{library._identifier}'."` 

440 """ 

441 

442 _library: Library #: The library involved in this error. 

443 _entity: Entity #: The entity involved in this error. 

444 _architecture: Architecture #: The architecture involved in this error. 

445 

446 def __init__(self, architecture: Architecture, entity: Entity, library: Library) -> None: 

447 """ 

448 Initializes the exception message based on given architecture, entity and library objects. 

449 

450 :param architecture: The architecture that already exists in the library. 

451 :param entity: The entity the architecture refers to, which already exists in the library. 

452 :param library: The library that already contains the architecture. 

453 """ 

454 super().__init__(f"Architecture '{architecture._identifier}' for entity '{entity._identifier}' already exists in library '{library._identifier}'.") 

455 self._library = library 

456 self._entity = entity 

457 self._architecture = architecture 

458 

459 @readonly 

460 def Library(self) -> Library: 

461 """ 

462 Read-only property to access the library (:attr:`_library`). 

463 

464 :returns: The library. 

465 """ 

466 return self._library 

467 

468 @readonly 

469 def Entity(self) -> Entity: 

470 """ 

471 Read-only property to access the entity (:attr:`_entity`). 

472 

473 :returns: The entity. 

474 """ 

475 return self._entity 

476 

477 @readonly 

478 def Architecture(self) -> Architecture: 

479 """ 

480 Read-only property to access the architecture (:attr:`_architecture`). 

481 

482 :returns: The architecture. 

483 """ 

484 return self._architecture 

485 

486 

487@export 

488class PackageExistsInLibraryError(VHDLModelException): 

489 """ 

490 This exception is raised, when the package already existing in the library. 

491 

492 Message: :pycode:`f"Package '{package._identifier}' already exists in library '{library._identifier}'."` 

493 """ 

494 

495 _library: Library #: The library involved in this error. 

496 _package: Package #: The package involved in this error. 

497 

498 def __init__(self, package: Package, library: Library) -> None: 

499 """ 

500 Initializes the exception message based on given package and library objects. 

501 

502 :param package: The package that already exists in the library. 

503 :param library: The library that already contains the package. 

504 """ 

505 super().__init__(f"Package '{package._identifier}' already exists in library '{library._identifier}'.") 

506 self._library = library 

507 self._package = package 

508 

509 @readonly 

510 def Library(self) -> Library: 

511 """ 

512 Read-only property to access the library (:attr:`_library`). 

513 

514 :returns: The library. 

515 """ 

516 return self._library 

517 

518 @readonly 

519 def Package(self) -> Package: 

520 """ 

521 Read-only property to access the package (:attr:`_package`). 

522 

523 :returns: The package. 

524 """ 

525 return self._package 

526 

527 

528@export 

529class PackageBodyExistsError(VHDLModelException): 

530 """ 

531 This exception is raised, when the package body already existing in the library. 

532 

533 Message: :pycode:`f"Package body '{packageBody._identifier}' already exists in library '{library._identifier}'."` 

534 """ 

535 

536 _library: Library #: The library involved in this error. 

537 _packageBody: PackageBody #: The package body involved in this error. 

538 

539 def __init__(self, packageBody: PackageBody, library: Library) -> None: 

540 """ 

541 Initializes the exception message based on given package body and library objects. 

542 

543 :param packageBody: The package body that already exists in the library. 

544 :param library: The library that already contains the package body. 

545 """ 

546 super().__init__(f"Package body '{packageBody._identifier}' already exists in library '{library._identifier}'.") 

547 self._library = library 

548 self._packageBody = packageBody 

549 

550 @readonly 

551 def Library(self) -> Library: 

552 """ 

553 Read-only property to access the library (:attr:`_library`). 

554 

555 :returns: The library. 

556 """ 

557 return self._library 

558 

559 @readonly 

560 def PackageBody(self) -> PackageBody: 

561 """ 

562 Read-only property to access the package body (:attr:`_packageBody`). 

563 

564 :returns: The package body. 

565 """ 

566 return self._packageBody 

567 

568 

569@export 

570class ConfigurationExistsInLibraryError(VHDLModelException): 

571 """ 

572 This exception is raised, when the configuration already existing in the library. 

573 

574 Message: :pycode:`f"Configuration '{configuration._identifier}' already exists in library '{library._identifier}'."` 

575 """ 

576 

577 _library: Library #: The library involved in this error. 

578 _configuration: Configuration #: The configuration involved in this error. 

579 

580 def __init__(self, configuration: Configuration, library: Library) -> None: 

581 """ 

582 Initializes the exception message based on given configuration and library objects. 

583 

584 :param configuration: The configuration that already exists in the library. 

585 :param library: The library that already contains the configuration. 

586 """ 

587 super().__init__(f"Configuration '{configuration._identifier}' already exists in library '{library._identifier}'.") 

588 self._library = library 

589 self._configuration = configuration 

590 

591 @readonly 

592 def Library(self) -> Library: 

593 """ 

594 Read-only property to access the library (:attr:`_library`). 

595 

596 :returns: The library. 

597 """ 

598 return self._library 

599 

600 @readonly 

601 def Configuration(self) -> Configuration: 

602 """ 

603 Read-only property to access the configuration (:attr:`_configuration`). 

604 

605 :returns: The configuration. 

606 """ 

607 return self._configuration 

608 

609 

610@export 

611class ContextExistsInLibraryError(VHDLModelException): 

612 """ 

613 This exception is raised, when the context already existing in the library. 

614 

615 Message: :pycode:`f"Context '{context._identifier}' already exists in library '{library._identifier}'."` 

616 """ 

617 

618 _library: Library #: The library involved in this error. 

619 _context: Context #: The context involved in this error. 

620 

621 def __init__(self, context: Context, library: Library) -> None: 

622 """ 

623 Initializes the exception message based on given context and library objects. 

624 

625 :param context: The context that already exists in the library. 

626 :param library: The library that already contains the context. 

627 """ 

628 super().__init__(f"Context '{context._identifier}' already exists in library '{library._identifier}'.") 

629 self._library = library 

630 self._context = context 

631 

632 @readonly 

633 def Library(self) -> Library: 

634 """ 

635 Read-only property to access the library (:attr:`_library`). 

636 

637 :returns: The library. 

638 """ 

639 return self._library 

640 

641 @readonly 

642 def Context(self) -> Context: 

643 """ 

644 Read-only property to access the context (:attr:`_context`). 

645 

646 :returns: The context. 

647 """ 

648 return self._context 

649 

650 

651@export 

652class ReferencedLibraryNotExistingError(VHDLModelException): 

653 """ 

654 This exception is raised, when a library is referenced by a `library clause`, but doesn't exist in the design. 

655 

656 Message: :pycode:`f"Library '{librarySymbol.Name._identifier}' referenced by library clause of context '{context._identifier}' doesn't exist in design."` 

657 """ 

658 

659 _librarySymbol: Symbol #: The library symbol that could not be resolved. 

660 _context: Context #: The context involved in this error. 

661 

662 def __init__(self, context: Context, librarySymbol: Symbol) -> None: 

663 """ 

664 Initializes the exception message based on given context and library objects. 

665 

666 :param context: The context that already exists in the library. 

667 :param librarySymbol: The library that already contains the context. 

668 """ 

669 super().__init__(f"Library '{librarySymbol.Name._identifier}' referenced by library clause of context '{context._identifier}' doesn't exist in design.") 

670 self._librarySymbol = librarySymbol 

671 self._context = context 

672 

673 @readonly 

674 def LibrarySymbol(self) -> Symbol: 

675 """ 

676 Read-only property to access the library symbol (:attr:`_librarySymbol`). 

677 

678 :returns: The library symbol. 

679 """ 

680 return self._librarySymbol 

681 

682 @readonly 

683 def Context(self) -> Context: 

684 """ 

685 Read-only property to access the context (:attr:`_context`). 

686 

687 :returns: The context. 

688 """ 

689 return self._context 

690 

691 

692@export 

693class AlreadyInDesignError(VHDLModelException, AlreadyInHierarchyError): 

694 """ 

695 This exception is raised, when a model entity is added to a parent, but it already has a parent. 

696 

697 .. hint:: 

698 

699 Remove the model entity from its current parent first, e.g. by 

700 :meth:`~pyVHDLModel.Regions.WithGenericsMixin.RemoveGenericItem`. 

701 """ 

702 

703 _element: Nullable[ModelEntity] #: The model entity to add. 

704 _parent: Nullable[ModelEntity] #: The model entity's current parent. 

705 

706 def __init__( 

707 self, 

708 message: str, 

709 /, *, 

710 element: Nullable[ModelEntity] = None, 

711 parent: Nullable[ModelEntity] = None 

712 ) -> None: 

713 """ 

714 Initializes the exception with the model entity and its current parent. 

715 

716 :param message: The error message. 

717 :param element: Optional, the model entity to add. 

718 :param parent: Optional, the model entity's current parent. 

719 """ 

720 super().__init__(message) 

721 self._element = element 

722 self._parent = parent 

723 

724 @readonly 

725 def Element(self) -> Nullable[ModelEntity]: 

726 """ 

727 Read-only property to access the model entity to add (:attr:`_element`). 

728 

729 :returns: The model entity, or ``None`` if it wasn't recorded. 

730 """ 

731 return self._element 

732 

733 @readonly 

734 def Parent(self) -> Nullable[ModelEntity]: 

735 """ 

736 Read-only property to access the model entity's current parent (:attr:`_parent`). 

737 

738 :returns: The parent, or ``None`` if it wasn't recorded. 

739 """ 

740 return self._parent 

741 

742 

743@export 

744class NotAChildError(VHDLModelException): 

745 """ 

746 This exception is raised, when a model entity is removed from a parent, but it isn't a child of that parent. 

747 """ 

748 

749 _element: Nullable[ModelEntity] #: The model entity, which isn't a child. 

750 _parent: Nullable[ModelEntity] #: The model entity searched for the child. 

751 

752 def __init__( 

753 self, 

754 message: str, 

755 /, *, 

756 element: Nullable[ModelEntity] = None, 

757 parent: Nullable[ModelEntity] = None 

758 ) -> None: 

759 """ 

760 Initializes the exception with the model entity and the parent searched for it. 

761 

762 :param message: The error message. 

763 :param element: Optional, the model entity, which isn't a child. 

764 :param parent: Optional, the model entity searched for the child. 

765 """ 

766 super().__init__(message) 

767 self._element = element 

768 self._parent = parent 

769 

770 @readonly 

771 def Element(self) -> Nullable[ModelEntity]: 

772 """ 

773 Read-only property to access the model entity, which isn't a child (:attr:`_element`). 

774 

775 :returns: The model entity, or ``None`` if it wasn't recorded. 

776 """ 

777 return self._element 

778 

779 @readonly 

780 def Parent(self) -> Nullable[ModelEntity]: 

781 """ 

782 Read-only property to access the model entity searched for the child (:attr:`_parent`). 

783 

784 :returns: The parent, or ``None`` if it wasn't recorded. 

785 """ 

786 return self._parent 

787 

788 

789@export 

790class NotInNamespaceError(VHDLModelException, KeyError): 

791 """ 

792 This exception is raised, when an element isn't declared in a namespace under the given identifier. 

793 

794 It's a :exc:`KeyError` too, like removing a missing key from a dictionary. 

795 """ 

796 

797 _identifier: Nullable[str] #: The identifier looked up. 

798 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier. 

799 _namespace: Nullable[_Namespace] #: The namespace searched for the identifier. 

800 

801 def __init__( 

802 self, 

803 message: str, 

804 /, *, 

805 identifier: Nullable[str] = None, 

806 namespace: Nullable[_Namespace] = None 

807 ) -> None: 

808 """ 

809 Initializes the exception with the identifier and the namespace searched for it. 

810 

811 :param message: The error message. 

812 :param identifier: Optional, the identifier looked up. 

813 :param namespace: Optional, the namespace searched for the identifier. 

814 """ 

815 super().__init__(message) 

816 self._identifier = identifier 

817 self._normalizedIdentifier = identifier.lower() if identifier is not None else None 

818 self._namespace = namespace 

819 

820 @readonly 

821 def Identifier(self) -> Nullable[str]: 

822 """ 

823 Read-only property to access the identifier looked up (:attr:`_identifier`). 

824 

825 :returns: The identifier, or ``None`` if it wasn't recorded. 

826 """ 

827 return self._identifier 

828 

829 @readonly 

830 def NormalizedIdentifier(self) -> Nullable[str]: 

831 """ 

832 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`). 

833 

834 :returns: The normalized identifier, or ``None`` if it wasn't recorded. 

835 """ 

836 return self._normalizedIdentifier 

837 

838 @readonly 

839 def Namespace(self) -> Nullable[_Namespace]: 

840 """ 

841 Read-only property to access the namespace searched for the identifier (:attr:`_namespace`). 

842 

843 :returns: The namespace, or ``None`` if it wasn't recorded. 

844 """ 

845 return self._namespace 

846 

847 def __str__(self) -> str: 

848 """ 

849 Return the exception's message. 

850 

851 :returns: The message, without the quotes :exc:`KeyError` adds. 

852 """ 

853 return self.args[0] 

854 

855 

856@export 

857class DuplicateGenericError(VHDLModelException, DuplicateElementError): 

858 """ 

859 This exception is raised, when a language construct already has a generic of the same identifier. 

860 """ 

861 

862 _identifier: Nullable[str] #: The identifier declared twice. 

863 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier. 

864 _parent: Nullable[ModelEntity] #: The language construct owning the generic clause. 

865 _element: Nullable[ModelEntity] #: The new generic. 

866 _existing: Nullable[ModelEntity] #: The existing declaration. 

867 

868 def __init__( 

869 self, 

870 message: str, 

871 /, *, 

872 identifier: Nullable[str] = None, 

873 parent: Nullable[ModelEntity] = None, 

874 element: Nullable[ModelEntity] = None, 

875 existing: Nullable[ModelEntity] = None 

876 ) -> None: 

877 """ 

878 Initializes the exception with the identifier, the language construct and both declarations. 

879 

880 :param message: The error message. 

881 :param identifier: Optional, the identifier declared twice. 

882 :param parent: Optional, the language construct owning the generic clause. 

883 :param element: Optional, the new generic. 

884 :param existing: Optional, the existing declaration. 

885 """ 

886 super().__init__(message) 

887 self._identifier = identifier 

888 self._normalizedIdentifier = identifier.lower() if identifier is not None else None 

889 self._parent = parent 

890 self._element = element 

891 self._existing = existing 

892 

893 @readonly 

894 def Identifier(self) -> Nullable[str]: 

895 """ 

896 Read-only property to access the identifier declared twice (:attr:`_identifier`). 

897 

898 :returns: The identifier, or ``None`` if it wasn't recorded. 

899 """ 

900 return self._identifier 

901 

902 @readonly 

903 def NormalizedIdentifier(self) -> Nullable[str]: 

904 """ 

905 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`). 

906 

907 :returns: The normalized identifier, or ``None`` if it wasn't recorded. 

908 """ 

909 return self._normalizedIdentifier 

910 

911 @readonly 

912 def Parent(self) -> Nullable[ModelEntity]: 

913 """ 

914 Read-only property to access the language construct owning the generic clause (:attr:`_parent`). 

915 

916 :returns: The language construct, or ``None`` if it wasn't recorded. 

917 """ 

918 return self._parent 

919 

920 @readonly 

921 def Element(self) -> Nullable[ModelEntity]: 

922 """ 

923 Read-only property to access the new generic (:attr:`_element`). 

924 

925 :returns: The generic, or ``None`` if it wasn't recorded. 

926 """ 

927 return self._element 

928 

929 @readonly 

930 def Existing(self) -> Nullable[ModelEntity]: 

931 """ 

932 Read-only property to access the existing declaration (:attr:`_existing`). 

933 

934 :returns: The declaration, or ``None`` if it wasn't recorded. 

935 """ 

936 return self._existing 

937 

938 

939@export 

940class DuplicatePortError(VHDLModelException, DuplicateElementError): 

941 """ 

942 This exception is raised, when a language construct already has a port of the same identifier. 

943 """ 

944 

945 _identifier: Nullable[str] #: The identifier declared twice. 

946 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier. 

947 _parent: Nullable[ModelEntity] #: The language construct owning the port clause. 

948 _element: Nullable[ModelEntity] #: The new port. 

949 _existing: Nullable[ModelEntity] #: The existing declaration. 

950 

951 def __init__( 

952 self, 

953 message: str, 

954 /, *, 

955 identifier: Nullable[str] = None, 

956 parent: Nullable[ModelEntity] = None, 

957 element: Nullable[ModelEntity] = None, 

958 existing: Nullable[ModelEntity] = None 

959 ) -> None: 

960 """ 

961 Initializes the exception with the identifier, the language construct and both declarations. 

962 

963 :param message: The error message. 

964 :param identifier: Optional, the identifier declared twice. 

965 :param parent: Optional, the language construct owning the port clause. 

966 :param element: Optional, the new port. 

967 :param existing: Optional, the existing declaration. 

968 """ 

969 super().__init__(message) 

970 self._identifier = identifier 

971 self._normalizedIdentifier = identifier.lower() if identifier is not None else None 

972 self._parent = parent 

973 self._element = element 

974 self._existing = existing 

975 

976 @readonly 

977 def Identifier(self) -> Nullable[str]: 

978 """ 

979 Read-only property to access the identifier declared twice (:attr:`_identifier`). 

980 

981 :returns: The identifier, or ``None`` if it wasn't recorded. 

982 """ 

983 return self._identifier 

984 

985 @readonly 

986 def NormalizedIdentifier(self) -> Nullable[str]: 

987 """ 

988 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`). 

989 

990 :returns: The normalized identifier, or ``None`` if it wasn't recorded. 

991 """ 

992 return self._normalizedIdentifier 

993 

994 @readonly 

995 def Parent(self) -> Nullable[ModelEntity]: 

996 """ 

997 Read-only property to access the language construct owning the port clause (:attr:`_parent`). 

998 

999 :returns: The language construct, or ``None`` if it wasn't recorded. 

1000 """ 

1001 return self._parent 

1002 

1003 @readonly 

1004 def Element(self) -> Nullable[ModelEntity]: 

1005 """ 

1006 Read-only property to access the new port (:attr:`_element`). 

1007 

1008 :returns: The port, or ``None`` if it wasn't recorded. 

1009 """ 

1010 return self._element 

1011 

1012 @readonly 

1013 def Existing(self) -> Nullable[ModelEntity]: 

1014 """ 

1015 Read-only property to access the existing declaration (:attr:`_existing`). 

1016 

1017 :returns: The declaration, or ``None`` if it wasn't recorded. 

1018 """ 

1019 return self._existing 

1020 

1021 

1022@export 

1023class DuplicateParameterError(VHDLModelException, DuplicateElementError): 

1024 """ 

1025 This exception is raised, when a language construct already has a parameter of the same identifier. 

1026 """ 

1027 

1028 _identifier: Nullable[str] #: The identifier declared twice. 

1029 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier. 

1030 _parent: Nullable[ModelEntity] #: The language construct owning the parameter list. 

1031 _element: Nullable[ModelEntity] #: The new parameter. 

1032 _existing: Nullable[ModelEntity] #: The existing declaration. 

1033 

1034 def __init__( 

1035 self, 

1036 message: str, 

1037 /, *, 

1038 identifier: Nullable[str] = None, 

1039 parent: Nullable[ModelEntity] = None, 

1040 element: Nullable[ModelEntity] = None, 

1041 existing: Nullable[ModelEntity] = None 

1042 ) -> None: 

1043 """ 

1044 Initializes the exception with the identifier, the language construct and both declarations. 

1045 

1046 :param message: The error message. 

1047 :param identifier: Optional, the identifier declared twice. 

1048 :param parent: Optional, the language construct owning the parameter list. 

1049 :param element: Optional, the new parameter. 

1050 :param existing: Optional, the existing declaration. 

1051 """ 

1052 super().__init__(message) 

1053 self._identifier = identifier 

1054 self._normalizedIdentifier = identifier.lower() if identifier is not None else None 

1055 self._parent = parent 

1056 self._element = element 

1057 self._existing = existing 

1058 

1059 @readonly 

1060 def Identifier(self) -> Nullable[str]: 

1061 """ 

1062 Read-only property to access the identifier declared twice (:attr:`_identifier`). 

1063 

1064 :returns: The identifier, or ``None`` if it wasn't recorded. 

1065 """ 

1066 return self._identifier 

1067 

1068 @readonly 

1069 def NormalizedIdentifier(self) -> Nullable[str]: 

1070 """ 

1071 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`). 

1072 

1073 :returns: The normalized identifier, or ``None`` if it wasn't recorded. 

1074 """ 

1075 return self._normalizedIdentifier 

1076 

1077 @readonly 

1078 def Parent(self) -> Nullable[ModelEntity]: 

1079 """ 

1080 Read-only property to access the language construct owning the parameter list (:attr:`_parent`). 

1081 

1082 :returns: The language construct, or ``None`` if it wasn't recorded. 

1083 """ 

1084 return self._parent 

1085 

1086 @readonly 

1087 def Element(self) -> Nullable[ModelEntity]: 

1088 """ 

1089 Read-only property to access the new parameter (:attr:`_element`). 

1090 

1091 :returns: The parameter, or ``None`` if it wasn't recorded. 

1092 """ 

1093 return self._element 

1094 

1095 @readonly 

1096 def Existing(self) -> Nullable[ModelEntity]: 

1097 """ 

1098 Read-only property to access the existing declaration (:attr:`_existing`). 

1099 

1100 :returns: The declaration, or ``None`` if it wasn't recorded. 

1101 """ 

1102 return self._existing 

1103 

1104 

1105@export 

1106class DuplicateDeclarationError(VHDLModelException, DuplicateElementError): 

1107 """ 

1108 This exception is raised, when a declarative region already declares an identifier of a declared item. 

1109 

1110 It's raised for declared items without a more specific error, and it's the base-class of the more specific errors. 

1111 Subprograms are overloadable, so a subprogram sharing its identifier with another subprogram is no duplicate. 

1112 

1113 .. seealso:: 

1114 

1115 * :class:`Duplicate type error <pyVHDLModel.Exception.DuplicateTypeError>` 

1116 * :class:`Duplicate subtype error <pyVHDLModel.Exception.DuplicateSubtypeError>` 

1117 * :class:`Duplicate constant error <pyVHDLModel.Exception.DuplicateConstantError>` 

1118 * :class:`Duplicate signal error <pyVHDLModel.Exception.DuplicateSignalError>` 

1119 * :class:`Duplicate variable error <pyVHDLModel.Exception.DuplicateVariableError>` 

1120 * :class:`Duplicate file error <pyVHDLModel.Exception.DuplicateFileError>` 

1121 * :class:`Duplicate component error <pyVHDLModel.Exception.DuplicateComponentError>` 

1122 * :class:`Duplicate subprogram error <pyVHDLModel.Exception.DuplicateSubprogramError>` 

1123 * :class:`Duplicate label error <pyVHDLModel.Exception.DuplicateLabelError>` 

1124 """ 

1125 

1126 _identifier: Nullable[str] #: The identifier declared twice. 

1127 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier. 

1128 _namespace: Nullable[_Namespace] #: The namespace of the declarative region declaring it. 

1129 _element: Nullable[ModelEntity] #: The new declaration. 

1130 _existing: Nullable[ModelEntity] #: The existing declaration. 

1131 

1132 def __init__( 

1133 self, 

1134 message: str, 

1135 /, *, 

1136 identifier: Nullable[str] = None, 

1137 namespace: Nullable[_Namespace] = None, 

1138 element: Nullable[ModelEntity] = None, 

1139 existing: Nullable[ModelEntity] = None 

1140 ) -> None: 

1141 """ 

1142 Initializes the exception with the identifier, the namespace and both declarations. 

1143 

1144 :param message: The error message. 

1145 :param identifier: Optional, the identifier declared twice. 

1146 :param namespace: Optional, the namespace of the declarative region declaring it. 

1147 :param element: Optional, the new declaration. 

1148 :param existing: Optional, the existing declaration. 

1149 """ 

1150 super().__init__(message) 

1151 self._identifier = identifier 

1152 self._normalizedIdentifier = identifier.lower() if identifier is not None else None 

1153 self._namespace = namespace 

1154 self._element = element 

1155 self._existing = existing 

1156 

1157 @readonly 

1158 def Identifier(self) -> Nullable[str]: 

1159 """ 

1160 Read-only property to access the identifier declared twice (:attr:`_identifier`). 

1161 

1162 :returns: The identifier, or ``None`` if it wasn't recorded. 

1163 """ 

1164 return self._identifier 

1165 

1166 @readonly 

1167 def NormalizedIdentifier(self) -> Nullable[str]: 

1168 """ 

1169 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`). 

1170 

1171 :returns: The normalized identifier, or ``None`` if it wasn't recorded. 

1172 """ 

1173 return self._normalizedIdentifier 

1174 

1175 @readonly 

1176 def Namespace(self) -> Nullable[_Namespace]: 

1177 """ 

1178 Read-only property to access the namespace of the declarative region declaring it (:attr:`_namespace`). 

1179 

1180 :returns: The namespace, or ``None`` if it wasn't recorded. 

1181 """ 

1182 return self._namespace 

1183 

1184 @readonly 

1185 def Element(self) -> Nullable[ModelEntity]: 

1186 """ 

1187 Read-only property to access the new declaration (:attr:`_element`). 

1188 

1189 :returns: The declaration, or ``None`` if it wasn't recorded. 

1190 """ 

1191 return self._element 

1192 

1193 @readonly 

1194 def Existing(self) -> Nullable[ModelEntity]: 

1195 """ 

1196 Read-only property to access the existing declaration (:attr:`_existing`). 

1197 

1198 :returns: The declaration, or ``None`` if it wasn't recorded. 

1199 """ 

1200 return self._existing 

1201 

1202 

1203@export 

1204class DuplicateTypeError(DuplicateDeclarationError): 

1205 """ 

1206 This exception is raised, when a declarative region already declares the identifier of a new type. 

1207 """ 

1208 

1209 

1210@export 

1211class DuplicateSubtypeError(DuplicateDeclarationError): 

1212 """ 

1213 This exception is raised, when a declarative region already declares the identifier of a new subtype. 

1214 """ 

1215 

1216 

1217@export 

1218class DuplicateConstantError(DuplicateDeclarationError): 

1219 """ 

1220 This exception is raised, when a declarative region already declares the identifier of a new constant. 

1221 """ 

1222 

1223 

1224@export 

1225class DuplicateSignalError(DuplicateDeclarationError): 

1226 """ 

1227 This exception is raised, when a declarative region already declares the identifier of a new signal. 

1228 """ 

1229 

1230 

1231@export 

1232class DuplicateVariableError(DuplicateDeclarationError): 

1233 """ 

1234 This exception is raised, when a declarative region already declares the identifier of a new (shared) variable. 

1235 """ 

1236 

1237 

1238@export 

1239class DuplicateFileError(DuplicateDeclarationError): 

1240 """ 

1241 This exception is raised, when a declarative region already declares the identifier of a new file. 

1242 """ 

1243 

1244 

1245@export 

1246class DuplicateComponentError(DuplicateDeclarationError): 

1247 """ 

1248 This exception is raised, when a declarative region already declares the identifier of a new component. 

1249 """ 

1250 

1251 

1252@export 

1253class DuplicateSubprogramError(DuplicateDeclarationError): 

1254 """ 

1255 This exception is raised, when a declarative region already declares the identifier of a new subprogram. 

1256 

1257 Subprograms are overloadable, so only a declaration other than a subprogram is a duplicate. 

1258 """ 

1259 

1260 

1261@export 

1262class DuplicateLabelError(DuplicateDeclarationError): 

1263 """ 

1264 This exception is raised, when a declarative region already declares the label of a new statement. 

1265 

1266 A statement label is declared implicitly in the declarative region enclosing the statement, so it clashes with 

1267 another label and with a declaration of the same identifier. 

1268 """ 

1269 

1270 

1271@export 

1272class DuplicateAssociationError(VHDLModelException, DuplicateElementError): 

1273 """ 

1274 This exception is raised, when an association list already associates the formal of a new named association. 

1275 

1276 It's the base-class of the errors for generic, port and parameter associations. 

1277 

1278 .. seealso:: 

1279 

1280 * :class:`Duplicate generic association error <pyVHDLModel.Exception.DuplicateGenericAssociationError>` 

1281 * :class:`Duplicate port association error <pyVHDLModel.Exception.DuplicatePortAssociationError>` 

1282 * :class:`Duplicate parameter association error <pyVHDLModel.Exception.DuplicateParameterAssociationError>` 

1283 """ 

1284 

1285 _identifier: Nullable[str] #: The formal associated twice. 

1286 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) formal. 

1287 _parent: Nullable[ModelEntity] #: The language construct owning the association list. 

1288 _element: Nullable[ModelEntity] #: The new association. 

1289 _existing: Nullable[ModelEntity] #: The existing association. 

1290 

1291 def __init__( 

1292 self, 

1293 message: str, 

1294 /, *, 

1295 identifier: Nullable[str] = None, 

1296 parent: Nullable[ModelEntity] = None, 

1297 element: Nullable[ModelEntity] = None, 

1298 existing: Nullable[ModelEntity] = None 

1299 ) -> None: 

1300 """ 

1301 Initializes the exception with the formal, the language construct and both associations. 

1302 

1303 :param message: The error message. 

1304 :param identifier: Optional, the formal associated twice. 

1305 :param parent: Optional, the language construct owning the association list. 

1306 :param element: Optional, the new association. 

1307 :param existing: Optional, the existing association. 

1308 """ 

1309 super().__init__(message) 

1310 self._identifier = identifier 

1311 self._normalizedIdentifier = identifier.lower() if identifier is not None else None 

1312 self._parent = parent 

1313 self._element = element 

1314 self._existing = existing 

1315 

1316 @readonly 

1317 def Identifier(self) -> Nullable[str]: 

1318 """ 

1319 Read-only property to access the formal associated twice (:attr:`_identifier`). 

1320 

1321 :returns: The formal's identifier, or ``None`` if it wasn't recorded. 

1322 """ 

1323 return self._identifier 

1324 

1325 @readonly 

1326 def NormalizedIdentifier(self) -> Nullable[str]: 

1327 """ 

1328 Read-only property to access the normalized (lower case) formal (:attr:`_normalizedIdentifier`). 

1329 

1330 :returns: The normalized identifier, or ``None`` if it wasn't recorded. 

1331 """ 

1332 return self._normalizedIdentifier 

1333 

1334 @readonly 

1335 def Parent(self) -> Nullable[ModelEntity]: 

1336 """ 

1337 Read-only property to access the language construct owning the association list (:attr:`_parent`). 

1338 

1339 :returns: The language construct, or ``None`` if it wasn't recorded. 

1340 """ 

1341 return self._parent 

1342 

1343 @readonly 

1344 def Element(self) -> Nullable[ModelEntity]: 

1345 """ 

1346 Read-only property to access the new association (:attr:`_element`). 

1347 

1348 :returns: The association, or ``None`` if it wasn't recorded. 

1349 """ 

1350 return self._element 

1351 

1352 @readonly 

1353 def Existing(self) -> Nullable[ModelEntity]: 

1354 """ 

1355 Read-only property to access the existing association (:attr:`_existing`). 

1356 

1357 :returns: The association, or ``None`` if it wasn't recorded. 

1358 """ 

1359 return self._existing 

1360 

1361 

1362@export 

1363class DuplicateGenericAssociationError(DuplicateAssociationError): 

1364 """ 

1365 This exception is raised, when a generic map aspect already associates the formal of a new generic association. 

1366 """ 

1367 

1368 

1369@export 

1370class DuplicatePortAssociationError(DuplicateAssociationError): 

1371 """ 

1372 This exception is raised, when a port map aspect already associates the formal of a new port association. 

1373 """ 

1374 

1375 

1376@export 

1377class DuplicateParameterAssociationError(DuplicateAssociationError): 

1378 """ 

1379 This exception is raised, when a procedure call already associates the formal of a new parameter association. 

1380 """ 

1381 

1382 

1383@export 

1384class AssociationOrderError(VHDLModelException): 

1385 """ 

1386 This exception is raised, when a new association breaks the order of an association list. 

1387 

1388 All positional associations of an association list precede its named associations: the existing association is a 

1389 named association preceding a new positional association, or a positional association following a new named 

1390 association. 

1391 """ 

1392 

1393 _parent: Nullable[ModelEntity] #: The language construct owning the association list. 

1394 _element: Nullable[ModelEntity] #: The new association. 

1395 _existing: Nullable[ModelEntity] #: The existing association, the new association is out of order with. 

1396 

1397 def __init__( 

1398 self, 

1399 message: str, 

1400 /, *, 

1401 parent: Nullable[ModelEntity] = None, 

1402 element: Nullable[ModelEntity] = None, 

1403 existing: Nullable[ModelEntity] = None 

1404 ) -> None: 

1405 """ 

1406 Initializes the exception with the language construct and both associations. 

1407 

1408 :param message: The error message. 

1409 :param parent: Optional, the language construct owning the association list. 

1410 :param element: Optional, the new association. 

1411 :param existing: Optional, the existing association, the new association is out of order with. 

1412 """ 

1413 super().__init__(message) 

1414 self._parent = parent 

1415 self._element = element 

1416 self._existing = existing 

1417 

1418 @readonly 

1419 def Parent(self) -> Nullable[ModelEntity]: 

1420 """ 

1421 Read-only property to access the language construct owning the association list (:attr:`_parent`). 

1422 

1423 :returns: The language construct, or ``None`` if it wasn't recorded. 

1424 """ 

1425 return self._parent 

1426 

1427 @readonly 

1428 def Element(self) -> Nullable[ModelEntity]: 

1429 """ 

1430 Read-only property to access the new association (:attr:`_element`). 

1431 

1432 :returns: The association, or ``None`` if it wasn't recorded. 

1433 """ 

1434 return self._element 

1435 

1436 @readonly 

1437 def Existing(self) -> Nullable[ModelEntity]: 

1438 """ 

1439 Read-only property to access the existing association, the new association is out of order with 

1440 (:attr:`_existing`). 

1441 

1442 :returns: The association, or ``None`` if it wasn't recorded. 

1443 """ 

1444 return self._existing 

1445 

1446 

1447@export 

1448class LibraryNotFoundError(VHDLModelException): 

1449 """ 

1450 This exception is raised, when a library is looked up by name, but doesn't exist in the design. 

1451 

1452 Message: :pycode:`f"Library '{libraryName}' not found in design."` 

1453 """ 

1454 

1455 _libraryName: str #: The name of the library, which was not found. 

1456 

1457 def __init__(self, libraryName: str) -> None: 

1458 """ 

1459 Initializes the exception message based on the given library name. 

1460 

1461 :param libraryName: The name of the library, which was not found. 

1462 """ 

1463 super().__init__(f"Library '{libraryName}' not found in design.") 

1464 self._libraryName = libraryName 

1465 

1466 @readonly 

1467 def LibraryName(self) -> str: 

1468 """ 

1469 Read-only property to access the library name (:attr:`_libraryName`). 

1470 

1471 :returns: The name of the library, which was not found. 

1472 """ 

1473 return self._libraryName 

1474 

1475 

1476@export 

1477class DesignUnitNotFoundError(Exception): 

1478 """ 

1479 The exception is raised when a design unit is looked up by name, but doesn't exist in the searched library. 

1480 

1481 It's a common base: a kind-specific exception derives from it and from :exc:`VHDLModelException`, e.g. 

1482 ``class EntityNotFoundError(VHDLModelException, DesignUnitNotFoundError)``. It has no initializer of its own; the 

1483 derived exception sets the fields. 

1484 

1485 .. seealso:: 

1486 

1487 :exc:`~pyVHDLModel.Exception.EntityNotFoundError` 

1488 |rarr| Entity not found. 

1489 :exc:`~pyVHDLModel.Exception.PackageNotFoundError` 

1490 |rarr| Package not found. 

1491 :exc:`~pyVHDLModel.Exception.ConfigurationNotFoundError` 

1492 |rarr| Configuration not found. 

1493 :exc:`~pyVHDLModel.Exception.ContextNotFoundError` 

1494 |rarr| Context not found. 

1495 """ 

1496 

1497 _designUnitName: str #: The name of the design unit, which was not found. 

1498 _libraryName: str #: The name of the searched library. 

1499 

1500 @readonly 

1501 def DesignUnitName(self) -> str: 

1502 """ 

1503 Read-only property to access the design unit name (:attr:`_designUnitName`). 

1504 

1505 :returns: The name of the design unit, which was not found. 

1506 """ 

1507 return self._designUnitName 

1508 

1509 @readonly 

1510 def LibraryName(self) -> str: 

1511 """ 

1512 Read-only property to access the library name (:attr:`_libraryName`). 

1513 

1514 :returns: The name of the searched library. 

1515 """ 

1516 return self._libraryName 

1517 

1518 

1519@export 

1520class EntityNotFoundError(VHDLModelException, DesignUnitNotFoundError): 

1521 """ 

1522 This exception is raised, when an entity is looked up by name, but doesn't exist in the searched library. 

1523 

1524 Message: :pycode:`f"Entity '{entityName}' not found in library '{libraryName}'."` 

1525 """ 

1526 

1527 def __init__(self, entityName: str, libraryName: str) -> None: 

1528 """ 

1529 Initializes the exception message based on the given entity name and library name. 

1530 

1531 :param entityName: The name of the entity, which was not found. 

1532 :param libraryName: The name of the searched library. 

1533 """ 

1534 super().__init__(f"Entity '{entityName}' not found in library '{libraryName}'.") 

1535 

1536 self._designUnitName = entityName 

1537 self._libraryName = libraryName 

1538 

1539 

1540@export 

1541class PackageNotFoundError(VHDLModelException, DesignUnitNotFoundError): 

1542 """ 

1543 This exception is raised, when a package is looked up by name, but doesn't exist in the searched library. 

1544 

1545 Message: :pycode:`f"Package '{packageName}' not found in library '{libraryName}'."` 

1546 """ 

1547 

1548 def __init__(self, packageName: str, libraryName: str) -> None: 

1549 """ 

1550 Initializes the exception message based on the given package name and library name. 

1551 

1552 :param packageName: The name of the package, which was not found. 

1553 :param libraryName: The name of the searched library. 

1554 """ 

1555 super().__init__(f"Package '{packageName}' not found in library '{libraryName}'.") 

1556 

1557 self._designUnitName = packageName 

1558 self._libraryName = libraryName 

1559 

1560 

1561@export 

1562class ConfigurationNotFoundError(VHDLModelException, DesignUnitNotFoundError): 

1563 """ 

1564 This exception is raised, when a configuration is looked up by name, but doesn't exist in the searched library. 

1565 

1566 Message: :pycode:`f"Configuration '{configurationName}' not found in library '{libraryName}'."` 

1567 """ 

1568 

1569 def __init__(self, configurationName: str, libraryName: str) -> None: 

1570 """ 

1571 Initializes the exception message based on the given configuration name and library name. 

1572 

1573 :param configurationName: The name of the configuration, which was not found. 

1574 :param libraryName: The name of the searched library. 

1575 """ 

1576 super().__init__(f"Configuration '{configurationName}' not found in library '{libraryName}'.") 

1577 

1578 self._designUnitName = configurationName 

1579 self._libraryName = libraryName 

1580 

1581 

1582@export 

1583class ContextNotFoundError(VHDLModelException, DesignUnitNotFoundError): 

1584 """ 

1585 This exception is raised, when a context is looked up by name, but doesn't exist in the searched library. 

1586 

1587 Message: :pycode:`f"Context '{contextName}' not found in library '{libraryName}'."` 

1588 """ 

1589 

1590 def __init__(self, contextName: str, libraryName: str) -> None: 

1591 """ 

1592 Initializes the exception message based on the given context name and library name. 

1593 

1594 :param contextName: The name of the context, which was not found. 

1595 :param libraryName: The name of the searched library. 

1596 """ 

1597 super().__init__(f"Context '{contextName}' not found in library '{libraryName}'.") 

1598 

1599 self._designUnitName = contextName 

1600 self._libraryName = libraryName 

1601 

1602 

1603@export 

1604class VHDLWriterError(VHDLModelException): 

1605 """ 

1606 This exception is raised, when the VHDL writer can't write a model element as VHDL source text. 

1607 

1608 The element's content has no VHDL notation, e.g. a string literal containing a control character. 

1609 """ 

1610 

1611 _element: ModelElementUnion #: The model element the writer could not write. 

1612 

1613 def __init__(self, message: str, element: ModelElementUnion) -> None: 

1614 """ 

1615 Initializes the exception with a message and the model element that could not be written. 

1616 

1617 :param message: The error message. 

1618 :param element: The model element that could not be written. 

1619 """ 

1620 super().__init__(message) 

1621 self._element = element 

1622 

1623 @readonly 

1624 def Element(self) -> ModelElementUnion: 

1625 """ 

1626 Read-only property to access the model element that could not be written (:attr:`_element`). 

1627 

1628 :returns: The model element. 

1629 """ 

1630 return self._element