Concurrent
Summary
- Package:
- Doc-string:
documented
File |
Expected |
Covered |
Uncovered |
Coverage |
|---|---|---|---|---|
Concurrent.py |
143 |
132 |
11 |
92.3% |
Source
pyVHDLModel/Concurrent.pydocumentedundocumentedignoredexcludednot counted
32"""
33This module contains parts of an abstract document language model for VHDL.
34
35Concurrent defines all concurrent statements used in entities, architectures, generates and block statements.
36"""
...
65
67ExpressionUnion = Union[
68 BaseExpression,
69 QualifiedExpression,
70 FunctionCall,
71 TypeConversion,
72 # ConstantOrSymbol, TODO: ObjectSymbol
73 Literal,
74]
75
77@export
78@abstractclass
79class ConcurrentStatement(Statement):
80 """
81 A base-class for all concurrent statements.
82
83 .. seealso::
84
85 * :class:`Instantiation <pyVHDLModel.Concurrent.Instantiation>`
86 * :class:`Process statement <pyVHDLModel.Concurrent.ProcessStatement>`
87 * :class:`Concurrent procedure call <pyVHDLModel.Concurrent.ConcurrentProcedureCall>`
88 * :class:`Concurrent block statement <pyVHDLModel.Concurrent.ConcurrentBlockStatement>`
89 * :class:`Generate statement <pyVHDLModel.Concurrent.GenerateStatement>`
90 * :class:`Concurrent signal assignment <pyVHDLModel.Concurrent.ConcurrentSignalAssignment>`
91 * :class:`Concurrent assert statement <pyVHDLModel.Concurrent.ConcurrentAssertStatement>`
92 """
93
95@export
96class ConcurrentStatementsMixin(metaclass=ExtendedType, mixin=True, expects=("_ClashingDeclarations", )):
97 """
98 A mixin-class for all language constructs supporting concurrent statements.
99
100 .. seealso::
101
102 * :class:`Concurrent block statement <pyVHDLModel.Concurrent.ConcurrentBlockStatement>`
103 * :class:`Generate branch <pyVHDLModel.Concurrent.GenerateBranch>`
104 * :class:`Concurrent case <pyVHDLModel.Concurrent.ConcurrentCase>`
105 * :class:`For generate statement <pyVHDLModel.Concurrent.ForGenerateStatement>`
106 * :class:`Entity <pyVHDLModel.DesignUnit.Entity>`
107 * :class:`Architecture <pyVHDLModel.DesignUnit.Architecture>`
108
109 .. todo:: concurrent declaration region
110 """
111
112 _statements: list[ConcurrentStatement] #: List of all concurrent statements in this construct.
113
115 _instantiations: dict[str, Instantiation] #: All instantiations, indexed by label.
116 _hierarchy: dict[str, Union[ConcurrentBlockStatement, GenerateStatement]] #: All elements creating a hierarchy level (blocks and generates), in declaration order.
117 _areStatementsIndexed: bool #: ``True`` if :meth:`IndexStatements` filled :attr:`_instantiations` and :attr:`_hierarchy`.
118
119 def __init__(self, statements: Nullable[Iterable[ConcurrentStatement]] = None) -> None:
120 """
121 Initializes concurrent statements.
122
123 :param statements: List of all concurrent statements in this construct.
124 """
...
135
136 @readonly
137 def Statements(self) -> list[ConcurrentStatement]:
138 """
139 Read-only property to access the statements (:attr:`_statements`).
140
141 :returns: List of statements.
142 """
...
144
145 def _VisitStatements(self, visitor: Visitor) -> None:
146 """
147 Walk the concurrent statements in statement order with a visitor.
148
149 :param visitor: The visitor receiving the events.
150 """
...
153
154 def _Labels(self) -> tuple[ConcurrentStatement, ...]:
155 """
156 Return the labeled statements, whose labels are declared in this construct's declarative region.
157
158 A statement nested in a block or generate statement is declared in that statement's declarative region.
159
160 :returns: Tuple of labeled statements, in statement order.
161 """
...
163
164 def IterateInstantiations(self) -> Generator[Instantiation, None, None]:
...
170
172 def IndexStatements(self) -> None:
173 """
174 Index the instantiations, blocks and generate statements of this construct, and the statements nested in them.
175
176 Both lookup tables (:attr:`_instantiations`, :attr:`_hierarchy`) are cleared first, so indexing again yields the
177 same lookup tables. Afterwards, the statement mutators (e.g. :meth:`InsertStatement`) keep them up to date.
178 """
...
185
186 def _IndexStatement(self, statement: ConcurrentStatement) -> None:
187 """
188 Add an instantiation, a block or a generate statement to its lookup table, and index the statements nested in it.
189
190 :param statement: The concurrent statement of this construct.
191 """
...
200
201 def _UnindexStatement(self, statement: ConcurrentStatement) -> None:
202 """
203 Remove an instantiation, a block or a generate statement from its lookup table.
204
205 :param statement: The concurrent statement of this construct.
206 """
...
211
212 def AddStatement(self, statement: ConcurrentStatement) -> None:
213 """
214 Add a concurrent statement at the end of this construct.
215
216 The statement's parent is set to this construct. If the statements are indexed, an instantiation, a block or a
217 generate statement is added to the lookup table matching its kind.
218
219 :param statement: The concurrent statement to add.
220 :raises ValueError: If parameter 'statement' is ``None``.
221 :raises TypeError: If parameter 'statement' is not of type :class:`ConcurrentStatement`.
222 :raises AlreadyInDesignError: If parameter 'statement' already has a parent.
223 :raises DuplicateLabelError: If the declarative region already declares the statement's label.
224
225 .. seealso::
226
227 :meth:`InsertStatement`
228 |rarr| Insert a concurrent statement at a position of this construct.
229 :meth:`RemoveStatement`
230 |rarr| Remove a concurrent statement from this construct.
231 """
...
233
234 def InsertStatement(self, index: int, statement: ConcurrentStatement) -> None:
235 """
236 Insert a concurrent statement at a position of this construct.
237
238 The statement's parent is set to this construct: a process, block or generate statement connects its namespace to
239 this construct's namespace. If the statements are indexed (:meth:`IndexStatements`), an instantiation, a block or
240 a generate statement is added to the lookup table matching its kind, and the statements nested in it are indexed.
241
242 A statement label is declared in the declarative region of this construct: it may neither repeat another
243 statement's label, nor an identifier declared in the region, including the region an entity shares with its
244 architectures. An unlabeled statement declares nothing.
245
246 :param index: Position, from ``0`` (first) to the number of statements (append). A negative index
247 counts from the end, as for :meth:`list.insert`: ``-1`` inserts before the last
248 statement.
249 :param statement: The concurrent statement to insert.
250 :raises ValueError: If parameter 'index' is ``None``.
251 :raises TypeError: If parameter 'index' is not of type :class:`int`.
252 :raises ValueError: If parameter 'index' is out of range.
253 :raises ValueError: If parameter 'statement' is ``None``.
254 :raises TypeError: If parameter 'statement' is not of type :class:`ConcurrentStatement`.
255 :raises AlreadyInDesignError: If parameter 'statement' already has a parent.
256 :raises DuplicateLabelError: If the declarative region already declares the statement's label.
257
258 .. seealso::
259
260 :meth:`AddStatement`
261 |rarr| Add a concurrent statement at the end of this construct.
262 :meth:`InsertStatementBefore`
263 |rarr| Insert a concurrent statement before another statement.
264 :meth:`InsertStatementAfter`
265 |rarr| Insert a concurrent statement after another statement.
266 :meth:`RemoveStatement`
267 |rarr| Remove a concurrent statement from this construct.
268 :meth:`MoveStatement`
269 |rarr| Move a concurrent statement to a position of this construct.
270 """
...
313
314 def InsertStatementBefore(self, statement: ConcurrentStatement, before: ConcurrentStatement) -> None:
315 """
316 Insert a concurrent statement before another statement of this construct.
317
318 The statement's parent is set to this construct. If the statements are indexed, an instantiation, a block or a
319 generate statement is added to the lookup table matching its kind.
320
321 :param statement: The concurrent statement to insert.
322 :param before: The statement of this construct to insert before.
323 :raises ValueError: If parameter 'before' is ``None``.
324 :raises TypeError: If parameter 'before' is not of type :class:`~pyVHDLModel.Base.ModelEntity`.
325 :raises NotAChildError: If parameter 'before' is not a statement of this construct.
326 :raises ValueError: If parameter 'statement' is ``None``.
327 :raises TypeError: If parameter 'statement' is not of type :class:`ConcurrentStatement`.
328 :raises AlreadyInDesignError: If parameter 'statement' already has a parent.
329 :raises DuplicateLabelError: If the declarative region already declares the statement's label.
330
331 .. seealso::
332
333 :meth:`InsertStatement`
334 |rarr| Insert a concurrent statement at a position of this construct.
335 :meth:`InsertStatementAfter`
336 |rarr| Insert a concurrent statement after another statement.
337 """
...
359
360 def InsertStatementAfter(self, statement: ConcurrentStatement, after: ConcurrentStatement) -> None:
361 """
362 Insert a concurrent statement after another statement of this construct.
363
364 The statement's parent is set to this construct. If the statements are indexed, an instantiation, a block or a
365 generate statement is added to the lookup table matching its kind.
366
367 :param statement: The concurrent statement to insert.
368 :param after: The statement of this construct to insert after.
369 :raises ValueError: If parameter 'after' is ``None``.
370 :raises TypeError: If parameter 'after' is not of type :class:`~pyVHDLModel.Base.ModelEntity`.
371 :raises NotAChildError: If parameter 'after' is not a statement of this construct.
372 :raises ValueError: If parameter 'statement' is ``None``.
373 :raises TypeError: If parameter 'statement' is not of type :class:`ConcurrentStatement`.
374 :raises AlreadyInDesignError: If parameter 'statement' already has a parent.
375 :raises DuplicateLabelError: If the declarative region already declares the statement's label.
376
377 .. seealso::
378
379 :meth:`InsertStatement`
380 |rarr| Insert a concurrent statement at a position of this construct.
381 :meth:`InsertStatementBefore`
382 |rarr| Insert a concurrent statement before another statement.
383 """
...
405
406 def RemoveStatement(self, statement: ConcurrentStatement) -> None:
407 """
408 Remove a concurrent statement from this construct.
409
410 The statement is detached: its parent is cleared. If the statements are indexed, an instantiation, a block or a
411 generate statement is removed from its lookup table. The statement itself is unchanged and can be added to another
412 construct, or inserted at another position. A removed process, block or generate statement keeps the link of its
413 namespace to this construct's namespace.
414
415 :param statement: The concurrent statement to remove.
416 :raises ValueError: If parameter 'statement' is ``None``.
417 :raises TypeError: If parameter 'statement' is not of type :class:`~pyVHDLModel.Base.ModelEntity`.
418 :raises NotAChildError: If parameter 'statement' is not a statement of this construct.
419
420 .. seealso::
421
422 :meth:`AddStatement`
423 |rarr| Add a concurrent statement at the end of this construct.
424 :meth:`InsertStatement`
425 |rarr| Insert a concurrent statement at a position of this construct.
426 :meth:`MoveStatement`
427 |rarr| Move a concurrent statement to a position of this construct.
428 """
...
454
455 def MoveStatement(self, statement: ConcurrentStatement, index: int) -> None:
456 """
457 Move a concurrent statement to a position of this construct.
458
459 The statement stays a statement of this construct: only the order of the statements changes. If the statements are
460 indexed (:meth:`IndexStatements`), the lookup tables are unchanged.
461
462 :param statement: The concurrent statement to move.
463 :param index: Position of the statement after the move, from ``0`` (first) to the number of statements
464 minus one (last). A negative index counts from the end, as for a :class:`list` index: ``-1``
465 moves the statement to the end.
466 :raises ValueError: If parameter 'statement' is ``None``.
467 :raises TypeError: If parameter 'statement' is not of type :class:`~pyVHDLModel.Base.ModelEntity`.
468 :raises NotAChildError: If parameter 'statement' is not a statement of this construct.
469 :raises ValueError: If parameter 'index' is ``None``.
470 :raises TypeError: If parameter 'index' is not of type :class:`int`.
471 :raises ValueError: If parameter 'index' is out of range.
472
473 .. seealso::
474
475 :meth:`MoveStatementBefore`
476 |rarr| Move a concurrent statement before another statement.
477 :meth:`MoveStatementAfter`
478 |rarr| Move a concurrent statement after another statement.
479 :meth:`InsertStatement`
480 |rarr| Insert a concurrent statement at a position of this construct.
481 :meth:`RemoveStatement`
482 |rarr| Remove a concurrent statement from this construct.
483 """
...
518
519 def MoveStatementBefore(self, statement: ConcurrentStatement, before: ConcurrentStatement) -> None:
520 """
521 Move a concurrent statement before another statement of this construct.
522
523 The statement stays a statement of this construct: only the order of the statements changes, as for
524 :meth:`MoveStatement`. Moving a statement before itself keeps it in place.
525
526 :param statement: The concurrent statement to move.
527 :param before: The statement of this construct to move before.
528 :raises ValueError: If parameter 'before' is ``None``.
529 :raises TypeError: If parameter 'before' is not of type :class:`~pyVHDLModel.Base.ModelEntity`.
530 :raises NotAChildError: If parameter 'before' is not a statement of this construct.
531 :raises ValueError: If parameter 'statement' is ``None``.
532 :raises TypeError: If parameter 'statement' is not of type :class:`~pyVHDLModel.Base.ModelEntity`.
533 :raises NotAChildError: If parameter 'statement' is not a statement of this construct.
534
535 .. seealso::
536
537 :meth:`MoveStatement`
538 |rarr| Move a concurrent statement to a position of this construct.
539 :meth:`MoveStatementAfter`
540 |rarr| Move a concurrent statement after another statement.
541 """
...
564
565 def MoveStatementAfter(self, statement: ConcurrentStatement, after: ConcurrentStatement) -> None:
566 """
567 Move a concurrent statement after another statement of this construct.
568
569 The statement stays a statement of this construct: only the order of the statements changes, as for
570 :meth:`MoveStatement`. Moving a statement after itself keeps it in place.
571
572 :param statement: The concurrent statement to move.
573 :param after: The statement of this construct to move after.
574 :raises ValueError: If parameter 'after' is ``None``.
575 :raises TypeError: If parameter 'after' is not of type :class:`~pyVHDLModel.Base.ModelEntity`.
576 :raises NotAChildError: If parameter 'after' is not a statement of this construct.
577 :raises ValueError: If parameter 'statement' is ``None``.
578 :raises TypeError: If parameter 'statement' is not of type :class:`~pyVHDLModel.Base.ModelEntity`.
579 :raises NotAChildError: If parameter 'statement' is not a statement of this construct.
580
581 .. seealso::
582
583 :meth:`MoveStatement`
584 |rarr| Move a concurrent statement to a position of this construct.
585 :meth:`MoveStatementBefore`
586 |rarr| Move a concurrent statement before another statement.
587 """
...
610
612@export
613@abstractclass
614class Instantiation(ConcurrentStatement, GenericMapAspectMixin, PortMapAspectMixin):
615 """
616 A base-class for all (component) instantiations.
617
618 .. seealso::
619
620 * :class:`Component instantiation <pyVHDLModel.Concurrent.ComponentInstantiation>`
621 * :class:`Entity instantiation <pyVHDLModel.Concurrent.EntityInstantiation>`
622 * :class:`Configuration instantiation <pyVHDLModel.Concurrent.ConfigurationInstantiation>`
623 """
624
625 def __init__(
626 self,
627 label: str,
628 genericAssociationItems: Nullable[Iterable[GenericAssociationItem]] = None,
629 portAssociationItems: Nullable[Iterable[PortAssociationItem]] = None,
630 parent: Nullable[ModelEntity] = None
631 ) -> None:
632 """
633 Initializes an instantiation.
634
635 :param label: The label of a model entity.
636 :param genericAssociationItems: List of all generic associations in the generic map aspect.
637 :param portAssociationItems: List of all port associations in the port map aspect.
638 :param parent: The parent model entity of this entity.
639 """
...
643
644 def _VisitMapAspects(self, visitor: Visitor) -> None:
645 """
646 Walk the generic map aspect and the port map aspect of this instantiation with a visitor.
647
648 :param visitor: The visitor receiving the events.
649 """
...
652
656@export
657class ComponentInstantiation(Instantiation):
658 """
659 Represents a component instantiation.
660
661 The instantiated component is available as :data:`Component`, the associations as
662 :data:`GenericAssociationItems` and :data:`PortAssociationItems`. The label is mandatory.
663
664 .. admonition:: Example
665
666 .. code-block:: VHDL
667
668 inst : component Counter;
669 --^^^^ <- Label
670 -- ^^^^^^^ <- Component
671 """
672
673 _component: ComponentInstantiationSymbol #: Reference to the instantiated component.
674
675 def __init__(
676 self,
677 label: str,
678 componentSymbol: ComponentInstantiationSymbol,
679 genericAssociationItems: Nullable[Iterable[AssociationItem]] = None,
680 portAssociationItems: Nullable[Iterable[AssociationItem]] = None,
681 parent: Nullable[ModelEntity] = None
682 ) -> None:
683 """
684 Initializes a component instantiation.
685
686 :param label: The label of a model entity.
687 :param componentSymbol: Reference to the instantiated component.
688 :param genericAssociationItems: List of all generic associations in the generic map aspect.
689 :param portAssociationItems: List of all port associations in the port map aspect.
690 :param parent: The parent model entity of this entity.
691 """
...
696
697 def Visit(self, visitor: Visitor) -> None:
698 """
699 Walk this component instantiation, its component and its map aspects with a visitor.
700
701 :param visitor: The visitor receiving the events.
702 """
...
707
708 @readonly
709 def Component(self) -> ComponentInstantiationSymbol:
710 """
711 Read-only property to access the component (:attr:`_component`).
712
713 :returns: The component.
714 """
...
716
718@export
719class EntityInstantiation(Instantiation):
720 """
721 Represents a direct entity instantiation.
722
723 The instantiated entity is available as :data:`Entity` and the optionally selected architecture
724 as :data:`Architecture`. The label is mandatory.
725
726 .. admonition:: Example
727
728 .. code-block:: VHDL
729
730 inst : entity work.Counter(rtl);
731 --^^^^ <- Label
732 -- ^^^^^^^^^^^^ <- Entity
733 -- ^^^ <- optional Architecture
734 """
735
736 _entity: EntityInstantiationSymbol #: Reference to the directly instantiated entity.
737 _architecture: ArchitectureSymbol #: Reference to the selected architecture, if one was given.
738
739 def __init__(
740 self,
741 label: str,
742 entitySymbol: EntityInstantiationSymbol,
743 architectureSymbol: Nullable[ArchitectureSymbol] = None,
744 genericAssociationItems: Nullable[Iterable[AssociationItem]] = None,
745 portAssociationItems: Nullable[Iterable[AssociationItem]] = None,
746 parent: Nullable[ModelEntity] = None
747 ) -> None:
748 """
749 Initializes a direct entity instantiation.
750
751 :param label: The label of a model entity.
752 :param entitySymbol: Reference to the directly instantiated entity.
753 :param architectureSymbol: Reference to the selected architecture, if one was given.
754 :param genericAssociationItems: List of all generic associations in the generic map aspect.
755 :param portAssociationItems: List of all port associations in the port map aspect.
756 :param parent: The parent model entity of this entity.
757 """
...
766
767 def Visit(self, visitor: Visitor) -> None:
768 """
769 Walk this entity instantiation, its entity, its architecture (if any) and its map aspects with a visitor.
770
771 :param visitor: The visitor receiving the events.
772 """
...
782
783 @readonly
784 def Entity(self) -> EntityInstantiationSymbol:
785 """
786 Read-only property to access the entity (:attr:`_entity`).
787
788 :returns: The entity.
789 """
...
791
792 @readonly
793 def Architecture(self) -> ArchitectureSymbol:
794 """
795 Read-only property to access the architecture (:attr:`_architecture`).
796
797 :returns: The architecture.
798 """
...
800
802@export
803class ConfigurationInstantiation(Instantiation):
804 """
805 Represents a configuration instantiation.
806
807 The instantiated configuration is available as :data:`Configuration`. The label is mandatory.
808
809 .. admonition:: Example
810
811 .. code-block:: VHDL
812
813 inst : configuration Counter;
814 --^^^^ <- Label
815 -- ^^^^^^^ <- Configuration
816 """
817
818 _configuration: ConfigurationInstantiationSymbol #: Reference to the instantiated configuration.
819
820 def __init__(
821 self,
822 label: str,
823 configurationSymbol: ConfigurationInstantiationSymbol,
824 genericAssociationItems: Nullable[Iterable[AssociationItem]] = None,
825 portAssociationItems: Nullable[Iterable[AssociationItem]] = None,
826 parent: Nullable[ModelEntity] = None
827 ) -> None:
828 """
829 Initializes a configuration instantiation.
830
831 :param label: The label of a model entity.
832 :param configurationSymbol: Reference to the instantiated configuration.
833 :param genericAssociationItems: List of all generic associations in the generic map aspect.
834 :param portAssociationItems: List of all port associations in the port map aspect.
835 :param parent: The parent model entity of this entity.
836 """
...
841
842 def Visit(self, visitor: Visitor) -> None:
843 """
844 Walk this configuration instantiation, its configuration and its map aspects with a visitor.
845
846 :param visitor: The visitor receiving the events.
847 """
...
852
853 @readonly
854 def Configuration(self) -> ConfigurationInstantiationSymbol:
855 """
856 Read-only property to access the configuration (:attr:`_configuration`).
857
858 :returns: The configuration.
859 """
...
861
863@export
864class ProcessStatement(ConcurrentStatement, SequentialDeclarationRegionMixin, SequentialStatementsMixin, DocumentedEntityMixin):
865 """
866 Represents a process statement.
867
868 A process declares its own items (:data:`DeclaredItems`) and groups sequential statements
869 (:data:`Statements`). It may name a sensitivity list (:data:`SensitivityList`).
870
871 .. admonition:: Example
872
873 .. code-block:: VHDL
874
875 proc : process (clock)
876 --^^^^ <- optional Label
877 -- ^^^^^ <- optional SensitivityList
878 variable v : bit;
879 -- ^^^^^^^^^^^^^^^^^ <- DeclaredItems
880 begin
881 v := '1';
882 -- ^^^^^^^^^ <- Statements
883 end process;
884 """
885
887 _sensitivityList: list[Name] #: List of all signal names in the sensitivity list, or ``None`` if none was given.
888
889 def __init__(
890 self,
891 label: Nullable[str] = None,
892 declaredItems: Nullable[Iterable] = None,
893 statements: Nullable[Iterable[SequentialStatement]] = None,
894 sensitivityList: Nullable[Iterable[Name]] = None,
895 documentation: Nullable[str] = None,
896 parent: Nullable[ModelEntity] = None
897 ) -> None:
898 """
899 Initializes a process statement.
900
901 :param label: The label of a model entity.
902 :param declaredItems: List of all declared items in this sequential declaration region.
903 :param statements: List of all sequential statements in this construct.
904 :param sensitivityList: List of all signal names in the sensitivity list, or ``None`` if none was given.
905 :param documentation: The documentation comment associated with this declaration.
906 :param parent: The parent model entity of this entity.
907 """
...
920
921 def Visit(self, visitor: Visitor) -> None:
922 """
923 Walk this process, its sensitivity list (if any), its declared items and its statements with a visitor.
924
925 :param visitor: The visitor receiving the events.
926 """
...
943
944 @ConcurrentStatement.Parent.setter
945 def Parent(self, parent: ModelEntity) -> None:
...
951
952 def _LabelRegion(self) -> ProcessStatement:
953 """
954 Return the process, whose declarative region declares the labels of its statements.
955
956 :returns: The process itself.
957 """
...
959
960 @readonly
961 def SensitivityList(self) -> list[Name]:
962 """
963 Read-only property to access the sensitivity list (:attr:`_sensitivityList`).
964
965 :returns: List of sensitivity list.
966 """
...
968
970@export
971class ConcurrentProcedureCall(ConcurrentStatement, ProcedureCallMixin):
972 """
973 Represents a concurrent procedure call.
974
975 Like every concurrent statement, it can carry an optional label (:data:`Label`).
976
977 .. admonition:: Example
978
979 .. code-block:: VHDL
980
981 proc_lbl : proc(clock, open);
982 --^^^^^^^^ <- optional Label
983 -- ^^^^^^^^^^^^^^^^^ <- the call
984
985 .. seealso::
986
987 * :class:`Sequential counterpart <pyVHDLModel.Sequential.SequentialProcedureCall>`
988 """
989 def __init__(
990 self,
991 label: Nullable[str],
992 procedureName: Symbol,
993 parameterAssociationItems: Nullable[Iterable[ParameterAssociationItem]] = None,
994 parent: Nullable[ModelEntity] = None
995 ) -> None:
996 """
997 Initializes a concurrent procedure call.
998
999 :param label: The label of a model entity.
1000 :param procedureName: Reference to the called procedure.
1001 :param parameterAssociationItems: List of all parameter associations of the call.
1002 :param parent: The parent model entity of this entity.
1003 """
...
1006
1007 def Visit(self, visitor: Visitor) -> None:
1008 """
1009 Walk this concurrent procedure call, its procedure and its parameters with a visitor.
1010
1011 :param visitor: The visitor receiving the events.
1012 """
...
1016
1018@export
1019class ConcurrentBlockStatement(
1020 ConcurrentStatement,
1021 BlockStatementMixin,
1022 LabeledEntityMixin,
1023 WithGenericsMixin,
1024 WithPortsMixin,
1025 GenericMapAspectMixin,
1026 PortMapAspectMixin,
1027 ConcurrentDeclarationRegionMixin,
1028 ConcurrentStatementsMixin,
1029 DocumentedEntityMixin,
1030 AllowBlackboxMixin
1031):
1032 """
1033 Represents a block statement.
1034
1035 A block groups concurrent statements (:data:`Statements`) and may declare its own items
1036 (:data:`DeclaredItems`). It always forms a hierarchy level; independently of that, it may also have
1037 a block header: a generic clause (:data:`GenericItems`) with its generic map aspect
1038 (:data:`GenericAssociationItems`), and a port clause (:data:`PortItems`) with its port map aspect
1039 (:data:`PortAssociationItems`).
1040
1041 .. admonition:: Example
1042
1043 .. code-block:: VHDL
1044
1045 blk : block
1046 --^^^ <- Label
1047 generic (G : positive := 1);
1048 -- ^^^^^^^^^^^^^^^^^^ <- GenericItems
1049 generic map (G => 2);
1050 -- ^^^^^^^^ <- GenericAssociationItems
1051 port (bp : in bit);
1052 -- ^^^^^^^^^^^ <- PortItems
1053 port map (bp => clock);
1054 -- ^^^^^^^^^^^^ <- PortAssociationItems
1055 signal inner : bit := '0';
1056 -- ^^^^^^^^^^^^^^^^^^^^^^^^^^ <- DeclaredItems
1057 begin
1058 inner <= bp;
1059 -- ^^^^^^^^^^^^ <- Statements
1060 end block;
1061
1062 .. seealso::
1063
1064 * :class:`Generate statement <pyVHDLModel.Concurrent.GenerateStatement>`
1065 """
1066 def __init__(
1067 self,
1068 label: str,
1069 genericItems: Nullable[Iterable[GenericInterfaceItemMixin]] = None,
1070 genericAssociationItems: Nullable[Iterable[GenericAssociationItem]] = None,
1071 portItems: Nullable[Iterable[PortInterfaceItemMixin]] = None,
1072 portAssociationItems: Nullable[Iterable[PortAssociationItem]] = None,
1073 declaredItems: Nullable[Iterable] = None,
1074 statements: Iterable[ConcurrentStatement] = None,
1075 documentation: Nullable[str] = None,
1076 allowBlackbox: Nullable[bool] = None,
1077 parent: Nullable[ModelEntity] = None
1078 ) -> None:
1079 """
1080 Initializes a block statement.
1081
1082 :param label: The label of a model entity.
1083 :param genericItems: List of all generics, in declaration order.
1084 :param genericAssociationItems: List of all generic associations in the generic map aspect.
1085 :param portItems: List of all ports, in declaration order.
1086 :param portAssociationItems: List of all port associations in the port map aspect.
1087 :param declaredItems: List of all declared items in this concurrent declaration region.
1088 :param statements: List of all concurrent statements in this construct.
1089 :param documentation: The documentation comment associated with this declaration.
1090 :param allowBlackbox: Allow blackboxes for components in language entity.
1091 :param parent: The parent model entity of this entity.
1092 """
...
1108
1109 def Visit(self, visitor: Visitor) -> None:
1110 """
1111 Walk this block, its block header, its declared items and its statements with a visitor.
1112
1113 :param visitor: The visitor receiving the events.
1114 """
...
1124
1125 @ConcurrentStatement.Parent.setter
1126 def Parent(self, parent: ModelEntity) -> None:
...
1130
1132 def IndexDeclaredItems(self) -> None:
1133 """
1134 A block's ports share the declarative region of its declarative part.
1135
1136 :raises UnhandledCriticalWarningError: If an identifier is declared twice in a declarative region and no
1137 :class:`~pyTooling.Warning.WarningCollector` collects the
1138 :exc:`~pyVHDLModel.Exception.DuplicateDeclarationWarning`.
1139 """
...
1143
1144 def _Declarations(self) -> tuple[ModelEntity, ...]:
1145 """
1146 Return all declarations of this block: its generics and ports share the declarative region.
1147
1148 :returns: Tuple of declarations: the generics, the ports, then the declared items.
1149 """
...
1151
1153@export
1154@abstractclass
1155class GenerateBranch(ModelEntity, ConcurrentDeclarationRegionMixin, ConcurrentStatementsMixin, AllowBlackboxMixin):
1156 """
1157 A base-class for all branches in a generate statements.
1158
1159 .. seealso::
1160
1161 * :class:`If generate branch <pyVHDLModel.Concurrent.IfGenerateBranch>`
1162 * :class:`Elsif generate branch <pyVHDLModel.Concurrent.ElsifGenerateBranch>`
1163 * :class:`Else generate branch <pyVHDLModel.Concurrent.ElseGenerateBranch>`
1164 """
1165
1166 _alternativeLabel: Nullable[str] #: The branch's alternative label, if one was given.
1167 _normalizedAlternativeLabel: Nullable[str] #: The normalized (lower case) alternative label.
1168
1169 def __init__(
1170 self,
1171 declaredItems: Nullable[Iterable] = None,
1172 statements: Nullable[Iterable[ConcurrentStatement]] = None,
1173 alternativeLabel: Nullable[str] = None,
1174 allowBlackbox: Nullable[bool] = None,
1175 parent: Nullable[ModelEntity] = None
1176 ) -> None:
1177 """
1178 Initializes a generate branch.
1179
1180 :param declaredItems: List of all declared items in this concurrent declaration region.
1181 :param statements: List of all concurrent statements in this construct.
1182 :param alternativeLabel: The branch's alternative label, if one was given.
1183 :param allowBlackbox: Allow blackboxes for components in language entity.
1184 :param parent: The parent model entity of this entity.
1185 """
...
1197
1198 @readonly
1199 def AlternativeLabel(self) -> Nullable[str]:
1200 """
1201 Read-only property to access the alternative label (:attr:`_alternativeLabel`).
1202
1203 :returns: The alternative label, or ``None`` if not set.
1204 """
...
1206
1207 @readonly
1208 def NormalizedAlternativeLabel(self) -> Nullable[str]:
1209 """
1210 Read-only property to access the normalized alternative label (:attr:`_normalizedAlternativeLabel`).
1211
1212 :returns: The normalized alternative label, or ``None`` if not set.
1213 """
...
1215
1217@export
1218class IfGenerateBranch(GenerateBranch, IfBranchMixin):
1219 """
1220 Represents if-generate branch in a generate statement with a concurrent declaration region and concurrent statements.
1221
1222 .. admonition:: Example
1223
1224 .. code-block:: VHDL
1225
1226 gen: if condition generate
1227 -- concurrent declarations
1228 begin
1229 -- concurrent statements
1230 elsif condition generate
1231 -- ...
1232 else generate
1233 -- ...
1234 end generate;
1235 """
1236
1237 def __init__(
1238 self,
1239 condition: ExpressionUnion,
1240 declaredItems: Nullable[Iterable] = None,
1241 statements: Nullable[Iterable[ConcurrentStatement]] = None,
1242 alternativeLabel: Nullable[str] = None,
1243 allowBlackbox: Nullable[bool] = None,
1244 parent: Nullable[ModelEntity] = None
1245 ) -> None:
1246 """
1247 Initializes an if generate branch.
1248
1249 :param condition: The condition guarding this statement.
1250 :param declaredItems: List of all declared items in this concurrent declaration region.
1251 :param statements: List of all concurrent statements in this construct.
1252 :param alternativeLabel: The branch's alternative label, if one was given.
1253 :param allowBlackbox: Allow blackboxes for components in language entity.
1254 :param parent: The parent model entity of this entity.
1255 """
...
1258
1259 def Visit(self, visitor: Visitor) -> None:
1260 """
1261 Walk this if-generate branch, its condition, its declared items and its statements with a visitor.
1262
1263 :param visitor: The visitor receiving the events.
1264 """
...
1272
1274@export
1275class ElsifGenerateBranch(GenerateBranch, ElsifBranchMixin):
1276 """
1277 Represents elsif-generate branch in a generate statement with a concurrent declaration region and concurrent statements.
1278
1279 .. admonition:: Example
1280
1281 .. code-block:: VHDL
1282
1283 gen: if condition generate
1284 -- ...
1285 elsif condition generate
1286 -- concurrent declarations
1287 begin
1288 -- concurrent statements
1289 else generate
1290 -- ...
1291 end generate;
1292 """
1293
1294 def __init__(
1295 self,
1296 condition: ExpressionUnion,
1297 declaredItems: Nullable[Iterable] = None,
1298 statements: Nullable[Iterable[ConcurrentStatement]] = None,
1299 alternativeLabel: Nullable[str] = None,
1300 allowBlackbox: Nullable[bool] = None,
1301 parent: Nullable[ModelEntity] = None
1302 ) -> None:
1303 """
1304 Initializes an elsif generate branch.
1305
1306 :param condition: The condition guarding this statement.
1307 :param declaredItems: List of all declared items in this concurrent declaration region.
1308 :param statements: List of all concurrent statements in this construct.
1309 :param alternativeLabel: The branch's alternative label, if one was given.
1310 :param allowBlackbox: Allow blackboxes for components in language entity.
1311 :param parent: The parent model entity of this entity.
1312 """
...
1315
1316 def Visit(self, visitor: Visitor) -> None:
1317 """
1318 Walk this elsif-generate branch, its condition, its declared items and its statements with a visitor.
1319
1320 :param visitor: The visitor receiving the events.
1321 """
...
1329
1331@export
1332class ElseGenerateBranch(GenerateBranch, ElseBranchMixin):
1333 """
1334 Represents else-generate branch in a generate statement with a concurrent declaration region and concurrent statements.
1335
1336 .. admonition:: Example
1337
1338 .. code-block:: VHDL
1339
1340 gen: if condition generate
1341 -- ...
1342 elsif condition generate
1343 -- ...
1344 else generate
1345 -- concurrent declarations
1346 begin
1347 -- concurrent statements
1348 end generate;
1349 """
1350
1351 def __init__(
1352 self,
1353 declaredItems: Nullable[Iterable] = None,
1354 statements: Nullable[Iterable[ConcurrentStatement]] = None,
1355 alternativeLabel: Nullable[str] = None,
1356 allowBlackbox: Nullable[bool] = None,
1357 parent: Nullable[ModelEntity] = None
1358 ) -> None:
1359 """
1360 Initializes an else generate branch.
1361
1362 :param declaredItems: List of all declared items in this concurrent declaration region.
1363 :param statements: List of all concurrent statements in this construct.
1364 :param alternativeLabel: The branch's alternative label, if one was given.
1365 :param allowBlackbox: Allow blackboxes for components in language entity.
1366 :param parent: The parent model entity of this entity.
1367 """
...
1370
1371 def Visit(self, visitor: Visitor) -> None:
1372 """
1373 Walk this else-generate branch, its declared items and its statements with a visitor.
1374
1375 :param visitor: The visitor receiving the events.
1376 """
...
1383
1385@export
1386@abstractclass
1387class GenerateStatement(ConcurrentStatement, AllowBlackboxMixin):
1388 """
1389 Represents the base-class of all generate statements.
1390
1391 A generate statement replicates or conditionally elaborates concurrent statements.
1392
1393 .. seealso::
1394
1395 * :class:`If generate statement <pyVHDLModel.Concurrent.IfGenerateStatement>`
1396 * :class:`Case generate statement <pyVHDLModel.Concurrent.CaseGenerateStatement>`
1397 * :class:`For generate statement <pyVHDLModel.Concurrent.ForGenerateStatement>`
1398 """
1399
1400 def __init__(
1401 self,
1402 label: Nullable[str] = None,
1403 allowBlackbox: Nullable[bool] = None,
1404 parent: Nullable[ModelEntity] = None
1405 ) -> None:
1406 """
1407 Initializes a generate statement.
1408
1409 :param label: The label of a model entity.
1410 :param allowBlackbox: Allow blackboxes for components in language entity.
1411 :param parent: The parent model entity of this entity.
1412 """
...
1415
1417 def IterateInstantiations(self) -> Generator[Instantiation, None, None]:
...
1419
1421 def IndexStatement(self) -> None:
...
1423
1425@export
1426class IfGenerateStatement(GenerateStatement):
1427 """
1428 Represents an if-generate statement.
1429
1430 It has one ``if`` branch (:data:`IfBranch`), any number of ``elsif`` branches
1431 (:data:`ElsifBranches`) and an optional ``else`` branch (:data:`ElseBranch`). The label is
1432 mandatory and the branch conditions must be static expressions.
1433
1434 .. admonition:: Example
1435
1436 .. code-block:: VHDL
1437
1438 gen : if WIDTH > 8 generate
1439 --^^^ <- Label
1440 -- ^^^^^^^^^^^^^^^^^^^^^ <- IfBranch
1441 q <= '0';
1442 elsif WIDTH > 4 generate
1443 --^^^^^^^^^^^^^^^^^^^^^^^^ <- ElsifBranches[0]
1444 q <= '1';
1445 else generate
1446 --^^^^^^^^^^^^^ <- ElseBranch
1447 q <= 'Z';
1448 end generate;
1449
1450 .. seealso::
1451
1452 * :class:`Generate branch <pyVHDLModel.Concurrent.GenerateBranch>` base-class
1453 * :class:`If-generate branch <pyVHDLModel.Concurrent.IfGenerateBranch>`
1454 * :class:`Elsif-generate branch <pyVHDLModel.Concurrent.ElsifGenerateBranch>`
1455 * :class:`Else-generate branch <pyVHDLModel.Concurrent.ElseGenerateBranch>`
1456 * :class:`Case-generate statement <pyVHDLModel.Concurrent.CaseGenerateStatement>`
1457 * :class:`For-generate statement <pyVHDLModel.Concurrent.ForGenerateStatement>`
1458 """
1459
1460 _ifBranch: IfGenerateBranch #: The mandatory ``if`` branch.
1461 _elsifBranches: list[ElsifGenerateBranch] #: List of all ``elsif`` branches, in the order they were written.
1462 _elseBranch: Nullable[ElseGenerateBranch] #: The optional ``else`` branch, or ``None`` if none was given.
1463
1464 def __init__(
1465 self,
1466 label: str,
1467 ifBranch: IfGenerateBranch,
1468 elsifBranches: Nullable[Iterable[ElsifGenerateBranch]] = None,
1469 elseBranch: Nullable[ElseGenerateBranch] = None,
1470 allowBlackbox: Nullable[bool] = None,
1471 parent: Nullable[ModelEntity] = None
1472 ) -> None:
1473 """
1474 Initializes an if-generate statement.
1475
1476 :param label: The label of a model entity.
1477 :param ifBranch: The mandatory ``if`` branch.
1478 :param elsifBranches: List of all ``elsif`` branches, in the order they were written.
1479 :param elseBranch: The optional ``else`` branch, or ``None`` if none was given.
1480 :param allowBlackbox: Allow blackboxes for components in language entity.
1481 :param parent: The parent model entity of this entity.
1482 """
...
1499
1500 def Visit(self, visitor: Visitor) -> None:
1501 """
1502 Walk this if-generate statement and its branches with a visitor.
1503
1504 :param visitor: The visitor receiving the events.
1505 """
...
1515
1516 @GenerateStatement.Parent.setter
1517 def Parent(self, parent: ModelEntity) -> None:
...
1531
1532 @readonly
1533 def IfBranch(self) -> IfGenerateBranch:
1534 """
1535 Read-only property to access the if branch (:attr:`_ifBranch`).
1536
1537 :returns: The if branch.
1538 """
...
1540
1541 @readonly
1542 def ElsifBranches(self) -> list[ElsifGenerateBranch]:
1543 """
1544 Read-only property to access the elsif branches (:attr:`_elsifBranches`).
1545
1546 :returns: List of elsif branches.
1547 """
...
1549
1550 @readonly
1551 def ElseBranch(self) -> Nullable[ElseGenerateBranch]:
1552 """
1553 Read-only property to access the else branch (:attr:`_elseBranch`).
1554
1555 :returns: The else branch, or ``None`` if not set.
1556 """
...
1558
1559 def IterateInstantiations(self) -> Generator[Instantiation, None, None]:
...
1565
1566 def IndexStatement(self) -> None:
...
1572
1574@export
1575@abstractclass
1576class ConcurrentChoice(BaseChoice):
1577 """
1578 A base-class for all concurrent choices (in case...generate statements).
1579
1580 .. seealso::
1581
1582 * :class:`Indexed generate choice <pyVHDLModel.Concurrent.IndexedGenerateChoice>`
1583 * :class:`Ranged generate choice <pyVHDLModel.Concurrent.RangedGenerateChoice>`
1584 """
1585
1587@export
1588class IndexedGenerateChoice(ConcurrentChoice):
1589 """
1590 Represents a case-generate choice given by a single value.
1591
1592 The value is available as :data:`Expression`.
1593
1594 .. admonition:: Example
1595
1596 .. code-block:: VHDL
1597
1598 when 8 =>
1599 -- ^ <- Expression
1600 """
1601 _expression: ExpressionUnion #: The expression this choice selects on.
1602
1603 def __init__(self, expression: ExpressionUnion, parent: Nullable[ModelEntity] = None) -> None:
1604 """
1605 Initializes a case-generate choice given by a single value.
1606
1607 :param expression: The expression this choice selects on.
1608 :param parent: The parent model entity of this entity.
1609 """
...
1614
1615 def Visit(self, visitor: Visitor) -> None:
1616 """
1617 Walk this case-generate choice and its value with a visitor.
1618
1619 :param visitor: The visitor receiving the events.
1620 """
...
1624
1625 @readonly
1626 def Expression(self) -> ExpressionUnion:
1627 """
1628 Read-only property to access the expression (:attr:`_expression`).
1629
1630 :returns: The expression.
1631 """
...
1633
1634 def __str__(self) -> str:
1635 """
1636 Formats the indexed case-generate choice.
1637
1638 **Format:** ``0``
1639
1640 :returns: Formatted indexed case-generate choice.
1641 """
...
1643
1645@export
1646class RangedGenerateChoice(ConcurrentChoice):
1647 """
1648 Represents a case-generate choice given by a range.
1649
1650 The range is available as :data:`Range`.
1651
1652 .. admonition:: Example
1653
1654 .. code-block:: VHDL
1655
1656 when 0 to 3 =>
1657 -- ^^^^^^ <- Range
1658 """
1659 _range: Range #: The range this choice selects on.
1660
1661 def __init__(self, rng: Range, parent: Nullable[ModelEntity] = None) -> None:
1662 """
1663 Initializes a case-generate choice given by a range.
1664
1665 :param rng: The range this choice selects on.
1666 :param parent: The parent model entity of this entity.
1667 """
...
1672
1673 def Visit(self, visitor: Visitor) -> None:
1674 """
1675 Walk this case-generate choice and its range with a visitor.
1676
1677 :param visitor: The visitor receiving the events.
1678 """
...
1682
1683 @readonly
1684 def Range(self) -> Range:
1685 """
1686 Read-only property to access the range (:attr:`_range`).
1687
1688 :returns: The range.
1689 """
...
1691
1692 def __str__(self) -> str:
1693 """
1694 Formats the ranged case-generate choice.
1695
1696 **Format:** ``0 to 3``
1697
1698 :returns: Formatted ranged case-generate choice.
1699 """
...
1701
1703@export
1704@abstractclass
1705class ConcurrentCase(BaseCase, LabeledEntityMixin, ConcurrentDeclarationRegionMixin, ConcurrentStatementsMixin, AllowBlackboxMixin, ChoicesMixin):
1706 """
1707 Represents the base-class of all alternatives of a case-generate statement.
1708
1709 .. seealso::
1710
1711 * :class:`Generate case <pyVHDLModel.Concurrent.GenerateCase>`
1712 * :class:`Others generate case <pyVHDLModel.Concurrent.OthersGenerateCase>`
1713 """
1714 def __init__(
1715 self,
1716 declaredItems: Nullable[Iterable] = None,
1717 statements: Nullable[Iterable[ConcurrentStatement]] = None,
1718 alternativeLabel: Nullable[str] = None,
1719 choices: Nullable[Iterable[BaseChoice]] = None,
1720 allowBlackbox: Nullable[bool] = None,
1721 parent: Nullable[ModelEntity] = None
1722 ) -> None:
1723 """
1724 Initializes a concurrent case.
1725
1726 :param declaredItems: List of all declared items in this concurrent declaration region.
1727 :param statements: List of all concurrent statements in this construct.
1728 :param alternativeLabel: The alternative's label.
1729 :param choices: List of all choices selecting this alternative.
1730 :param allowBlackbox: Allow blackboxes for components in language entity.
1731 :param parent: The parent model entity of this entity.
1732 """
...
1745
1747@export
1748class GenerateCase(ConcurrentCase):
1749 """
1750 Represents one alternative of a case-generate statement, selected by its choices.
1751
1752 .. admonition:: Example
1753
1754 .. code-block:: VHDL
1755
1756 when 8 =>
1757 -- ^ <- Choices
1758 """
1759 def __init__(
1760 self,
1761 choices: Iterable[ConcurrentChoice],
1762 declaredItems: Nullable[Iterable] = None,
1763 statements: Nullable[Iterable[ConcurrentStatement]] = None,
1764 alternativeLabel: Nullable[str] = None,
1765 allowBlackbox: Nullable[bool] = None,
1766 parent: Nullable[ModelEntity] = None
1767 ) -> None:
1768 """
1769 Initializes a generate case.
1770
1771 :param choices: List of all choices selecting this alternative.
1772 :param declaredItems: List of all declared items in this concurrent declaration region.
1773 :param statements: List of all concurrent statements in this construct.
1774 :param alternativeLabel: The alternative's label.
1775 :param allowBlackbox: Allow blackboxes for components in language entity.
1776 :param parent: The parent model entity of this entity.
1777 """
...
1779
1780 def Visit(self, visitor: Visitor) -> None:
1781 """
1782 Walk this case-generate alternative, its choices, its declared items and its statements with a visitor.
1783
1784 :param visitor: The visitor receiving the events.
1785 """
...
1798
1799 def __str__(self) -> str:
1800 """
1801 Formats the case-generate alternative.
1802
1803 **Format:** ``when 0 | 1 =>``
1804
1805 :returns: Formatted case-generate alternative.
1806 """
...
1808
1810@export
1811class OthersGenerateCase(ConcurrentCase):
1812 """
1813 Represents the ``others`` alternative of a case-generate statement.
1814
1815 It covers every choice not named explicitly.
1816
1817 .. admonition:: Example
1818
1819 .. code-block:: VHDL
1820
1821 when others =>
1822 -- ^^^^^^ <- the choice
1823 """
1824 def Visit(self, visitor: Visitor) -> None:
1825 """
1826 Walk this ``others`` case-generate alternative, its declared items and its statements with a visitor.
1827
1828 :param visitor: The visitor receiving the events.
1829 """
...
1836
1837 def __str__(self) -> str:
1838 """
1839 Formats the ``others`` case-generate alternative.
1840
1841 **Format:** ``when others =>``
1842
1843 :returns: Formatted ``others`` case-generate alternative.
1844 """
...
1846
1848@export
1849class CaseGenerateStatement(GenerateStatement):
1850 """
1851 Represents a case-generate statement.
1852
1853 The expression being tested is available as :data:`SelectExpression`, the alternatives as
1854 :data:`Cases`. The label is mandatory and the selector must be a static expression.
1855
1856 .. admonition:: Example
1857
1858 .. code-block:: VHDL
1859
1860 gen : case MODE generate
1861 --^^^ <- Label
1862 -- ^^^^ <- SelectExpression
1863 when 0 => q <= '0';
1864 -- ^^^^^^^^^^^^^^^^^^^ <- Cases[0]
1865 when others => q <= '1';
1866 -- ^^^^^^^^^^^^^^^^^^^^^^^^ <- Cases[1]
1867 end generate;
1868
1869 .. seealso::
1870
1871 * :class:`If-generate statement <pyVHDLModel.Concurrent.IfGenerateStatement>`
1872 * :class:`For-generate statement <pyVHDLModel.Concurrent.ForGenerateStatement>`
1873 """
1874
1875 _expression: ExpressionUnion #: The expression being tested; it must be static.
1876 _cases: list[GenerateCase] #: List of all alternatives, in the order they were written.
1877
1878 def __init__(
1879 self,
1880 label: str,
1881 expression: ExpressionUnion,
1882 cases: Iterable[ConcurrentCase],
1883 allowBlackbox: Nullable[bool] = None,
1884 parent: Nullable[ModelEntity] = None
1885 ) -> None:
1886 """
1887 Initializes a case-generate statement.
1888
1889 :param label: The label of a model entity.
1890 :param expression: The expression being tested; it must be static.
1891 :param cases: List of all alternatives, in the order they were written.
1892 :param allowBlackbox: Allow blackboxes for components in language entity.
1893 :param parent: The parent model entity of this entity.
1894 """
...
1906
1907 def Visit(self, visitor: Visitor) -> None:
1908 """
1909 Walk this case-generate statement, its selector and its alternatives with a visitor.
1910
1911 :param visitor: The visitor receiving the events.
1912 """
...
1920
1921 @GenerateStatement.Parent.setter
1922 def Parent(self, parent: ModelEntity) -> None:
...
1928
1929 @readonly
1930 def SelectExpression(self) -> ExpressionUnion:
1931 """
1932 Read-only property to access the select expression (:attr:`_expression`).
1933
1934 :returns: The select expression.
1935 """
...
1937
1938 @readonly
1939 def Cases(self) -> list[GenerateCase]:
1940 """
1941 Read-only property to access the cases (:attr:`_cases`).
1942
1943 :returns: List of cases.
1944 """
...
1946
1947 def IterateInstantiations(self) -> Generator[Instantiation, None, None]:
...
1950
1951 def IndexStatement(self) -> None:
...
1954
1956@export
1957class ForGenerateStatement(GenerateStatement, ConcurrentDeclarationRegionMixin, ConcurrentStatementsMixin):
1958 """
1959 Represents a for-generate statement.
1960
1961 The loop index is available as :data:`LoopIndex`, the iteration range as :data:`Range` and the
1962 generated statements as :data:`Statements`. The label is mandatory.
1963
1964 .. admonition:: Example
1965
1966 .. code-block:: VHDL
1967
1968 gen : for i in 0 to 3 generate
1969 --^^^ <- Label
1970 -- ^ <- LoopIndex
1971 -- ^^^^^^ <- Range
1972 q(i) <= '0';
1973 -- ^^^^^^^^^^^^ <- Statements
1974 end generate;
1975
1976 .. seealso::
1977
1978 * :class:`If-generate statement <pyVHDLModel.Concurrent.IfGenerateStatement>`
1979 * :class:`Case-generate statement <pyVHDLModel.Concurrent.CaseGenerateStatement>`
1980 """
1981
1982 _loopIndex: str #: The name of the generate loop's index.
1983 _range: Range #: The range the generate loop iterates over.
1984
1985 def __init__(
1986 self,
1987 label: str,
1988 loopIndex: str,
1989 rng: Range,
1990 declaredItems: Nullable[Iterable] = None,
1991 statements: Nullable[Iterable[ConcurrentStatement]] = None,
1992 allowBlackbox: Nullable[bool] = None,
1993 parent: Nullable[ModelEntity] = None
1994 ) -> None:
1995 """
1996 Initializes a for-generate statement.
1997
1998 :param label: The label of a model entity.
1999 :param loopIndex: The name of the generate loop's index.
2000 :param rng: The range the generate loop iterates over.
2001 :param declaredItems: List of all declared items in this concurrent declaration region.
2002 :param statements: List of all concurrent statements in this construct.
2003 :param allowBlackbox: Allow blackboxes for components in language entity.
2004 :param parent: The parent model entity of this entity.
2005 """
...
2018
2019 def Visit(self, visitor: Visitor) -> None:
2020 """
2021 Walk this for-generate statement, its range, its declared items and its statements with a visitor.
2022
2023 :param visitor: The visitor receiving the events.
2024 """
...
2032
2033 @GenerateStatement.Parent.setter
2034 def Parent(self, parent: ModelEntity) -> None:
...
2038
2039 @readonly
2040 def LoopIndex(self) -> str:
2041 """
2042 Read-only property to access the loop index (:attr:`_loopIndex`).
2043
2044 :returns: The loop index.
2045 """
...
2047
2048 @readonly
2049 def Range(self) -> Range:
2050 """
2051 Read-only property to access the range (:attr:`_range`).
2052
2053 :returns: The range.
2054 """
...
2056
2059 def IndexStatement(self) -> None:
...
2061
2062 def IndexStatements(self) -> None:
...
2064
2065 def IterateInstantiations(self) -> Generator[Instantiation, None, None]:
...
2067
2069@export
2070@abstractclass
2071class ConcurrentSignalAssignment(ConcurrentStatement, SignalAssignmentMixin):
2072 """
2073 Represents the base-class of all concurrent signal assignments.
2074
2075 .. seealso::
2076
2077 * :class:`Concurrent simple signal assignment <pyVHDLModel.Concurrent.ConcurrentSimpleSignalAssignment>`
2078 * :class:`Concurrent selected signal assignment <pyVHDLModel.Concurrent.ConcurrentSelectedSignalAssignment>`
2079 * :class:`Conditional signal assignment <pyVHDLModel.Concurrent.ConcurrentConditionalSignalAssignment>` """
2080 def __init__(self, label: Nullable[str], target: SignalSymbol, parent: Nullable[ModelEntity] = None) -> None:
2081 """
2082 Initializes a concurrent signal assignment.
2083
2084 :param label: The label of a model entity.
2085 :param target: Reference to the assignment's destination.
2086 :param parent: The parent model entity of this entity.
2087 """
...
2090
2092@export
2093class ConcurrentSimpleSignalAssignment(ConcurrentSignalAssignment, WaveformMixin):
2094 """
2095 Represents a simple concurrent signal assignment.
2096
2097 The assignment's destination is available as :data:`Target`, its value as :data:`Waveform`.
2098
2099 .. admonition:: Example
2100
2101 .. code-block:: VHDL
2102
2103 lbl : q <= '1';
2104 --^^^ <- optional Label
2105 -- ^ <- Target
2106 -- ^^^ <- Waveform
2107
2108 .. seealso::
2109
2110 * :class:`Sequential counterpart <pyVHDLModel.Sequential.SequentialSimpleSignalAssignment>`
2111 """
2112 def __init__(
2113 self,
2114 label: Nullable[str],
2115 target: SignalSymbol,
2116 waveform: Iterable[WaveformElement],
2117 parent: Nullable[ModelEntity] = None
2118 ) -> None:
2119 """
2120 Initializes a simple concurrent signal assignment.
2121
2122 :param label: The label of a model entity.
2123 :param target: Reference to the assignment's destination.
2124 :param waveform: List of all waveform elements, in the order they were written.
2125 :param parent: The parent model entity of this entity.
2126 """
...
2129
2130 def Visit(self, visitor: Visitor) -> None:
2131 """
2132 Walk this concurrent signal assignment, its target and its waveform with a visitor.
2133
2134 :param visitor: The visitor receiving the events.
2135 """
...
2141
2143@export
2144class ConcurrentSelectedSignalAssignment(ConcurrentSignalAssignment, ExpressionMixin, SelectedWaveformsMixin):
2145 """
2146 Represents a selected concurrent signal assignment.
2147
2148 The selector is available as :data:`Expression`, the alternatives as :data:`SelectedWaveforms`,
2149 a list of :class:`~pyVHDLModel.Common.SelectedWaveform`. The model holds them in a list and has
2150 no distinct field per alternative, so the markers below name list elements.
2151
2152 .. admonition:: Example
2153
2154 .. code-block:: VHDL
2155
2156 lbl : with sel select q <= '1' when '0', '0' when others;
2157 --^^^ <- optional Label
2158 -- ^^^ <- Expression
2159 -- ^ <- Target
2160 -- ^^^^^^^^^^^^ <- SelectedWaveforms[0]
2161 -- ^^^^^^^^^^^^^^^ <- SelectedWaveforms[1]
2162
2163 .. seealso::
2164
2165 * :class:`Sequential counterpart <pyVHDLModel.Sequential.SequentialSelectedSignalAssignment>`
2166 * :class:`Selected waveform <pyVHDLModel.Common.SelectedWaveform>`
2167 """
2168
2169 def __init__(
2170 self,
2171 label: Nullable[str],
2172 target: SignalSymbol,
2173 expression: ExpressionUnion,
2174 selectedWaveforms: Iterable[SelectedWaveform],
2175 parent: Nullable[ModelEntity] = None
2176 ) -> None:
2177 """
2178 Initializes a selected concurrent signal assignment.
2179
2180 :param label: The label of a model entity.
2181 :param target: Reference to the assignment's destination.
2182 :param expression: The selector expression.
2183 :param selectedWaveforms: All alternatives, in order.
2184 :param parent: The parent model entity of this entity.
2185 """
...
2189
2190 def Visit(self, visitor: Visitor) -> None:
2191 """
2192 Walk this selected signal assignment, its selector, its target and its alternatives with a visitor.
2193
2194 :param visitor: The visitor receiving the events.
2195 """
...
2203
2205@export
2206class ConcurrentConditionalSignalAssignment(ConcurrentSignalAssignment, ConditionalWaveformsMixin):
2207 """
2208 Represents a conditional concurrent signal assignment.
2209
2210 The alternatives are available as :data:`ConditionalWaveforms`, a list of
2211 :class:`~pyVHDLModel.Common.ConditionalWaveform`. The model holds them in a list and has no
2212 distinct field per alternative, so the markers below name list elements.
2213
2214 .. admonition:: Example
2215
2216 .. code-block:: VHDL
2217
2218 lbl : q <= '1' when cond else '0';
2219 --^^^ <- optional Label
2220 -- ^ <- Target
2221 -- ^^^^^^^^^^^^^ <- ConditionalWaveforms[0]
2222 -- ^^^ <- ConditionalWaveforms[1]
2223
2224 .. seealso::
2225
2226 * :class:`Sequential counterpart <pyVHDLModel.Sequential.SequentialConditionalSignalAssignment>`
2227 * :class:`Conditional waveform <pyVHDLModel.Common.ConditionalWaveform>`
2228 """
2229
2230 def __init__(
2231 self,
2232 label: Nullable[str],
2233 target: SignalSymbol,
2234 conditionalWaveforms: Iterable[ConditionalWaveform],
2235 parent: Nullable[ModelEntity] = None
2236 ) -> None:
2237 """
2238 Initializes a conditional concurrent signal assignment.
2239
2240 :param label: The label of a model entity.
2241 :param target: Reference to the assignment's destination.
2242 :param conditionalWaveforms: All alternatives, in order.
2243 :param parent: The parent model entity of this entity.
2244 """
...
2247
2248 def Visit(self, visitor: Visitor) -> None:
2249 """
2250 Walk this conditional signal assignment, its target and its alternatives with a visitor.
2251
2252 :param visitor: The visitor receiving the events.
2253 """
...
2259
2261@export
2262class ConcurrentAssertStatement(ConcurrentStatement, AssertStatementMixin):
2263 """
2264 Represents a concurrent assertion statement.
2265
2266 The checked condition is available as :data:`Condition`, the optional report string as
2267 :data:`Message` and the optional severity as :data:`Severity`.
2268
2269 .. admonition:: Example
2270
2271 .. code-block:: VHDL
2272
2273 lbl : assert cond report "bad" severity note;
2274 --^^^ <- optional Label
2275 -- ^^^^ <- Condition
2276 -- ^^^^^ <- optional Message
2277 -- ^^^^ <- optional Severity
2278
2279 .. seealso::
2280
2281 * :class:`Sequential counterpart <pyVHDLModel.Sequential.SequentialAssertStatement>`
2282 """
2283 def __init__(
2284 self,
2285 condition: ExpressionUnion,
2286 message: Nullable[ExpressionUnion] = None,
2287 severity: Nullable[ExpressionUnion] = None,
2288 label: Nullable[str] = None,
2289 parent: Nullable[ModelEntity] = None
2290 ) -> None:
2291 """
2292 Initializes a concurrent assertion statement.
2293
2294 :param condition: The condition guarding this statement.
2295 :param message: The reported message, or ``None`` if none was given.
2296 :param severity: The reported severity level, or ``None`` if none was given.
2297 :param label: The label of a model entity.
2298 :param parent: The parent model entity of this entity.
2299 """
...
2302
2303 def Visit(self, visitor: Visitor) -> None:
2304 """
2305 Walk this concurrent assertion, its condition, its message and its severity with a visitor.
2306
2307 :param visitor: The visitor receiving the events.
2308 """
...