Skip to content

Commit

Permalink
v0.31.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels authored Feb 25, 2025
2 parents fade0c9 + a11f7fa commit 5724f86
Show file tree
Hide file tree
Showing 11 changed files with 267 additions and 31 deletions.
10 changes: 5 additions & 5 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.1 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ | *None* |
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.2 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ | *None* |
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+


Expand Down Expand Up @@ -89,9 +89,9 @@ the mandatory dependencies too.
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| **Package** | **Version** | **License** | **Dependencies** |
+=================================================================================================+==============+==========================================================================================================+======================+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.1 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.2 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| `Sphinx <https://GitHub.com/sphinx-doc/sphinx>`__ | ≥8.1 | `BSD 3-Clause <https://GitHub.com/sphinx-doc/sphinx/blob/master/LICENSE>`__ | *Not yet evaluated.* |
| `Sphinx <https://GitHub.com/sphinx-doc/sphinx>`__ | ≥8.2 | `BSD 3-Clause <https://GitHub.com/sphinx-doc/sphinx/blob/master/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| `sphinxcontrib-mermaid <https://GitHub.com/mgaitan/sphinxcontrib-mermaid>`__ | ≥1.0 | `BSD <https://GitHub.com/mgaitan/sphinxcontrib-mermaid/blob/master/LICENSE.rst>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
Expand All @@ -101,7 +101,7 @@ the mandatory dependencies too.
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| !! `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_autodoc_typehints <https://GitHub.com/agronholm/sphinx-autodoc-typehints>`__ | ≥3.0 | `MIT <https://GitHub.com/agronholm/sphinx-autodoc-typehints/blob/master/LICENSE>`__ | *Not yet evaluated.* |
| `sphinx_autodoc_typehints <https://GitHub.com/agronholm/sphinx-autodoc-typehints>`__ | ≥3.1 | `MIT <https://GitHub.com/agronholm/sphinx-autodoc-typehints/blob/master/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+


Expand Down Expand Up @@ -129,7 +129,7 @@ install the mandatory dependencies too.
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Package** | **Version** | **License** | **Dependencies** |
+============================================================================+==============+==========================================================================================================+======================================================================================================================================================+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.1 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.2 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| `wheel <https://GitHub.com/pypa/wheel>`__ | ≥0.45 | `MIT <https://github.com/pypa/wheel/blob/main/LICENSE.txt>`__ | *Not yet evaluated.* |
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
Expand Down
4 changes: 2 additions & 2 deletions doc/Installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Ensure :ref:`packaging requirements <DEP/packaging>` are installed.
python -m pip uninstall -y pyVHDLModel
# Install from wheel
python -m pip install ./dist/pyVHDLModel-0.29.1-py3-none-any.whl
python -m pip install ./dist/pyVHDLModel-0.31.0-py3-none-any.whl
.. tab-item:: Windows
:sync: Windows
Expand All @@ -208,4 +208,4 @@ Ensure :ref:`packaging requirements <DEP/packaging>` are installed.
py -m pip uninstall -y pyVHDLModel
# Install from wheel
py -m pip install .\dist\pyVHDLModel-0.29.1-py3-none-any.whl
py -m pip install .\dist\pyVHDLModel-0.31.0-py3-none-any.whl
4 changes: 2 additions & 2 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r ../requirements.txt

# Enforce latest version on ReadTheDocs
sphinx ~= 8.1
sphinx ~= 8.2
docutils ~= 0.21
docutils_stubs ~= 0.0.22

Expand All @@ -13,5 +13,5 @@ sphinxcontrib-mermaid ~= 1.0
autoapi >= 2.0.1
sphinx_design ~= 0.6.1
sphinx-copybutton >= 0.5.2
sphinx_autodoc_typehints ~= 3.0
sphinx_autodoc_typehints ~= 3.1
sphinx_reports ~= 0.7
107 changes: 106 additions & 1 deletion pyVHDLModel/DesignUnit.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ class Package(PrimaryUnit, DesignUnitWithContextMixin, ConcurrentDeclarationRegi
end package;
"""

_allowBlackbox: Nullable[bool] #: Allow blackboxes for components in this package.
_packageBody: Nullable["PackageBody"]

_genericItems: List[GenericInterfaceItemMixin]
Expand All @@ -440,12 +441,25 @@ def __init__(
genericItems: Nullable[Iterable[GenericInterfaceItemMixin]] = None,
declaredItems: Nullable[Iterable] = None,
documentation: Nullable[str] = None,
allowBlackbox: Nullable[bool] = None,
parent: ModelEntity = None
) -> None:
"""
Initialize a package.
:param identifier: Name of the VHDL package.
:param contextItems:
:param genericItems:
:param declaredItems:
:param documentation:
:param allowBlackbox: Specify if blackboxes are allowed in this design.
:param parent: The parent model entity (library) of this VHDL package.
"""
super().__init__(identifier, contextItems, documentation, parent)
DesignUnitWithContextMixin.__init__(self)
ConcurrentDeclarationRegionMixin.__init__(self, declaredItems)

self._allowBlackbox = allowBlackbox
self._packageBody = None

# TODO: extract to mixin
Expand All @@ -458,6 +472,22 @@ def __init__(
self._deferredConstants = {}
self._components = {}

@property
def AllowBlackbox(self) -> bool:
"""
Read-only property to check if a design supports blackboxes (:attr:`_allowBlackbox`).
:returns: If blackboxes are allowed.
"""
if self._allowBlackbox is None:
return self._parent.AllowBlackbox
else:
return self._allowBlackbox

@AllowBlackbox.setter
def AllowBlackbox(self, value: Nullable[bool]) -> None:
self._allowBlackbox = value

@property
def PackageBody(self) -> Nullable["PackageBody"]:
return self._packageBody
Expand Down Expand Up @@ -565,6 +595,8 @@ class Entity(PrimaryUnit, DesignUnitWithContextMixin, ConcurrentDeclarationRegio
end entity;
"""

_allowBlackbox: Nullable[bool] #: Allow blackboxes for components in this package.

_genericItems: List[GenericInterfaceItemMixin]
_portItems: List[PortInterfaceItemMixin]

Expand All @@ -579,13 +611,16 @@ def __init__(
declaredItems: Nullable[Iterable] = None,
statements: Nullable[Iterable[ConcurrentStatement]] = None,
documentation: Nullable[str] = None,
allowBlackbox: Nullable[bool] = None,
parent: ModelEntity = None
) -> None:
super().__init__(identifier, contextItems, documentation, parent)
DesignUnitWithContextMixin.__init__(self)
ConcurrentDeclarationRegionMixin.__init__(self, declaredItems)
ConcurrentStatementsMixin.__init__(self, statements)

self._allowBlackbox = allowBlackbox

# TODO: extract to mixin
self._genericItems = []
if genericItems is not None:
Expand All @@ -602,6 +637,22 @@ def __init__(

self._architectures = {}

@property
def AllowBlackbox(self) -> bool:
"""
Read-only property to check if a design supports blackboxes (:attr:`_allowBlackbox`).
:returns: If blackboxes are allowed.
"""
if self._allowBlackbox is None:
return self._parent.AllowBlackbox
else:
return self._allowBlackbox

@AllowBlackbox.setter
def AllowBlackbox(self, value: Nullable[bool]) -> None:
self._allowBlackbox = value

# TODO: extract to mixin for generics
@property
def GenericItems(self) -> List[GenericInterfaceItemMixin]:
Expand Down Expand Up @@ -645,7 +696,8 @@ class Architecture(SecondaryUnit, DesignUnitWithContextMixin, ConcurrentDeclarat
end architecture;
"""

_entity: EntitySymbol
_allowBlackbox: Nullable[bool] #: Allow blackboxes for components in this package.
_entity: EntitySymbol

def __init__(
self,
Expand All @@ -655,20 +707,39 @@ def __init__(
declaredItems: Nullable[Iterable] = None,
statements: Iterable['ConcurrentStatement'] = None,
documentation: Nullable[str] = None,
allowBlackbox: Nullable[bool] = None,
parent: ModelEntity = None
) -> None:
super().__init__(identifier, contextItems, documentation, parent)
DesignUnitWithContextMixin.__init__(self)
ConcurrentDeclarationRegionMixin.__init__(self, declaredItems)
ConcurrentStatementsMixin.__init__(self, statements)

self._allowBlackbox = allowBlackbox

self._entity = entity
entity._parent = self

@property
def Entity(self) -> EntitySymbol:
return self._entity

@property
def AllowBlackbox(self) -> bool:
"""
Read-only property to check if a design supports blackboxes (:attr:`_allowBlackbox`).
:returns: If blackboxes are allowed.
"""
if self._allowBlackbox is None:
return self._parent.AllowBlackbox
else:
return self._allowBlackbox

@AllowBlackbox.setter
def AllowBlackbox(self, value: Nullable[bool]) -> None:
self._allowBlackbox = value

def __str__(self) -> str:
lib = self._parent._identifier if self._parent is not None else "%"
ent = self._entity._name._identifier if self._entity is not None else "%"
Expand Down Expand Up @@ -696,6 +767,9 @@ class Component(ModelEntity, NamedEntityMixin, DocumentedEntityMixin):
end component;
"""

_allowBlackbox: Nullable[bool] #: Allow component to be a blackbox.
_isBlackBox: Nullable[bool] #: Component is a blackbox.

_genericItems: List[GenericInterfaceItemMixin]
_portItems: List[PortInterfaceItemMixin]

Expand All @@ -707,12 +781,17 @@ def __init__(
genericItems: Nullable[Iterable[GenericInterfaceItemMixin]] = None,
portItems: Nullable[Iterable[PortInterfaceItemMixin]] = None,
documentation: Nullable[str] = None,
allowBlackbox: Nullable[bool] = None,
parent: ModelEntity = None
) -> None:
super().__init__(parent)
NamedEntityMixin.__init__(self, identifier)
DocumentedEntityMixin.__init__(self, documentation)

self._allowBlackbox = allowBlackbox
self._isBlackBox = None
self._entity = None

# TODO: extract to mixin
self._genericItems = []
if genericItems is not None:
Expand All @@ -727,6 +806,31 @@ def __init__(
self._portItems.append(item)
item._parent = self

@property
def AllowBlackbox(self) -> bool:
"""
Read-only property to check if a design supports blackboxes (:attr:`_allowBlackbox`).
:returns: If blackboxes are allowed.
"""
if self._allowBlackbox is None:
return self._parent.AllowBlackbox
else:
return self._allowBlackbox

@AllowBlackbox.setter
def AllowBlackbox(self, value: Nullable[bool]) -> None:
self._allowBlackbox = value

@property
def IsBlackbox(self) -> bool:
"""
Read-only property returning true, if this component is a blackbox (:attr:`_isBlackbox`).
:returns: If this component is a blackbox.
"""
return self._isBlackBox

@property
def GenericItems(self) -> List[GenericInterfaceItemMixin]:
return self._genericItems
Expand All @@ -742,6 +846,7 @@ def Entity(self) -> Nullable[Entity]:
@Entity.setter
def Entity(self, value: Entity) -> None:
self._entity = value
self._isBlackBox = False


@export
Expand Down
1 change: 0 additions & 1 deletion pyVHDLModel/IEEE.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def __init__(self, flavor: Nullable[IEEEFlavor] = None) -> None:
self.LoadSynopsysPackages()
else:
raise VHDLModelException(f"Unknown IEEE library flavor '{flavor}'.")
self._flavor = flavor

@readonly
def Flavor(self) -> IEEEFlavor:
Expand Down
12 changes: 10 additions & 2 deletions pyVHDLModel/Interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from pyTooling.MetaClasses import ExtendedType

from pyVHDLModel.Symbol import Symbol
from pyVHDLModel.Base import ModelEntity, DocumentedEntityMixin, ExpressionUnion, Mode
from pyVHDLModel.Base import ModelEntity, DocumentedEntityMixin, ExpressionUnion, Mode, NamedEntityMixin
from pyVHDLModel.Object import Constant, Signal, Variable, File
from pyVHDLModel.Subprogram import Procedure, Function
from pyVHDLModel.Type import Type
Expand Down Expand Up @@ -130,7 +130,15 @@ def __init__(self, identifier: str, documentation: Nullable[str] = None, parent:


@export
class GenericPackageInterfaceItem(GenericInterfaceItemMixin):
class InterfacePackage(ModelEntity, NamedEntityMixin, DocumentedEntityMixin):
def __init__(self, identifier: str, documentation: Nullable[str] = None, parent: ModelEntity = None) -> None:
super().__init__(parent)
NamedEntityMixin.__init__(self, identifier)
DocumentedEntityMixin.__init__(self, documentation)


@export
class GenericPackageInterfaceItem(InterfacePackage, GenericInterfaceItemMixin):
def __init__(self, identifier: str, documentation: Nullable[str] = None, parent: ModelEntity = None) -> None:
super().__init__(identifier, documentation, parent)
GenericInterfaceItemMixin.__init__(self)
Expand Down
45 changes: 41 additions & 4 deletions pyVHDLModel/Symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,20 +455,57 @@ class ConstrainedScalarSubtypeSymbol(SubtypeSymbol):


@export
class ConstrainedCompositeSubtypeSymbol(SubtypeSymbol):
class Constraint:
pass


@export
class ConstrainedArraySubtypeSymbol(ConstrainedCompositeSubtypeSymbol):
pass
class ArrayConstraint(Constraint):
_constraints: List[Range]

def __init__(self, constraints: Iterable[Range]) -> None:
self._constraints = [constraint for constraint in constraints]

@readonly
def Constraints(self) -> List[Range]:
return self._constraints


@export
class RecordConstraint(Constraint):
_constraints: Dict[RecordElementSymbol, Range]

def __init__(self, constraints: Mapping[RecordElementSymbol, Range]) -> None:
self._constraints = {key: value for key, value in constraints.items()}

@readonly
def Constraints(self) -> Dict[RecordElementSymbol, Range]:
return self._constraints


@export
class ConstrainedRecordSubtypeSymbol(ConstrainedCompositeSubtypeSymbol):
class ConstrainedCompositeSubtypeSymbol(SubtypeSymbol):
pass


@export
class ConstrainedArraySubtypeSymbol(ConstrainedCompositeSubtypeSymbol, ArrayConstraint):
_constraints: List

def __init__(self, name: Name, constraints: Iterable) -> None:
super().__init__(name)
ArrayConstraint.__init__(self, constraints)


@export
class ConstrainedRecordSubtypeSymbol(ConstrainedCompositeSubtypeSymbol, RecordConstraint):
_constraints: Dict[RecordElementSymbol, Any]

def __init__(self, name: Name, constraints: Mapping) -> None:
super().__init__(name)
RecordConstraint.__init__(self, constraints)


@export
class SimpleObjectOrFunctionCallSymbol(Symbol):
def __init__(self, name: Name) -> None:
Expand Down
Loading

0 comments on commit 5724f86

Please sign in to comment.