Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/Pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Pipeline
run-name: ${{ github.ref_type == 'tag' && github.ref_name || '' }}

on:
push:
Expand Down
12 changes: 8 additions & 4 deletions doc/Dependency.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pyVHDLModel Package
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
| **Package** | **Version** | **License** | **Dependencies** |
+========================================================+=============+==========================================================================================+=================================================================================================================================+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.18 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ | *None* |
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.19 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ | *None* |
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+


Expand Down Expand Up @@ -89,7 +89,7 @@ the mandatory dependencies too.
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| **Package** | **Version** | **License** | **Dependencies** |
+=================================================================================================+==============+==========================================================================================================+======================+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.18 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.19 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| `Sphinx <https://GitHub.com/sphinx-doc/sphinx>`__ | ≥9.1 | `BSD 3-Clause <https://GitHub.com/sphinx-doc/sphinx/blob/master/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
Expand All @@ -99,10 +99,14 @@ the mandatory dependencies too.
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| `autoapi <https://GitHub.com/carlos-jenkins/autoapi>`__ | ≥2.0.1 | `Apache License, 2.0 <https://GitHub.com/carlos-jenkins/autoapi/blob/master/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| !! `sphinx_fontawesome <https://GitHub.com/fraoustin/sphinx_fontawesome>`__ | ≥0.0.6 | `GPL 2.0 <https://GitHub.com/fraoustin/sphinx_fontawesome/blob/master/LICENSE>`__ | *Not yet evaluated.* |
| `sphinx_design <https://GitHub.com/executablebooks/sphinx-design>`__ | ≥0.7 | `MIT <https://GitHub.com/executablebooks/sphinx-design/blob/main/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| `sphinx-copybutton <https://GitHub.com/executablebooks/sphinx-copybutton>`__ | ≥0.5.2 | `MIT <https://GitHub.com/executablebooks/sphinx-copybutton/blob/master/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| `sphinx_autodoc_typehints <https://GitHub.com/agronholm/sphinx-autodoc-typehints>`__ | ≥3.13 | `MIT <https://GitHub.com/agronholm/sphinx-autodoc-typehints/blob/master/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| `sphinx_reports <https://github.com/pyTooling/sphinx-reports>`__ | ≥0.11.2 | `Apache License, 2.0 <https://GitHub.com/pyTooling/sphinx-reports/blob/main/LICENSE.md>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+


.. _dependency-packaging:
Expand All @@ -129,7 +133,7 @@ install the mandatory dependencies too.
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Package** | **Version** | **License** | **Dependencies** |
+============================================================================+==============+==========================================================================================================+======================================================================================================================================================+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.18 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.19 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| `wheel <https://GitHub.com/pypa/wheel>`__ | ≥0.47 | `MIT <https://github.com/pypa/wheel/blob/main/LICENSE.txt>`__ | *Not yet evaluated.* |
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ autoapi >= 2.0.1
sphinx_design ~= 0.7.0
sphinx-copybutton >= 0.5.2
sphinx_autodoc_typehints ~= 3.13
sphinx_reports ~= 0.11.1
sphinx_reports ~= 0.11.2
26 changes: 18 additions & 8 deletions pyVHDLModel/Symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,22 +879,22 @@ class ScalarConstraint(Constraint, mixin=True):

* :class:`Constrained scalar subtype symbol <pyVHDLModel.Symbol.ConstrainedScalarSubtypeSymbol>`
"""
_constraint: Nullable[Range] #: The range constraining the scalar subtype, or ``None`` if unconstrained.
_constraint: Range #: The range constraining the scalar subtype.

def __init__(self, constraint: Nullable[Range]) -> None:
def __init__(self, constraint: Range) -> None:
"""
Initializes a scalar constraint.

:param constraint: The range constraining the scalar subtype, or ``None`` if unconstrained.
:param constraint: The range constraining the scalar subtype.
"""
self._constraint = constraint

@readonly
def Constraint(self) -> Nullable[Range]:
def Constraint(self) -> Range:
"""
Read-only property to access the scalar type's range constraint (:attr:`_constraint`).

:returns: The constraint, or ``None`` if not set.
:returns: The constraint of the scalar subtype.
"""
return self._constraint

Expand All @@ -904,7 +904,8 @@ class ConstrainedScalarSubtypeSymbol(SubtypeSymbol, ScalarConstraint):
"""
Represents a reference to a scalar subtype narrowed by a range.

The referenced language entity is available as :data:`Reference` once resolved.
The referenced language entity is available as :data:`Reference` once resolved. The range is
mandatory: a type mark without a range constraint is a :class:`~pyVHDLModel.Symbol.SimpleSubtypeSymbol`.

.. admonition:: Example

Expand All @@ -913,14 +914,23 @@ class ConstrainedScalarSubtypeSymbol(SubtypeSymbol, ScalarConstraint):
for i in integer range 0 to 3 loop
-- ^^^^^^^ <- Name
-- ^^^^^^ <- Constraint

A range constraint written as a range attribute is a :class:`~pyVHDLModel.Base.RangeFromName`
referring to a :class:`~pyVHDLModel.Symbol.RangeAttributeSymbol`:

.. code-block:: VHDL

subtype index is natural range vector'range;
-- ^^^^^^^ <- Name
-- ^^^^^^^^^^^^ <- Constraint
"""

def __init__(self, name: Name, constraint: Nullable[Range] = None) -> None:
def __init__(self, name: Name, constraint: Range) -> None:
"""
Initializes a reference to a scalar subtype narrowed by a range.

:param name: The name to reference the language entity.
:param constraint: The range constraining the scalar subtype, or ``None`` if unconstrained.
:param constraint: The range constraining the scalar subtype.
"""
super().__init__(name)
ScalarConstraint.__init__(self, constraint)
Expand Down
2 changes: 1 addition & 1 deletion pyVHDLModel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
__email__ = "Paebbels@gmail.com"
__copyright__ = "2016-2026, Patrick Lehmann"
__license__ = "Apache License, Version 2.0"
__version__ = "0.38.0"
__version__ = "0.39.0"
# __keywords__ = []
__project_url__ = "https://github.com/VHDL/pyVHDLModel"
__documentation_url__ = "https://vhdl.github.io/pyVHDLModel"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build-system]
requires = [
"setuptools >= 83.0",
"pyTooling ~= 8.18"
"pyTooling ~= 8.19"
]
build-backend = "setuptools.build_meta"

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyTooling ~= 8.18
pyTooling ~= 8.19
2 changes: 1 addition & 1 deletion run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Param(
)

$PackageName = "pyVHDLModel"
$PackageVersion = "0.38.0"
$PackageVersion = "0.39.0"

# set default values
$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/Instantiation/Model.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ def test_ConstrainedScalarSubtypeSymbol(self) -> None:
self.assertIs(rng, symbol.Constraint)

def test_ConstrainedScalarSubtypeSymbol_withoutConstraint(self) -> None:
symbol = ConstrainedScalarSubtypeSymbol(SimpleName("integer"))

self.assertIsNone(symbol.Constraint)
"""The range constraint is mandatory - ``integer range`` isn't a VHDL construct."""
with self.assertRaises(TypeError):
ConstrainedScalarSubtypeSymbol(SimpleName("integer"))


class PSLEntities(TestCase):
Expand Down
24 changes: 15 additions & 9 deletions tests/unit/Instantiation/Symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"""
from unittest import TestCase

from pyVHDLModel.Base import Direction, SimpleRange
from pyVHDLModel.Name import SimpleName, AllName
from pyVHDLModel.Base import Direction, SimpleRange, RangeFromName
from pyVHDLModel.Name import SimpleName, AllName, AttributeName
from pyVHDLModel.Expression import IntegerLiteral
from pyVHDLModel.Symbol import (
PossibleReference, Symbol,
Expand All @@ -49,7 +49,7 @@
PackageMemberReferenceSymbol, AllPackageMembersReferenceSymbol,
EntityInstantiationSymbol, ComponentInstantiationSymbol, ConfigurationInstantiationSymbol,
EntitySymbol, ArchitectureSymbol, PackageSymbol,
RecordElementSymbol, SubtypeSymbol, SimpleSubtypeSymbol,
RangeAttributeSymbol, RecordElementSymbol, SubtypeSymbol, SimpleSubtypeSymbol,
ConstrainedScalarSubtypeSymbol, ConstrainedArraySubtypeSymbol, ConstrainedRecordSubtypeSymbol,
SimpleObjectOrFunctionCallSymbol, IndexedObjectOrFunctionCallSymbol,
)
Expand Down Expand Up @@ -203,13 +203,19 @@ def test_ScalarConstraint_WithRange(self) -> None:

self.assertIs(constraint, symbol.Constraint)

def test_ScalarConstraint_WithoutRange(self) -> None:
"""``None`` only means the range constraint was written as an attribute name
(``subtype s is t'range;``), which isn't implemented yet - not that the source omitted a
constraint (it never does for a constrained scalar subtype). See ``Constraint``'s docstring."""
symbol = ConstrainedScalarSubtypeSymbol(SimpleName("integer"))
def test_ScalarConstraint_RangeIsMandatory(self) -> None:
"""``integer range`` isn't a VHDL construct - a type mark without a range constraint is a
``SimpleSubtypeSymbol``, so the range can't be omitted here."""
with self.assertRaises(TypeError):
ConstrainedScalarSubtypeSymbol(SimpleName("integer"))

self.assertIsNone(symbol.Constraint)
def test_ScalarConstraint_WithRangeAttribute(self) -> None:
"""``subtype index is natural range vector'range;`` - the range constraint is a range attribute,
which is a range denoted by a name."""
constraint = RangeFromName(RangeAttributeSymbol(AttributeName("range", SimpleName("vector"))))
symbol = ConstrainedScalarSubtypeSymbol(SimpleName("natural"), constraint)

self.assertIs(constraint, symbol.Constraint)

def test_ArrayConstraint(self) -> None:
constraint = SimpleRange(IntegerLiteral(7), IntegerLiteral(0), Direction.DownTo)
Expand Down
Loading