pyVHDLModel 0.43.0__tar.gz → 0.44.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/PKG-INFO +21 -21
  2. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Formatting/VHDL.py +12 -11
  3. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Symbol.py +207 -42
  4. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Visitor.py +43 -12
  5. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/__init__.py +1 -1
  6. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/PKG-INFO +21 -21
  7. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/LICENSE.md +0 -0
  8. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/README.md +0 -0
  9. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Association.py +0 -0
  10. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Base.py +0 -0
  11. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Common.py +0 -0
  12. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Concurrent.py +0 -0
  13. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Configuration.py +0 -0
  14. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Declaration.py +0 -0
  15. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/DesignUnit.py +0 -0
  16. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Exception.py +0 -0
  17. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Expression.py +0 -0
  18. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Formatting/__init__.py +0 -0
  19. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/IEEE.py +0 -0
  20. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Instantiation.py +0 -0
  21. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Interface.py +0 -0
  22. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Name.py +0 -0
  23. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Namespace.py +0 -0
  24. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Object.py +0 -0
  25. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/PSLModel.py +0 -0
  26. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Predefined.py +0 -0
  27. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Regions.py +0 -0
  28. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/STD.py +0 -0
  29. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Sequential.py +0 -0
  30. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Subprogram.py +0 -0
  31. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/Type.py +0 -0
  32. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel/py.typed +0 -0
  33. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/SOURCES.txt +0 -0
  34. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/dependency_links.txt +0 -0
  35. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/requires.txt +20 -20
  36. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyVHDLModel.egg-info/top_level.txt +0 -0
  37. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/pyproject.toml +0 -0
  38. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/setup.cfg +0 -0
  39. {pyvhdlmodel-0.43.0 → pyvhdlmodel-0.44.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyVHDLModel
3
- Version: 0.43.0
3
+ Version: 0.44.0
4
4
  Summary: An abstract VHDL language model.
5
5
  Home-page: https://GitHub.com/VHDL/pyVHDLModel
6
6
  Author: Patrick Lehmann
@@ -28,43 +28,43 @@ Description-Content-Type: text/markdown
28
28
  License-File: LICENSE.md
29
29
  Requires-Dist: pyTooling<11.0,>=10.2.0
30
30
  Provides-Extra: doc
31
- Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "doc"
32
- Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "doc"
31
+ Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "doc"
32
+ Requires-Dist: sphinx_rtd_theme~=3.1; extra == "doc"
33
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
34
+ Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "doc"
33
35
  Requires-Dist: sphinx-copybutton>=0.5.2; extra == "doc"
36
+ Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "doc"
34
37
  Requires-Dist: sphinx_design~=0.7.0; extra == "doc"
35
- Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
38
+ Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "doc"
36
39
  Requires-Dist: sphinx~=9.2; extra == "doc"
37
- Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "doc"
38
- Requires-Dist: sphinx_rtd_theme~=3.1; extra == "doc"
39
- Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "doc"
40
40
  Requires-Dist: autoapi>=2.0.1; extra == "doc"
41
41
  Provides-Extra: test
42
- Requires-Dist: Coverage~=7.17; extra == "test"
43
42
  Requires-Dist: typing_extensions~=4.16; extra == "test"
44
- Requires-Dist: pytest-cov~=7.1; extra == "test"
45
43
  Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "test"
46
44
  Requires-Dist: pytest-xdist~=3.8; extra == "test"
47
- Requires-Dist: mypy[reports]~=2.4; extra == "test"
45
+ Requires-Dist: pytest-cov~=7.1; extra == "test"
48
46
  Requires-Dist: pytest~=9.2; extra == "test"
47
+ Requires-Dist: Coverage~=7.17; extra == "test"
49
48
  Requires-Dist: lxml<7.0,>=6.1.3; extra == "test"
49
+ Requires-Dist: mypy[reports]~=2.4; extra == "test"
50
50
  Provides-Extra: all
51
- Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "all"
52
- Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "all"
53
- Requires-Dist: Coverage~=7.17; extra == "all"
54
51
  Requires-Dist: typing_extensions~=4.16; extra == "all"
55
- Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
56
- Requires-Dist: pytest-cov~=7.1; extra == "all"
52
+ Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "all"
57
53
  Requires-Dist: docutils_stubs~=0.0.22; extra == "all"
58
- Requires-Dist: sphinx~=9.2; extra == "all"
59
- Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "all"
60
54
  Requires-Dist: sphinx_rtd_theme~=3.1; extra == "all"
61
- Requires-Dist: autoapi>=2.0.1; extra == "all"
62
- Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "all"
55
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
56
+ Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "all"
57
+ Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "all"
63
58
  Requires-Dist: pytest-xdist~=3.8; extra == "all"
64
- Requires-Dist: mypy[reports]~=2.4; extra == "all"
59
+ Requires-Dist: pytest-cov~=7.1; extra == "all"
60
+ Requires-Dist: sphinx_design~=0.7.0; extra == "all"
65
61
  Requires-Dist: pytest~=9.2; extra == "all"
62
+ Requires-Dist: Coverage~=7.17; extra == "all"
63
+ Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "all"
66
64
  Requires-Dist: lxml<7.0,>=6.1.3; extra == "all"
67
- Requires-Dist: sphinx_design~=0.7.0; extra == "all"
65
+ Requires-Dist: sphinx~=9.2; extra == "all"
66
+ Requires-Dist: mypy[reports]~=2.4; extra == "all"
67
+ Requires-Dist: autoapi>=2.0.1; extra == "all"
68
68
  Dynamic: author
69
69
  Dynamic: author-email
70
70
  Dynamic: classifier
@@ -104,7 +104,8 @@ from pyVHDLModel.Sequential import IndexedChoice, SequentialProcedureCall, Se
104
104
  LoopControlStatement, NextStatement, ExitStatement
105
105
  from pyVHDLModel.Subprogram import Subprogram, Procedure, Function
106
106
  from pyVHDLModel.Symbol import ConstrainedScalarSubtypeSymbol, ConstrainedArraySubtypeSymbol, \
107
- ConstrainedRecordSubtypeSymbol, AggregateSymbol
107
+ ConstrainedRecordSubtypeSymbol, ArrayElementConstraint, \
108
+ RecordElementConstraint, AggregateSymbol
108
109
  from pyVHDLModel.Type import AnonymousType, FullType, Subtype, EnumeratedType, IntegerType, RealType, \
109
110
  PhysicalType, ArrayType, RecordTypeElement, RecordType, AccessType, FileType, \
110
111
  ProtectedType, ProtectedTypeBody
@@ -1017,7 +1018,7 @@ class VHDLWriter(Visitor):
1017
1018
  def VisitElementSeparator(
1018
1019
  self,
1019
1020
  element: IndexedName | Aggregate | ConstrainedArraySubtypeSymbol | ConstrainedRecordSubtypeSymbol |
1020
- EnumeratedType | ArrayType | AggregateSymbol
1021
+ ArrayElementConstraint | RecordElementConstraint | EnumeratedType | ArrayType | AggregateSymbol
1021
1022
  ) -> None:
1022
1023
  """
1023
1024
  Write the comma between two elements of a parenthesized list, which is no association list.
@@ -2077,44 +2078,44 @@ class VHDLWriter(Visitor):
2077
2078
 
2078
2079
  def VisitIndexConstraint(
2079
2080
  self,
2080
- element: ConstrainedArraySubtypeSymbol | ConstrainedRecordSubtypeSymbol | ArrayType
2081
+ element: ConstrainedArraySubtypeSymbol | ArrayElementConstraint | ArrayType
2081
2082
  ) -> None:
2082
2083
  """
2083
2084
  Write the left parenthesis of an index constraint.
2084
2085
 
2085
2086
  **Format:** ``bit_vector(7 downto 0)``
2086
2087
 
2087
- :param element: The constrained subtype symbol or the array type.
2088
+ :param element: The constrained subtype symbol, the array element constraint or the array type.
2088
2089
  """
2089
2090
  self._Write("(")
2090
2091
  self._minimum = OperatorPrecedence.Range
2091
2092
 
2092
2093
  def DepartIndexConstraint(
2093
2094
  self,
2094
- element: ConstrainedArraySubtypeSymbol | ConstrainedRecordSubtypeSymbol | ArrayType
2095
+ element: ConstrainedArraySubtypeSymbol | ArrayElementConstraint | ArrayType
2095
2096
  ) -> None:
2096
2097
  """
2097
2098
  Write the right parenthesis of an index constraint.
2098
2099
 
2099
- :param element: The constrained subtype symbol or the array type.
2100
+ :param element: The constrained subtype symbol, the array element constraint or the array type.
2100
2101
  """
2101
2102
  self._Write(")")
2102
2103
 
2103
- def VisitRecordConstraint(self, symbol: ConstrainedRecordSubtypeSymbol) -> None:
2104
+ def VisitRecordConstraint(self, element: ConstrainedRecordSubtypeSymbol | RecordElementConstraint) -> None:
2104
2105
  """
2105
2106
  Write the left parenthesis of a record constraint.
2106
2107
 
2107
- **Format:** ``frame(data(7 downto 0), mask(3 downto 0))``
2108
+ **Format:** ``frame(data(7 downto 0), inner(field(3 downto 0)))``
2108
2109
 
2109
- :param symbol: The constrained subtype symbol.
2110
+ :param element: The constrained subtype symbol or the record element constraint.
2110
2111
  """
2111
2112
  self._Write("(")
2112
2113
 
2113
- def DepartRecordConstraint(self, symbol: ConstrainedRecordSubtypeSymbol) -> None:
2114
+ def DepartRecordConstraint(self, element: ConstrainedRecordSubtypeSymbol | RecordElementConstraint) -> None:
2114
2115
  """
2115
2116
  Write the right parenthesis of a record constraint.
2116
2117
 
2117
- :param symbol: The constrained subtype symbol.
2118
+ :param element: The constrained subtype symbol or the record element constraint.
2118
2119
  """
2119
2120
  self._Write(")")
2120
2121
 
@@ -1356,7 +1356,7 @@ class SimpleSubtypeSymbol(SubtypeSymbol):
1356
1356
  @export
1357
1357
  class Constraint(metaclass=ExtendedType, mixin=True):
1358
1358
  """
1359
- A mixin-class for symbols carrying a constraint.
1359
+ A mixin-class for symbols and element constraints carrying a constraint.
1360
1360
 
1361
1361
  .. seealso::
1362
1362
 
@@ -1472,6 +1472,7 @@ class ArrayConstraint(Constraint, mixin=True):
1472
1472
  .. seealso::
1473
1473
 
1474
1474
  * :class:`Constrained array subtype symbol <pyVHDLModel.Symbol.ConstrainedArraySubtypeSymbol>`
1475
+ * :class:`Array element constraint <pyVHDLModel.Symbol.ArrayElementConstraint>`
1475
1476
  """
1476
1477
  _constraints: list[Range] #: List of all index ranges, one per dimension.
1477
1478
 
@@ -1495,41 +1496,209 @@ class ArrayConstraint(Constraint, mixin=True):
1495
1496
  """
1496
1497
  return self._constraints
1497
1498
 
1499
+ def _VisitArrayConstraint(self, visitor: Visitor) -> None:
1500
+ """
1501
+ Walk the index constraint, one range per dimension, with a visitor.
1502
+
1503
+ :param visitor: The visitor receiving the events.
1504
+ """
1505
+ visitor.VisitIndexConstraint(self)
1506
+ for index, constraint in enumerate(self._constraints):
1507
+ if index > 0:
1508
+ visitor.VisitElementSeparator(self)
1509
+
1510
+ constraint.Visit(visitor)
1511
+
1512
+ visitor.DepartIndexConstraint(self)
1513
+
1514
+
1515
+ @export
1516
+ class ArrayElementConstraint(ModelEntity, ArrayConstraint):
1517
+ """
1518
+ Represents the constraint of an array element in a record constraint: one range per dimension.
1519
+
1520
+ The ranges are available as :data:`Constraints`. The constraint has no type mark of its own: the element's type is
1521
+ the subtype of the record element (IEEE Std 1076-2008, 6.3: ``element_constraint ::= array_constraint |
1522
+ record_constraint``).
1523
+
1524
+ .. admonition:: Example
1525
+
1526
+ .. code-block:: VHDL
1527
+
1528
+ signal s : rec_t(data(7 downto 0), m(0 to 1, 0 to 7));
1529
+ -- ^^^^^^^^^^ <- Constraints
1530
+ -- ^^^^^^^^^^^^^^ <- Constraints
1531
+
1532
+ .. seealso::
1533
+
1534
+ * :class:`Record element constraint <pyVHDLModel.Symbol.RecordElementConstraint>`
1535
+ * :class:`Constrained record subtype symbol <pyVHDLModel.Symbol.ConstrainedRecordSubtypeSymbol>`
1536
+ """
1537
+
1538
+ def __init__(self, constraints: Iterable[Range], *, parent: Nullable[ModelEntity] = None) -> None:
1539
+ """
1540
+ Initializes the constraint of an array element.
1541
+
1542
+ :param constraints: List of all index ranges, one per dimension.
1543
+ :param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
1544
+ """
1545
+ super().__init__(parent)
1546
+ ArrayConstraint.__init__(self, constraints)
1547
+
1548
+ def Copy(self) -> Self:
1549
+ """
1550
+ Create a copy of this array element constraint.
1551
+
1552
+ The copy has no parent. The index ranges are copied.
1553
+
1554
+ :returns: The new array element constraint.
1555
+ """
1556
+ return self.__class__([constraint.Copy() for constraint in self._constraints])
1557
+
1558
+ def Visit(self, visitor: Visitor) -> None:
1559
+ """
1560
+ Walk this array element constraint and its index constraint with a visitor.
1561
+
1562
+ :param visitor: The visitor receiving the events.
1563
+ """
1564
+ visitor.VisitArrayElementConstraint(self)
1565
+ self._VisitArrayConstraint(visitor)
1566
+ visitor.DepartArrayElementConstraint(self)
1567
+
1568
+ def __str__(self) -> str:
1569
+ """
1570
+ Formats the array element constraint.
1571
+
1572
+ **Format:** ``(0 to 1, 0 to 7)``
1573
+
1574
+ :returns: Formatted array element constraint.
1575
+ """
1576
+ return f"({', '.join(str(constraint) for constraint in self._constraints)})"
1577
+
1498
1578
 
1499
1579
  @export
1500
1580
  class RecordConstraint(Constraint, mixin=True):
1501
1581
  """
1502
- A mixin-class for a record constraint: one constraint per element.
1582
+ A mixin-class for a record constraint: one element constraint per constrained record element.
1503
1583
 
1504
- The constraints are available as :data:`Constraints`.
1584
+ The element constraints are available as :data:`Constraints`. An element constraint is an
1585
+ :class:`~pyVHDLModel.Symbol.ArrayElementConstraint` or a nested :class:`~pyVHDLModel.Symbol.RecordElementConstraint`
1586
+ (IEEE Std 1076-2008, 6.3: ``record_element_constraint ::= record_element_simple_name element_constraint``).
1505
1587
 
1506
1588
  .. seealso::
1507
1589
 
1508
1590
  * :class:`Constrained record subtype symbol <pyVHDLModel.Symbol.ConstrainedRecordSubtypeSymbol>`
1591
+ * :class:`Record element constraint <pyVHDLModel.Symbol.RecordElementConstraint>`
1509
1592
  """
1510
- _constraints: dict[RecordElementSymbol, Range] #: Dictionary of the constraint per constrained record element.
1593
+ _constraints: dict[RecordElementSymbol, ArrayElementConstraint | RecordElementConstraint] #: Dictionary of the element constraint per constrained record element.
1511
1594
 
1512
- def __init__(self, constraints: Mapping[RecordElementSymbol, Range]) -> None:
1595
+ def __init__(
1596
+ self,
1597
+ constraints: Mapping[RecordElementSymbol, ArrayElementConstraint | RecordElementConstraint]
1598
+ ) -> None:
1513
1599
  """
1514
1600
  Initializes a record constraint.
1515
1601
 
1516
- :param constraints: Dictionary of the constraint per constrained record element.
1602
+ :param constraints: Dictionary of the element constraint per constrained record element.
1517
1603
  """
1518
1604
  self._constraints = dict(constraints)
1519
1605
  for element, constraint in self._constraints.items():
1520
- element.Parent = self
1521
- if constraint is not None:
1522
- constraint.Parent = self
1606
+ element.Parent = self
1607
+ constraint.Parent = self
1523
1608
 
1524
1609
  @readonly
1525
- def Constraints(self) -> dict[RecordElementSymbol, Range]:
1610
+ def Constraints(self) -> dict[RecordElementSymbol, ArrayElementConstraint | RecordElementConstraint]:
1526
1611
  """
1527
- Read-only property to access the constraints (:attr:`_constraints`).
1612
+ Read-only property to access the element constraints (:attr:`_constraints`).
1528
1613
 
1529
- :returns: Dictionary of constraints.
1614
+ :returns: Dictionary of element constraints, indexed by record element.
1530
1615
  """
1531
1616
  return self._constraints
1532
1617
 
1618
+ def _VisitRecordConstraint(self, visitor: Visitor) -> None:
1619
+ """
1620
+ Walk the record constraint, each record element followed by its element constraint, with a visitor.
1621
+
1622
+ :param visitor: The visitor receiving the events.
1623
+ """
1624
+ visitor.VisitRecordConstraint(self)
1625
+ for index, (element, constraint) in enumerate(self._constraints.items()):
1626
+ if index > 0:
1627
+ visitor.VisitElementSeparator(self)
1628
+
1629
+ element.Visit(visitor)
1630
+ constraint.Visit(visitor)
1631
+
1632
+ visitor.DepartRecordConstraint(self)
1633
+
1634
+
1635
+ @export
1636
+ class RecordElementConstraint(ModelEntity, RecordConstraint):
1637
+ """
1638
+ Represents the constraint of a record element in a record constraint: a nested record constraint.
1639
+
1640
+ The element constraints are available as :data:`Constraints`. The constraint has no type mark of its own: the
1641
+ element's type is the subtype of the record element (IEEE Std 1076-2008, 6.3: ``element_constraint ::=
1642
+ array_constraint | record_constraint``).
1643
+
1644
+ .. admonition:: Example
1645
+
1646
+ .. code-block:: VHDL
1647
+
1648
+ signal s : rec_t(inner(field(3 downto 0)));
1649
+ -- ^^^^^^^^^^^^^^^^^ <- Constraints
1650
+
1651
+ .. seealso::
1652
+
1653
+ * :class:`Array element constraint <pyVHDLModel.Symbol.ArrayElementConstraint>`
1654
+ * :class:`Constrained record subtype symbol <pyVHDLModel.Symbol.ConstrainedRecordSubtypeSymbol>`
1655
+ """
1656
+
1657
+ def __init__(
1658
+ self,
1659
+ constraints: Mapping[RecordElementSymbol, ArrayElementConstraint | RecordElementConstraint],
1660
+ *,
1661
+ parent: Nullable[ModelEntity] = None
1662
+ ) -> None:
1663
+ """
1664
+ Initializes the constraint of a record element.
1665
+
1666
+ :param constraints: Dictionary of the element constraint per constrained record element.
1667
+ :param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
1668
+ """
1669
+ super().__init__(parent)
1670
+ RecordConstraint.__init__(self, constraints)
1671
+
1672
+ def Copy(self) -> Self:
1673
+ """
1674
+ Create a copy of this record element constraint.
1675
+
1676
+ The copy has no parent. The record elements and their element constraints are copied.
1677
+
1678
+ :returns: The new record element constraint.
1679
+ """
1680
+ return self.__class__({element.Copy(): constraint.Copy() for element, constraint in self._constraints.items()})
1681
+
1682
+ def Visit(self, visitor: Visitor) -> None:
1683
+ """
1684
+ Walk this record element constraint and its record constraint with a visitor.
1685
+
1686
+ :param visitor: The visitor receiving the events.
1687
+ """
1688
+ visitor.VisitRecordElementConstraint(self)
1689
+ self._VisitRecordConstraint(visitor)
1690
+ visitor.DepartRecordElementConstraint(self)
1691
+
1692
+ def __str__(self) -> str:
1693
+ """
1694
+ Formats the record element constraint.
1695
+
1696
+ **Format:** ``(field(3 downto 0))``
1697
+
1698
+ :returns: Formatted record element constraint.
1699
+ """
1700
+ return f"({', '.join(f'{element._name!s}{constraint!s}' for element, constraint in self._constraints.items())})"
1701
+
1533
1702
 
1534
1703
  @export
1535
1704
  @abstractclass
@@ -1603,14 +1772,7 @@ class ConstrainedArraySubtypeSymbol(ConstrainedCompositeSubtypeSymbol, ArrayCons
1603
1772
  """
1604
1773
  visitor.VisitConstrainedArraySubtypeSymbol(self)
1605
1774
  self._name.Visit(visitor)
1606
- visitor.VisitIndexConstraint(self)
1607
- for index, constraint in enumerate(self._constraints):
1608
- if index > 0:
1609
- visitor.VisitElementSeparator(self)
1610
-
1611
- constraint.Visit(visitor)
1612
-
1613
- visitor.DepartIndexConstraint(self)
1775
+ self._VisitArrayConstraint(visitor)
1614
1776
  visitor.DepartConstrainedArraySubtypeSymbol(self)
1615
1777
 
1616
1778
 
@@ -1619,15 +1781,31 @@ class ConstrainedRecordSubtypeSymbol(ConstrainedCompositeSubtypeSymbol, RecordCo
1619
1781
  """
1620
1782
  Represents a reference to a record subtype with constrained elements.
1621
1783
 
1622
- The referenced language entity is available as :data:`Reference` once resolved.
1784
+ The referenced language entity is available as :data:`Reference` once resolved. Each constrained record element has
1785
+ an element constraint: an :class:`~pyVHDLModel.Symbol.ArrayElementConstraint` or a nested
1786
+ :class:`~pyVHDLModel.Symbol.RecordElementConstraint`.
1787
+
1788
+ .. admonition:: Example
1789
+
1790
+ .. code-block:: VHDL
1791
+
1792
+ signal s : rec_t(data(7 downto 0), inner(field(3 downto 0)));
1793
+ -- ^^^^^ <- Name
1794
+ -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- Constraints
1623
1795
  """
1624
1796
 
1625
- def __init__(self, name: Name, constraints: Mapping, *, parent: Nullable[ModelEntity] = None) -> None:
1797
+ def __init__(
1798
+ self,
1799
+ name: Name,
1800
+ constraints: Mapping[RecordElementSymbol, ArrayElementConstraint | RecordElementConstraint],
1801
+ *,
1802
+ parent: Nullable[ModelEntity] = None
1803
+ ) -> None:
1626
1804
  """
1627
1805
  Initializes a reference to a record subtype with constrained elements.
1628
1806
 
1629
1807
  :param name: The name to reference the language entity.
1630
- :param constraints: Dictionary of the constraint per constrained record element.
1808
+ :param constraints: Dictionary of the element constraint per constrained record element.
1631
1809
  :param parent: Optional, the parent model entity of this entity. Default: ``None``, no parent.
1632
1810
  """
1633
1811
  super().__init__(name, parent=parent)
@@ -1637,16 +1815,13 @@ class ConstrainedRecordSubtypeSymbol(ConstrainedCompositeSubtypeSymbol, RecordCo
1637
1815
  """
1638
1816
  Create a copy of this constrained record subtype symbol.
1639
1817
 
1640
- The copy has no parent. The name, the record elements and their constraints are copied; the reference, if resolved,
1641
- is the same.
1818
+ The copy has no parent. The name, the record elements and their element constraints are copied; the reference, if
1819
+ resolved, is the same.
1642
1820
 
1643
1821
  :returns: The new constrained record subtype symbol.
1644
1822
  """
1645
- constraints = {
1646
- element.Copy(): None if constraint is None else constraint.Copy()
1647
- for element, constraint in self._constraints.items()
1648
- }
1649
- copy = self.__class__(self._name.Copy(), constraints)
1823
+ constraints = {element.Copy(): constraint.Copy() for element, constraint in self._constraints.items()}
1824
+ copy = self.__class__(self._name.Copy(), constraints)
1650
1825
  copy._reference = self._reference
1651
1826
  return copy
1652
1827
 
@@ -1654,23 +1829,13 @@ class ConstrainedRecordSubtypeSymbol(ConstrainedCompositeSubtypeSymbol, RecordCo
1654
1829
  """
1655
1830
  Walk this constrained record subtype symbol, its name and its record constraint with a visitor.
1656
1831
 
1657
- Each record element constraint is walked as the element's name followed by an index constraint.
1832
+ Each record element is followed by its element constraint.
1658
1833
 
1659
1834
  :param visitor: The visitor receiving the events.
1660
1835
  """
1661
1836
  visitor.VisitConstrainedRecordSubtypeSymbol(self)
1662
1837
  self._name.Visit(visitor)
1663
- visitor.VisitRecordConstraint(self)
1664
- for index, (element, constraint) in enumerate(self._constraints.items()):
1665
- if index > 0:
1666
- visitor.VisitElementSeparator(self)
1667
-
1668
- element.Visit(visitor)
1669
- visitor.VisitIndexConstraint(self)
1670
- constraint.Visit(visitor)
1671
- visitor.DepartIndexConstraint(self)
1672
-
1673
- visitor.DepartRecordConstraint(self)
1838
+ self._VisitRecordConstraint(visitor)
1674
1839
  visitor.DepartConstrainedRecordSubtypeSymbol(self)
1675
1840
 
1676
1841
 
@@ -128,7 +128,8 @@ if TYPE_CHECKING:
128
128
  LoopControlStatement, NextStatement, ExitStatement
129
129
  from pyVHDLModel.Subprogram import Subprogram, Procedure, Function
130
130
  from pyVHDLModel.Symbol import Symbol, ConstrainedScalarSubtypeSymbol, ConstrainedArraySubtypeSymbol, \
131
- ConstrainedRecordSubtypeSymbol, AggregateSymbol
131
+ ConstrainedRecordSubtypeSymbol, ArrayElementConstraint, \
132
+ RecordElementConstraint, AggregateSymbol
132
133
  from pyVHDLModel.Type import AnonymousType, Subtype, EnumeratedType, IntegerType, RealType, PhysicalType, \
133
134
  ArrayType, RecordTypeElement, RecordType, AccessType, FileType, ProtectedType, \
134
135
  ProtectedTypeBody
@@ -174,7 +175,7 @@ class Visitor(metaclass=ExtendedType, slots=True):
174
175
  def VisitElementSeparator(
175
176
  self,
176
177
  element: IndexedName | Aggregate | ConstrainedArraySubtypeSymbol | ConstrainedRecordSubtypeSymbol |
177
- EnumeratedType | ArrayType | AggregateSymbol
178
+ ArrayElementConstraint | RecordElementConstraint | EnumeratedType | ArrayType | AggregateSymbol
178
179
  ) -> None:
179
180
  """
180
181
  Visit the comma between two elements of a parenthesized list, which is no association list.
@@ -1137,37 +1138,39 @@ class Visitor(metaclass=ExtendedType, slots=True):
1137
1138
 
1138
1139
  def VisitIndexConstraint(
1139
1140
  self,
1140
- element: ConstrainedArraySubtypeSymbol | ConstrainedRecordSubtypeSymbol | ArrayType
1141
+ element: ConstrainedArraySubtypeSymbol | ArrayElementConstraint | ArrayType
1141
1142
  ) -> None:
1142
1143
  """
1143
1144
  Visit the index constraint of a subtype indication, of a record element or of an array type, before its first range.
1144
1145
 
1145
- :param element: The constrained subtype symbol or the array type.
1146
+ :param element: The constrained subtype symbol, the array element constraint or the array type.
1146
1147
  """
1147
1148
 
1148
1149
  def DepartIndexConstraint(
1149
1150
  self,
1150
- element: ConstrainedArraySubtypeSymbol | ConstrainedRecordSubtypeSymbol | ArrayType
1151
+ element: ConstrainedArraySubtypeSymbol | ArrayElementConstraint | ArrayType
1151
1152
  ) -> None:
1152
1153
  """
1153
1154
  Depart from the index constraint of a subtype indication, of a record element or of an array type, after its last
1154
1155
  range.
1155
1156
 
1156
- :param element: The constrained subtype symbol or the array type.
1157
+ :param element: The constrained subtype symbol, the array element constraint or the array type.
1157
1158
  """
1158
1159
 
1159
- def VisitRecordConstraint(self, symbol: ConstrainedRecordSubtypeSymbol) -> None:
1160
+ def VisitRecordConstraint(self, element: ConstrainedRecordSubtypeSymbol | RecordElementConstraint) -> None:
1160
1161
  """
1161
- Visit the record constraint of a subtype indication, before its first record element constraint.
1162
+ Visit the record constraint of a subtype indication or of a record element, before its first record element
1163
+ constraint.
1162
1164
 
1163
- :param symbol: The constrained subtype symbol.
1165
+ :param element: The constrained subtype symbol or the record element constraint.
1164
1166
  """
1165
1167
 
1166
- def DepartRecordConstraint(self, symbol: ConstrainedRecordSubtypeSymbol) -> None:
1168
+ def DepartRecordConstraint(self, element: ConstrainedRecordSubtypeSymbol | RecordElementConstraint) -> None:
1167
1169
  """
1168
- Depart from the record constraint of a subtype indication, after its last record element constraint.
1170
+ Depart from the record constraint of a subtype indication or of a record element, after its last record element
1171
+ constraint.
1169
1172
 
1170
- :param symbol: The constrained subtype symbol.
1173
+ :param element: The constrained subtype symbol or the record element constraint.
1171
1174
  """
1172
1175
 
1173
1176
  def VisitGenericClause(self, element: WithGenericsMixin) -> None:
@@ -1240,6 +1243,34 @@ class Visitor(metaclass=ExtendedType, slots=True):
1240
1243
  :param symbol: The constrained subtype symbol.
1241
1244
  """
1242
1245
 
1246
+ def VisitArrayElementConstraint(self, constraint: ArrayElementConstraint) -> None:
1247
+ """
1248
+ Visit the array constraint of a record element, before its index constraint.
1249
+
1250
+ :param constraint: The array element constraint.
1251
+ """
1252
+
1253
+ def DepartArrayElementConstraint(self, constraint: ArrayElementConstraint) -> None:
1254
+ """
1255
+ Depart from the array constraint of a record element, after its index constraint.
1256
+
1257
+ :param constraint: The array element constraint.
1258
+ """
1259
+
1260
+ def VisitRecordElementConstraint(self, constraint: RecordElementConstraint) -> None:
1261
+ """
1262
+ Visit the nested record constraint of a record element, before its record constraint.
1263
+
1264
+ :param constraint: The record element constraint.
1265
+ """
1266
+
1267
+ def DepartRecordElementConstraint(self, constraint: RecordElementConstraint) -> None:
1268
+ """
1269
+ Depart from the nested record constraint of a record element, after its record constraint.
1270
+
1271
+ :param constraint: The record element constraint.
1272
+ """
1273
+
1243
1274
  def VisitConstant(self, constant: Constant) -> None:
1244
1275
  """
1245
1276
  Visit a constant declaration, before its subtype.
@@ -50,7 +50,7 @@ __author__ = "Patrick Lehmann"
50
50
  __email__ = "Paebbels@gmail.com"
51
51
  __copyright__ = "2016-2026, Patrick Lehmann"
52
52
  __license__ = "Apache License, Version 2.0"
53
- __version__ = "0.43.0"
53
+ __version__ = "0.44.0"
54
54
  # __keywords__ = []
55
55
  __project_url__ = "https://github.com/VHDL/pyVHDLModel"
56
56
  __documentation_url__ = "https://vhdl.github.io/pyVHDLModel"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyVHDLModel
3
- Version: 0.43.0
3
+ Version: 0.44.0
4
4
  Summary: An abstract VHDL language model.
5
5
  Home-page: https://GitHub.com/VHDL/pyVHDLModel
6
6
  Author: Patrick Lehmann
@@ -28,43 +28,43 @@ Description-Content-Type: text/markdown
28
28
  License-File: LICENSE.md
29
29
  Requires-Dist: pyTooling<11.0,>=10.2.0
30
30
  Provides-Extra: doc
31
- Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "doc"
32
- Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "doc"
31
+ Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "doc"
32
+ Requires-Dist: sphinx_rtd_theme~=3.1; extra == "doc"
33
+ Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
34
+ Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "doc"
33
35
  Requires-Dist: sphinx-copybutton>=0.5.2; extra == "doc"
36
+ Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "doc"
34
37
  Requires-Dist: sphinx_design~=0.7.0; extra == "doc"
35
- Requires-Dist: docutils_stubs~=0.0.22; extra == "doc"
38
+ Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "doc"
36
39
  Requires-Dist: sphinx~=9.2; extra == "doc"
37
- Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "doc"
38
- Requires-Dist: sphinx_rtd_theme~=3.1; extra == "doc"
39
- Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "doc"
40
40
  Requires-Dist: autoapi>=2.0.1; extra == "doc"
41
41
  Provides-Extra: test
42
- Requires-Dist: Coverage~=7.17; extra == "test"
43
42
  Requires-Dist: typing_extensions~=4.16; extra == "test"
44
- Requires-Dist: pytest-cov~=7.1; extra == "test"
45
43
  Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "test"
46
44
  Requires-Dist: pytest-xdist~=3.8; extra == "test"
47
- Requires-Dist: mypy[reports]~=2.4; extra == "test"
45
+ Requires-Dist: pytest-cov~=7.1; extra == "test"
48
46
  Requires-Dist: pytest~=9.2; extra == "test"
47
+ Requires-Dist: Coverage~=7.17; extra == "test"
49
48
  Requires-Dist: lxml<7.0,>=6.1.3; extra == "test"
49
+ Requires-Dist: mypy[reports]~=2.4; extra == "test"
50
50
  Provides-Extra: all
51
- Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "all"
52
- Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "all"
53
- Requires-Dist: Coverage~=7.17; extra == "all"
54
51
  Requires-Dist: typing_extensions~=4.16; extra == "all"
55
- Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
56
- Requires-Dist: pytest-cov~=7.1; extra == "all"
52
+ Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "all"
57
53
  Requires-Dist: docutils_stubs~=0.0.22; extra == "all"
58
- Requires-Dist: sphinx~=9.2; extra == "all"
59
- Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "all"
60
54
  Requires-Dist: sphinx_rtd_theme~=3.1; extra == "all"
61
- Requires-Dist: autoapi>=2.0.1; extra == "all"
62
- Requires-Dist: pyTooling<11.0,>=10.2.0; extra == "all"
55
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
56
+ Requires-Dist: sphinxcontrib-mermaid~=2.1; extra == "all"
57
+ Requires-Dist: sphinx_autodoc_typehints~=3.17; extra == "all"
63
58
  Requires-Dist: pytest-xdist~=3.8; extra == "all"
64
- Requires-Dist: mypy[reports]~=2.4; extra == "all"
59
+ Requires-Dist: pytest-cov~=7.1; extra == "all"
60
+ Requires-Dist: sphinx_design~=0.7.0; extra == "all"
65
61
  Requires-Dist: pytest~=9.2; extra == "all"
62
+ Requires-Dist: Coverage~=7.17; extra == "all"
63
+ Requires-Dist: pyTooling.Sphinx[reports]~=1.0; extra == "all"
66
64
  Requires-Dist: lxml<7.0,>=6.1.3; extra == "all"
67
- Requires-Dist: sphinx_design~=0.7.0; extra == "all"
65
+ Requires-Dist: sphinx~=9.2; extra == "all"
66
+ Requires-Dist: mypy[reports]~=2.4; extra == "all"
67
+ Requires-Dist: autoapi>=2.0.1; extra == "all"
68
68
  Dynamic: author
69
69
  Dynamic: author-email
70
70
  Dynamic: classifier
File without changes
File without changes
@@ -1,42 +1,42 @@
1
1
  pyTooling<11.0,>=10.2.0
2
2
 
3
3
  [all]
4
- pyTooling.Sphinx[reports]~=1.0
5
- sphinx_autodoc_typehints~=3.17
6
- Coverage~=7.17
7
4
  typing_extensions~=4.16
8
- sphinx-copybutton>=0.5.2
9
- pytest-cov~=7.1
5
+ pyTooling<11.0,>=10.2.0
10
6
  docutils_stubs~=0.0.22
11
- sphinx~=9.2
12
- sphinxcontrib-mermaid~=2.1
13
7
  sphinx_rtd_theme~=3.1
14
- autoapi>=2.0.1
15
- pyTooling<11.0,>=10.2.0
8
+ sphinx-copybutton>=0.5.2
9
+ sphinxcontrib-mermaid~=2.1
10
+ sphinx_autodoc_typehints~=3.17
16
11
  pytest-xdist~=3.8
17
- mypy[reports]~=2.4
12
+ pytest-cov~=7.1
13
+ sphinx_design~=0.7.0
18
14
  pytest~=9.2
15
+ Coverage~=7.17
16
+ pyTooling.Sphinx[reports]~=1.0
19
17
  lxml<7.0,>=6.1.3
20
- sphinx_design~=0.7.0
18
+ sphinx~=9.2
19
+ mypy[reports]~=2.4
20
+ autoapi>=2.0.1
21
21
 
22
22
  [doc]
23
- pyTooling.Sphinx[reports]~=1.0
24
- sphinx_autodoc_typehints~=3.17
23
+ pyTooling<11.0,>=10.2.0
24
+ sphinx_rtd_theme~=3.1
25
+ docutils_stubs~=0.0.22
26
+ sphinxcontrib-mermaid~=2.1
25
27
  sphinx-copybutton>=0.5.2
28
+ sphinx_autodoc_typehints~=3.17
26
29
  sphinx_design~=0.7.0
27
- docutils_stubs~=0.0.22
30
+ pyTooling.Sphinx[reports]~=1.0
28
31
  sphinx~=9.2
29
- sphinxcontrib-mermaid~=2.1
30
- sphinx_rtd_theme~=3.1
31
- pyTooling<11.0,>=10.2.0
32
32
  autoapi>=2.0.1
33
33
 
34
34
  [test]
35
- Coverage~=7.17
36
35
  typing_extensions~=4.16
37
- pytest-cov~=7.1
38
36
  pyTooling<11.0,>=10.2.0
39
37
  pytest-xdist~=3.8
40
- mypy[reports]~=2.4
38
+ pytest-cov~=7.1
41
39
  pytest~=9.2
40
+ Coverage~=7.17
42
41
  lxml<7.0,>=6.1.3
42
+ mypy[reports]~=2.4
File without changes
File without changes