Skip to content

Commit 963c80f

Browse files
authored
v0.33.0
2 parents a175bc5 + b0cf49b commit 963c80f

File tree

12 files changed

+122
-90
lines changed

12 files changed

+122
-90
lines changed

doc/Dependency.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pyVHDLModel Package
2323
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
2424
| **Package** | **Version** | **License** | **Dependencies** |
2525
+========================================================+=============+==========================================================================================+=================================================================================================================================+
26-
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.7 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ | *None* |
26+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.8 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ | *None* |
2727
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
2828

2929

@@ -51,7 +51,7 @@ the mandatory dependencies too.
5151
+---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+
5252
| **Package** | **Version** | **License** | **Dependencies** |
5353
+=====================================================================+=============+========================================================================================+======================+
54-
| `pytest <https://GitHub.com/pytest-dev/pytest>`__ |8.4 | `MIT <https://GitHub.com/pytest-dev/pytest/blob/master/LICENSE>`__ | *Not yet evaluated.* |
54+
| `pytest <https://GitHub.com/pytest-dev/pytest>`__ |9.0 | `MIT <https://GitHub.com/pytest-dev/pytest/blob/master/LICENSE>`__ | *Not yet evaluated.* |
5555
+---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+
5656
| `pytest-cov <https://GitHub.com/pytest-dev/pytest-cov>`__ | ≥7.0 | `MIT <https://GitHub.com/pytest-dev/pytest-cov/blob/master/LICENSE>`__ | *Not yet evaluated.* |
5757
+---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+
@@ -89,7 +89,7 @@ the mandatory dependencies too.
8989
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
9090
| **Package** | **Version** | **License** | **Dependencies** |
9191
+=================================================================================================+==============+==========================================================================================================+======================+
92-
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.7 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
92+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.8 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
9393
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
9494
| `Sphinx <https://GitHub.com/sphinx-doc/sphinx>`__ | ≥8.2 | `BSD 3-Clause <https://GitHub.com/sphinx-doc/sphinx/blob/master/LICENSE>`__ | *Not yet evaluated.* |
9595
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
@@ -129,7 +129,7 @@ install the mandatory dependencies too.
129129
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
130130
| **Package** | **Version** | **License** | **Dependencies** |
131131
+============================================================================+==============+==========================================================================================================+======================================================================================================================================================+
132-
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.7 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
132+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥8.8 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
133133
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
134134
| `wheel <https://GitHub.com/pypa/wheel>`__ | ≥0.45 | `MIT <https://github.com/pypa/wheel/blob/main/LICENSE.txt>`__ | *Not yet evaluated.* |
135135
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+

pyVHDLModel/Exception.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,36 @@
3535
The module ``Exceptions`` contains all structured errors that are raised by pyVHDLModel. Besides a default error
3636
message in english, each exception object contains one or multiple references to the exception's context.
3737
"""
38-
from sys import version_info
39-
from typing import List
40-
4138
from pyTooling.Decorators import export, readonly
39+
from pyTooling.Warning import Warning, CriticalWarning
40+
41+
from pyVHDLModel.Symbol import Symbol
42+
43+
44+
@export
45+
class VHDLModelWarning(Warning):
46+
pass
47+
48+
49+
@export
50+
class NotImplementedWarning(VHDLModelWarning):
51+
pass
52+
4253

43-
from pyVHDLModel.Symbol import Symbol
54+
@export
55+
class VHDLModelCriticalWarning(Warning):
56+
pass
57+
58+
59+
@export
60+
class BlackboxWarning(VHDLModelCriticalWarning):
61+
pass
4462

4563

4664
@export
4765
class VHDLModelException(Exception):
4866
"""Base-class for all exceptions (errors) raised by pyVHDLModel."""
4967

50-
# WORKAROUND: for Python <3.11
51-
# Implementing a dummy method for Python versions before
52-
__notes__: List[str]
53-
if version_info < (3, 11): # pragma: no cover
54-
def add_note(self, message: str) -> None:
55-
try:
56-
self.__notes__.append(message)
57-
except AttributeError:
58-
self.__notes__ = [message]
59-
6068

6169
@export
6270
class LibraryExistsInDesignError(VHDLModelException):

pyVHDLModel/Expression.py

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
All declarations for literals, aggregates, operators forming an expressions.
3636
"""
3737
from enum import Flag
38-
from typing import Tuple, List, Iterable, Union, ClassVar
38+
from typing import Tuple, List, Iterable, Union, ClassVar, Optional as Nullable
3939

4040
from pyTooling.Decorators import export, readonly
4141

@@ -211,77 +211,76 @@ class BitStringBase(Flag):
211211
@export
212212
class BitStringLiteral(Literal):
213213
# _base: ClassVar[BitStringBase]
214-
_value: str
215-
_bits: int
214+
_value: str
215+
_binaryValue: str
216+
_bits: int
217+
_length: Nullable[int]
218+
_signed: Nullable[bool]
216219

217-
def __init__(self, value: str) -> None:
220+
def __init__(self, value: str, length: Nullable[int] = None, signed: Nullable[bool] = None) -> None:
218221
super().__init__()
219-
self._bits = len(value)
220222
self._value = value
223+
self._length = length
224+
self._signed = signed
221225

222-
@readonly
223-
def Bits(self) -> int:
224-
return self._bits
226+
self._binaryValue = None
227+
self._bits = None
225228

226229
@readonly
227230
def Value(self) -> str:
228231
return self._value
229232

233+
@readonly
234+
def BinaryValue(self) -> str:
235+
return self._binaryValue
236+
237+
@readonly
238+
def Bits(self) -> Nullable[int]:
239+
return self._bits
240+
241+
@readonly
242+
def Length(self) -> Nullable[int]:
243+
return self._length
244+
245+
@readonly
246+
def Signed(self) -> Nullable[bool]:
247+
return self._signed
248+
230249
def __str__(self) -> str:
231-
return "\"" + self._value + "\""
250+
signed = "" if self._signed is None else "s" if self._signed is True else "u"
251+
if self._base is BitStringBase.NoBase:
252+
base = ""
253+
elif self._base is BitStringBase.Binary:
254+
base = "b"
255+
elif self._base is BitStringBase.Octal:
256+
base = "o"
257+
elif self._base is BitStringBase.Decimal:
258+
base = "d"
259+
elif self._base is BitStringBase.Hexadecimal:
260+
base = "x"
261+
length = "" if self._length is None else str(self._length)
262+
return length + signed + base + "\"" + self._value + "\""
232263

233264

234265
@export
235266
class BinaryBitStringLiteral(BitStringLiteral):
236267
_base: ClassVar[BitStringBase] = BitStringBase.Binary
237268

238-
def __init__(self, value: str, bits: int = 0) -> None:
239-
super().__init__(value)
240-
if bits > 0:
241-
self._bits = bits
242-
243-
def __str__(self) -> str:
244-
return "b\"" + self._value + "\""
245-
246269

247270
@export
248271
class OctalBitStringLiteral(BitStringLiteral):
249272
_base: ClassVar[BitStringBase] = BitStringBase.Octal
250273

251-
def __init__(self, value: str, bits: int = 0) -> None:
252-
super().__init__(value)
253-
if bits > 0:
254-
self._bits = bits
255-
256-
def __str__(self) -> str:
257-
return "o\"" + self._value + "\""
258-
259274

260275
@export
261276
class DecimalBitStringLiteral(BitStringLiteral):
262277
_base: ClassVar[BitStringBase] = BitStringBase.Decimal
263278

264-
def __init__(self, value: str, bits: int = 0) -> None:
265-
super().__init__(value)
266-
if bits > 0:
267-
self._bits = bits
268-
269-
def __str__(self) -> str:
270-
return "d\"" + self._value + "\""
271-
272279

273280
@export
274281
class HexadecimalBitStringLiteral(BitStringLiteral):
275282
_base: ClassVar[BitStringBase] = BitStringBase.Hexadecimal
276283

277-
def __init__(self, value: str, bits: int = 0) -> None:
278-
super().__init__(value)
279-
if bits > 0:
280-
self._bits = bits
281-
282-
def __str__(self) -> str:
283-
return "x\"" + self._value + "\""
284-
285284

286285
@export
287286
class ParenthesisExpression: #(Protocol):

pyVHDLModel/Regions.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
3535
tbd.
3636
"""
37-
from typing import List, Dict, Iterable, Optional as Nullable
37+
from typing import List, Dict, Iterable, Optional as Nullable, Any
3838

3939
from pyTooling.Decorators import export, readonly
4040
from pyTooling.MetaClasses import ExtendedType
@@ -61,6 +61,7 @@ class ConcurrentDeclarationRegionMixin(metaclass=ExtendedType, mixin=True):
6161
# _subprograms: Dict[str, Dict[str, Subprogram]] #: Dictionary of all subprograms declared in this concurrent declaration region.
6262
_functions: Dict[str, Dict[str, Function]] #: Dictionary of all functions declared in this concurrent declaration region.
6363
_procedures: Dict[str, Dict[str, Procedure]] #: Dictionary of all procedures declared in this concurrent declaration region.
64+
_components: Dict[str, Any] #: Dictionary of all components declared in this concurrent declaration region.
6465

6566
def __init__(self, declaredItems: Nullable[Iterable] = None) -> None:
6667
# TODO: extract to mixin
@@ -80,6 +81,7 @@ def __init__(self, declaredItems: Nullable[Iterable] = None) -> None:
8081
# self._subprograms = {}
8182
self._functions = {}
8283
self._procedures = {}
84+
self._components = {}
8385

8486
@readonly
8587
def DeclaredItems(self) -> List:
@@ -125,6 +127,10 @@ def Functions(self) -> Dict[str, Dict[str, Function]]:
125127
def Procedures(self) -> Dict[str, Dict[str, Procedure]]:
126128
return self._procedures
127129

130+
@readonly
131+
def Components(self) -> Dict[str, Any]:
132+
return self._components
133+
128134
def IndexDeclaredItems(self) -> None:
129135
"""
130136
Index declared items listed in the concurrent declaration region.
@@ -155,6 +161,8 @@ def IndexDeclaredItems(self) -> None:
155161
:meth:`pyVHDLModel.Library._IndexOtherDeclaredItem`
156162
Iterate all packages in the library and index declared items.
157163
"""
164+
from pyVHDLModel.DesignUnit import Component
165+
158166
for item in self._declaredItems:
159167
if isinstance(item, FullType):
160168
self._types[item._normalizedIdentifier] = item
@@ -187,6 +195,9 @@ def IndexDeclaredItems(self) -> None:
187195
for normalizedIdentifier in item._normalizedIdentifiers:
188196
self._files[normalizedIdentifier] = item
189197
self._namespace._elements[normalizedIdentifier] = item
198+
elif isinstance(item, Component):
199+
self._components[item._normalizedIdentifier] = item
200+
self._namespace._elements[item._normalizedIdentifier] = item
190201
else:
191202
self._IndexOtherDeclaredItem(item)
192203

pyVHDLModel/STD.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
from pyVHDLModel.Base import Range, Direction
3737
from pyVHDLModel.Name import SimpleName
3838
from pyVHDLModel.Symbol import SimpleSubtypeSymbol
39-
from pyVHDLModel.Expression import EnumerationLiteral, IntegerLiteral, PhysicalIntegerLiteral
40-
from pyVHDLModel.Type import EnumeratedType, IntegerType, Subtype, PhysicalType, ArrayType
39+
from pyVHDLModel.Expression import EnumerationLiteral, IntegerLiteral, FloatingPointLiteral, PhysicalIntegerLiteral
40+
from pyVHDLModel.Type import EnumeratedType, IntegerType, RealType, PhysicalType, ArrayType, AccessType, Subtype
4141
from pyVHDLModel.Predefined import PredefinedLibrary, PredefinedPackage, PredefinedPackageBody
4242

4343

@@ -122,6 +122,9 @@ def __init__(self) -> None:
122122
self._declaredItems.append(integer)
123123

124124
# real
125+
real = RealType("real", Range(FloatingPointLiteral(-5.0), FloatingPointLiteral(5.0), Direction.To), None)
126+
self._types[real._normalizedIdentifier] = real
127+
self._declaredItems.append(real)
125128

126129
time = PhysicalType("time", Range(IntegerLiteral(-2**63), IntegerLiteral(2**63 - 1), Direction.To), primaryUnit="fs", units=(
127130
("ps", PhysicalIntegerLiteral(1000, "fs")),
@@ -155,6 +158,10 @@ def __init__(self) -> None:
155158
self._types[string._normalizedIdentifier] = string
156159
self._declaredItems.append(string)
157160

161+
line = AccessType("line", SimpleSubtypeSymbol(SimpleName("character")), None)
162+
self._types[line._normalizedIdentifier] = line
163+
self._declaredItems.append(line)
164+
158165
booleanVector = ArrayType("boolean_vector", (SimpleSubtypeSymbol(SimpleName("natural")),), SimpleSubtypeSymbol(SimpleName("boolean")), None)
159166
self._types[booleanVector._normalizedIdentifier] = booleanVector
160167
self._declaredItems.append(booleanVector)

0 commit comments

Comments
 (0)