aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2021-06-17 23:12:36 +0200
committerUnai Martinez-Corral <38422348+umarcor@users.noreply.github.com>2021-06-17 22:53:27 +0100
commit0c726ac36be1ad1cba24eb7eff476b9a32e643fb (patch)
tree524d81d4df412cca136b766305506574b34bf15e /pyGHDL
parente5891f3900f5e58df37d32c2c18a0f339c094cf4 (diff)
downloadghdl-0c726ac36be1ad1cba24eb7eff476b9a32e643fb.tar.gz
ghdl-0c726ac36be1ad1cba24eb7eff476b9a32e643fb.tar.bz2
ghdl-0c726ac36be1ad1cba24eb7eff476b9a32e643fb.zip
Black found more files - strange.
Executed black to make code unreadable. (cherry picked from commit 1b34c2368428b1ec295073ee47d201ac1def35f6)
Diffstat (limited to 'pyGHDL')
-rw-r--r--pyGHDL/dom/Common.py9
-rw-r--r--pyGHDL/dom/DesignUnit.py44
-rw-r--r--pyGHDL/dom/Expression.py101
-rw-r--r--pyGHDL/dom/InterfaceItem.py27
-rw-r--r--pyGHDL/dom/Literal.py9
-rw-r--r--pyGHDL/dom/Misc.py56
-rw-r--r--pyGHDL/dom/Object.py25
-rw-r--r--pyGHDL/dom/Range.py10
-rw-r--r--pyGHDL/dom/Symbol.py12
-rw-r--r--pyGHDL/dom/_Translate.py64
-rw-r--r--pyGHDL/dom/_Utils.py15
-rw-r--r--pyGHDL/dom/formatting/prettyprint.py201
-rw-r--r--pyGHDL/libghdl/__init__.py20
-rw-r--r--pyGHDL/libghdl/_decorator.py52
-rw-r--r--pyGHDL/libghdl/_types.py6
-rw-r--r--pyGHDL/libghdl/errorout_memory.py3
-rw-r--r--pyGHDL/libghdl/files_map.py12
-rw-r--r--pyGHDL/libghdl/files_map_editor.py41
-rw-r--r--pyGHDL/libghdl/flags.py6
-rw-r--r--pyGHDL/libghdl/libraries.py21
-rw-r--r--pyGHDL/libghdl/name_table.py10
-rw-r--r--pyGHDL/libghdl/vhdl/canon.py10
-rw-r--r--pyGHDL/libghdl/vhdl/flists.py5
-rw-r--r--pyGHDL/libghdl/vhdl/formatters.py8
-rw-r--r--pyGHDL/libghdl/vhdl/ieee.py14
-rw-r--r--pyGHDL/libghdl/vhdl/lists.py12
-rw-r--r--pyGHDL/libghdl/vhdl/nodes_utils.py2
-rw-r--r--pyGHDL/libghdl/vhdl/parse.py4
-rw-r--r--pyGHDL/libghdl/vhdl/scanner.py5
-rw-r--r--pyGHDL/libghdl/vhdl/sem_lib.py2
-rw-r--r--pyGHDL/libghdl/vhdl/std_package.py20
31 files changed, 530 insertions, 296 deletions
diff --git a/pyGHDL/dom/Common.py b/pyGHDL/dom/Common.py
index 88d0cdc8c..984f06e86 100644
--- a/pyGHDL/dom/Common.py
+++ b/pyGHDL/dom/Common.py
@@ -37,8 +37,8 @@
"""
from pydecor import export
-from pyGHDL import GHDLBaseException
-from pyGHDL.libghdl import LibGHDLException, errorout_memory
+from pyGHDL import GHDLBaseException
+from pyGHDL.libghdl import LibGHDLException, errorout_memory
__all__ = []
@@ -61,5 +61,6 @@ class GHDLMixin:
for i in range(errorCount):
print(errorout_memory.Get_Error_Message(i + 1))
- raise DOMException("Error in libghdl.") \
- from LibGHDLException("libghdl: Internal error 2.")
+ raise DOMException("Error in libghdl.") from LibGHDLException(
+ "libghdl: Internal error 2."
+ )
diff --git a/pyGHDL/dom/DesignUnit.py b/pyGHDL/dom/DesignUnit.py
index 9827cec24..dee86cab3 100644
--- a/pyGHDL/dom/DesignUnit.py
+++ b/pyGHDL/dom/DesignUnit.py
@@ -41,19 +41,24 @@ This module contains all DOM classes for VHDL's design units (:class:`context <E
"""
from pydecor import export
-from pyVHDLModel.VHDLModel import Entity as VHDLModel_Entity
-from pyVHDLModel.VHDLModel import Architecture as VHDLModel_Architecture
-from pyVHDLModel.VHDLModel import Package as VHDLModel_Package
-from pyVHDLModel.VHDLModel import PackageBody as VHDLModel_PackageBody
-from pyVHDLModel.VHDLModel import Context as VHDLModel_Context
+from pyVHDLModel.VHDLModel import Entity as VHDLModel_Entity
+from pyVHDLModel.VHDLModel import Architecture as VHDLModel_Architecture
+from pyVHDLModel.VHDLModel import Package as VHDLModel_Package
+from pyVHDLModel.VHDLModel import PackageBody as VHDLModel_PackageBody
+from pyVHDLModel.VHDLModel import Context as VHDLModel_Context
from pyVHDLModel.VHDLModel import Configuration as VHDLModel_Configuration
from pyGHDL.libghdl import utils
from pyGHDL.libghdl.vhdl import nodes
from pyGHDL.dom._Utils import NodeToName, GetIirKindOfNode
-from pyGHDL.dom._Translate import GetExpressionFromNode, GetSubtypeIndicationFromNode, GetGenericsFromChainedNodes, GetPortsFromChainedNodes, \
- GetDeclaredItemsFromChainedNodes
+from pyGHDL.dom._Translate import (
+ GetExpressionFromNode,
+ GetSubtypeIndicationFromNode,
+ GetGenericsFromChainedNodes,
+ GetPortsFromChainedNodes,
+ GetDeclaredItemsFromChainedNodes,
+)
from pyGHDL.dom.Common import GHDLMixin, DOMException
from pyGHDL.dom.Object import Constant, Signal
@@ -62,19 +67,22 @@ __all__ = []
@export
class Entity(VHDLModel_Entity, GHDLMixin):
-
@classmethod
def parse(cls, libraryUnit):
name = NodeToName(libraryUnit)
entity = cls(name)
- for generic in GetGenericsFromChainedNodes(nodes.Get_Generic_Chain(libraryUnit)):
+ for generic in GetGenericsFromChainedNodes(
+ nodes.Get_Generic_Chain(libraryUnit)
+ ):
entity.GenericItems.append(generic)
for port in GetPortsFromChainedNodes(nodes.Get_Port_Chain(libraryUnit)):
entity.PortItems.append(port)
- for item in GetDeclaredItemsFromChainedNodes(nodes.Get_Declaration_Chain(libraryUnit), "entity", name):
+ for item in GetDeclaredItemsFromChainedNodes(
+ nodes.Get_Declaration_Chain(libraryUnit), "entity", name
+ ):
entity.DeclaredItems.append(item)
return entity
@@ -94,7 +102,9 @@ class Architecture(VHDLModel_Architecture, GHDLMixin):
architecture = cls(name, entityName)
- for item in GetDeclaredItemsFromChainedNodes(nodes.Get_Declaration_Chain(libraryUnit), "architecture", name):
+ for item in GetDeclaredItemsFromChainedNodes(
+ nodes.Get_Declaration_Chain(libraryUnit), "architecture", name
+ ):
architecture.DeclaredItems.append(item)
return architecture
@@ -105,14 +115,15 @@ class Architecture(VHDLModel_Architecture, GHDLMixin):
@export
class Package(VHDLModel_Package, GHDLMixin):
-
@classmethod
def parse(cls, libraryUnit):
name = NodeToName(libraryUnit)
package = cls(name)
- for item in GetDeclaredItemsFromChainedNodes(nodes.Get_Declaration_Chain(libraryUnit), "package", name):
+ for item in GetDeclaredItemsFromChainedNodes(
+ nodes.Get_Declaration_Chain(libraryUnit), "package", name
+ ):
package.DeclaredItems.append(item)
return package
@@ -120,14 +131,15 @@ class Package(VHDLModel_Package, GHDLMixin):
@export
class PackageBody(VHDLModel_PackageBody, GHDLMixin):
-
@classmethod
def parse(cls, libraryUnit):
name = NodeToName(libraryUnit)
packageBody = cls(name)
- for item in GetDeclaredItemsFromChainedNodes(nodes.Get_Declaration_Chain(libraryUnit), "package body", name):
+ for item in GetDeclaredItemsFromChainedNodes(
+ nodes.Get_Declaration_Chain(libraryUnit), "package body", name
+ ):
packageBody.DeclaredItems.append(item)
return packageBody
@@ -135,7 +147,6 @@ class PackageBody(VHDLModel_PackageBody, GHDLMixin):
@export
class Context(VHDLModel_Context, GHDLMixin):
-
@classmethod
def parse(cls, libraryUnit):
name = NodeToName(libraryUnit)
@@ -144,7 +155,6 @@ class Context(VHDLModel_Context, GHDLMixin):
@export
class Configuration(VHDLModel_Configuration, GHDLMixin):
-
@classmethod
def parse(cls, libraryUnit):
name = NodeToName(libraryUnit)
diff --git a/pyGHDL/dom/Expression.py b/pyGHDL/dom/Expression.py
index 7f32e7d54..754b73304 100644
--- a/pyGHDL/dom/Expression.py
+++ b/pyGHDL/dom/Expression.py
@@ -32,85 +32,94 @@
# ============================================================================
from pydecor import export
-from pyVHDLModel.VHDLModel import \
- InverseExpression as VHDLModel_InverseExpression, \
- IdentityExpression as VHDLModel_IdentityExpression, \
- NegationExpression as VHDLModel_NegationExpression, \
- AbsoluteExpression as VHDLModel_AbsoluteExpression, \
- TypeConversion as VHDLModel_TypeConversion, \
- FunctionCall as VHDLModel_FunctionCall, \
- QualifiedExpression as VHDLModel_QualifiedExpression, \
- AdditionExpression as VHDLModel_AdditionExpression, \
- SubtractionExpression as VHDLModel_SubtractionExpression, \
- ConcatenationExpression as VHDLModel_ConcatenationExpression, \
- MultiplyExpression as VHDLModel_MultiplyExpression, \
- DivisionExpression as VHDLModel_DivisionExpression, \
- RemainderExpression as VHDLModel_RemainderExpression, \
- ModuloExpression as VHDLModel_ModuloExpression, \
- ExponentiationExpression as VHDLModel_ExponentiationExpression, \
- AndExpression as VHDLModel_AndExpression, \
- NandExpression as VHDLModel_NandExpression, \
- OrExpression as VHDLModel_OrExpression, \
- NorExpression as VHDLModel_NorExpression, \
- XorExpression as VHDLModel_XorExpression, \
- XnorExpression as VHDLModel_XnorExpression, \
- EqualExpression as VHDLModel_EqualExpression, \
- UnequalExpression as VHDLModel_UnequalExpression, \
- GreaterThanExpression as VHDLModel_GreaterThanExpression, \
- GreaterEqualExpression as VHDLModel_GreaterEqualExpression, \
- LessThanExpression as VHDLModel_LessThanExpression, \
- ShiftRightLogicExpression as VHDLModel_ShiftRightLogicExpression, \
- ShiftLeftLogicExpression as VHDLModel_ShiftLeftLogicExpression, \
- ShiftRightArithmeticExpression as VHDLModel_ShiftRightArithmeticExpression, \
- ShiftLeftArithmeticExpression as VHDLModel_ShiftLeftArithmeticExpression, \
- RotateRightExpression as VHDLModel_RotateRightExpression, \
- RotateLeftExpression as VHDLModel_RotateLeftExpression, \
- Expression
+from pyVHDLModel.VHDLModel import (
+ InverseExpression as VHDLModel_InverseExpression,
+ IdentityExpression as VHDLModel_IdentityExpression,
+ NegationExpression as VHDLModel_NegationExpression,
+ AbsoluteExpression as VHDLModel_AbsoluteExpression,
+ TypeConversion as VHDLModel_TypeConversion,
+ FunctionCall as VHDLModel_FunctionCall,
+ QualifiedExpression as VHDLModel_QualifiedExpression,
+ AdditionExpression as VHDLModel_AdditionExpression,
+ SubtractionExpression as VHDLModel_SubtractionExpression,
+ ConcatenationExpression as VHDLModel_ConcatenationExpression,
+ MultiplyExpression as VHDLModel_MultiplyExpression,
+ DivisionExpression as VHDLModel_DivisionExpression,
+ RemainderExpression as VHDLModel_RemainderExpression,
+ ModuloExpression as VHDLModel_ModuloExpression,
+ ExponentiationExpression as VHDLModel_ExponentiationExpression,
+ AndExpression as VHDLModel_AndExpression,
+ NandExpression as VHDLModel_NandExpression,
+ OrExpression as VHDLModel_OrExpression,
+ NorExpression as VHDLModel_NorExpression,
+ XorExpression as VHDLModel_XorExpression,
+ XnorExpression as VHDLModel_XnorExpression,
+ EqualExpression as VHDLModel_EqualExpression,
+ UnequalExpression as VHDLModel_UnequalExpression,
+ GreaterThanExpression as VHDLModel_GreaterThanExpression,
+ GreaterEqualExpression as VHDLModel_GreaterEqualExpression,
+ LessThanExpression as VHDLModel_LessThanExpression,
+ ShiftRightLogicExpression as VHDLModel_ShiftRightLogicExpression,
+ ShiftLeftLogicExpression as VHDLModel_ShiftLeftLogicExpression,
+ ShiftRightArithmeticExpression as VHDLModel_ShiftRightArithmeticExpression,
+ ShiftLeftArithmeticExpression as VHDLModel_ShiftLeftArithmeticExpression,
+ RotateRightExpression as VHDLModel_RotateRightExpression,
+ RotateLeftExpression as VHDLModel_RotateLeftExpression,
+ Expression,
+)
__all__ = []
+
@export
class InverseExpression(VHDLModel_InverseExpression):
def __init__(self, operand: Expression):
super().__init__()
self._operand = operand
+
@export
class IdentityExpression(VHDLModel_IdentityExpression):
def __init__(self, operand: Expression):
super().__init__()
self._operand = operand
+
@export
class NegationExpression(VHDLModel_NegationExpression):
def __init__(self, operand: Expression):
super().__init__()
self._operand = operand
+
@export
class AbsoluteExpression(VHDLModel_AbsoluteExpression):
def __init__(self, operand: Expression):
super().__init__()
self._operand = operand
+
@export
class TypeConversion(VHDLModel_TypeConversion):
def __init__(self, operand: Expression):
super().__init__()
self._operand = operand
+
@export
class FunctionCall(VHDLModel_FunctionCall):
def __init__(self, operand: Expression):
super().__init__()
self._operand = operand
+
@export
class QualifiedExpression(VHDLModel_QualifiedExpression):
def __init__(self, operand: Expression):
super().__init__()
self._operand = operand
+
@export
class AdditionExpression(VHDLModel_AdditionExpression):
def __init__(self, left: Expression, right: Expression):
@@ -118,6 +127,7 @@ class AdditionExpression(VHDLModel_AdditionExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class SubtractionExpression(VHDLModel_SubtractionExpression):
def __init__(self, left: Expression, right: Expression):
@@ -125,6 +135,7 @@ class SubtractionExpression(VHDLModel_SubtractionExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class ConcatenationExpression(VHDLModel_ConcatenationExpression):
def __init__(self, left: Expression, right: Expression):
@@ -132,6 +143,7 @@ class ConcatenationExpression(VHDLModel_ConcatenationExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class MultiplyExpression(VHDLModel_MultiplyExpression):
def __init__(self, left: Expression, right: Expression):
@@ -139,6 +151,7 @@ class MultiplyExpression(VHDLModel_MultiplyExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class DivisionExpression(VHDLModel_DivisionExpression):
def __init__(self, left: Expression, right: Expression):
@@ -146,6 +159,7 @@ class DivisionExpression(VHDLModel_DivisionExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class RemainderExpression(VHDLModel_RemainderExpression):
def __init__(self, left: Expression, right: Expression):
@@ -153,6 +167,7 @@ class RemainderExpression(VHDLModel_RemainderExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class ModuloExpression(VHDLModel_ModuloExpression):
def __init__(self, left: Expression, right: Expression):
@@ -160,6 +175,7 @@ class ModuloExpression(VHDLModel_ModuloExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class ExponentiationExpression(VHDLModel_ExponentiationExpression):
def __init__(self, left: Expression, right: Expression):
@@ -167,6 +183,7 @@ class ExponentiationExpression(VHDLModel_ExponentiationExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class AndExpression(VHDLModel_AndExpression):
def __init__(self, left: Expression, right: Expression):
@@ -174,6 +191,7 @@ class AndExpression(VHDLModel_AndExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class NandExpression(VHDLModel_NandExpression):
def __init__(self, left: Expression, right: Expression):
@@ -181,6 +199,7 @@ class NandExpression(VHDLModel_NandExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class OrExpression(VHDLModel_OrExpression):
def __init__(self, left: Expression, right: Expression):
@@ -188,6 +207,7 @@ class OrExpression(VHDLModel_OrExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class NorExpression(VHDLModel_NorExpression):
def __init__(self, left: Expression, right: Expression):
@@ -195,6 +215,7 @@ class NorExpression(VHDLModel_NorExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class XorExpression(VHDLModel_XorExpression):
def __init__(self, left: Expression, right: Expression):
@@ -202,6 +223,7 @@ class XorExpression(VHDLModel_XorExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class XnorExpression(VHDLModel_XnorExpression):
def __init__(self, left: Expression, right: Expression):
@@ -209,6 +231,7 @@ class XnorExpression(VHDLModel_XnorExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class EqualExpression(VHDLModel_EqualExpression):
def __init__(self, left: Expression, right: Expression):
@@ -216,6 +239,7 @@ class EqualExpression(VHDLModel_EqualExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class UnequalExpression(VHDLModel_UnequalExpression):
def __init__(self, left: Expression, right: Expression):
@@ -223,6 +247,7 @@ class UnequalExpression(VHDLModel_UnequalExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class GreaterThanExpression(VHDLModel_GreaterThanExpression):
def __init__(self, left: Expression, right: Expression):
@@ -230,6 +255,7 @@ class GreaterThanExpression(VHDLModel_GreaterThanExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class GreaterEqualExpression(VHDLModel_GreaterEqualExpression):
def __init__(self, left: Expression, right: Expression):
@@ -237,6 +263,7 @@ class GreaterEqualExpression(VHDLModel_GreaterEqualExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class LessThanExpression(VHDLModel_LessThanExpression):
def __init__(self, left: Expression, right: Expression):
@@ -244,6 +271,7 @@ class LessThanExpression(VHDLModel_LessThanExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class ShiftRightLogicExpression(VHDLModel_ShiftRightLogicExpression):
def __init__(self, left: Expression, right: Expression):
@@ -251,6 +279,7 @@ class ShiftRightLogicExpression(VHDLModel_ShiftRightLogicExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class ShiftLeftLogicExpression(VHDLModel_ShiftLeftLogicExpression):
def __init__(self, left: Expression, right: Expression):
@@ -258,6 +287,7 @@ class ShiftLeftLogicExpression(VHDLModel_ShiftLeftLogicExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class ShiftRightArithmeticExpression(VHDLModel_ShiftRightArithmeticExpression):
def __init__(self, left: Expression, right: Expression):
@@ -265,6 +295,7 @@ class ShiftRightArithmeticExpression(VHDLModel_ShiftRightArithmeticExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class ShiftLeftArithmeticExpression(VHDLModel_ShiftLeftArithmeticExpression):
def __init__(self, left: Expression, right: Expression):
@@ -272,6 +303,7 @@ class ShiftLeftArithmeticExpression(VHDLModel_ShiftLeftArithmeticExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class RotateRightExpression(VHDLModel_RotateRightExpression):
def __init__(self, left: Expression, right: Expression):
@@ -279,6 +311,7 @@ class RotateRightExpression(VHDLModel_RotateRightExpression):
self._leftOperand = left
self._rightOperand = right
+
@export
class RotateLeftExpression(VHDLModel_RotateLeftExpression):
def __init__(self, left: Expression, right: Expression):
diff --git a/pyGHDL/dom/InterfaceItem.py b/pyGHDL/dom/InterfaceItem.py
index 89427e3b4..028adc690 100644
--- a/pyGHDL/dom/InterfaceItem.py
+++ b/pyGHDL/dom/InterfaceItem.py
@@ -32,14 +32,17 @@
# ============================================================================
from pydecor import export
-from pyVHDLModel.VHDLModel import \
- GenericConstantInterfaceItem as VHDLModel_GenericConstantInterfaceItem, \
- PortSignalInterfaceItem as VHDLModel_PortSignalInterfaceItem, \
- Mode, SubTypeOrSymbol, Expression
+from pyVHDLModel.VHDLModel import (
+ GenericConstantInterfaceItem as VHDLModel_GenericConstantInterfaceItem,
+ PortSignalInterfaceItem as VHDLModel_PortSignalInterfaceItem,
+ Mode,
+ SubTypeOrSymbol,
+ Expression,
+)
-from pyGHDL.dom._Utils import NodeToName, GetModeOfNode
+from pyGHDL.dom._Utils import NodeToName, GetModeOfNode
from pyGHDL.dom._Translate import GetSubtypeIndicationFromNode
-from pyGHDL.dom.Common import GHDLMixin
+from pyGHDL.dom.Common import GHDLMixin
__all__ = []
@@ -56,10 +59,11 @@ class GenericConstantInterfaceItem(VHDLModel_GenericConstantInterfaceItem, GHDLM
return generic
- def __init__(self, name:str, mode: Mode, subType: SubTypeOrSymbol):
+ def __init__(self, name: str, mode: Mode, subType: SubTypeOrSymbol):
super().__init__(name=name, mode=mode)
self._subType = subType
+
@export
class PortSignalInterfaceItem(VHDLModel_PortSignalInterfaceItem, GHDLMixin):
@classmethod
@@ -72,8 +76,13 @@ class PortSignalInterfaceItem(VHDLModel_PortSignalInterfaceItem, GHDLMixin):
return port
- def __init__(self, name:str, mode: Mode, subType: SubTypeOrSymbol, defaultExpression: Expression = None):
+ def __init__(
+ self,
+ name: str,
+ mode: Mode,
+ subType: SubTypeOrSymbol,
+ defaultExpression: Expression = None,
+ ):
super().__init__(name=name, mode=mode)
self._subType = subType
self._defaultExpression = defaultExpression
-
diff --git a/pyGHDL/dom/Literal.py b/pyGHDL/dom/Literal.py
index 2ed1b5f65..562b188fd 100644
--- a/pyGHDL/dom/Literal.py
+++ b/pyGHDL/dom/Literal.py
@@ -32,10 +32,11 @@
# ============================================================================
from pydecor import export
-from pyVHDLModel.VHDLModel import \
- IntegerLiteral as VHDLModel_IntegerLiteral, \
- FloatingPointLiteral as VHDLModel_FloatingPointLiteral, \
- CharacterLiteral as VHDLModel_CharacterLiteral
+from pyVHDLModel.VHDLModel import (
+ IntegerLiteral as VHDLModel_IntegerLiteral,
+ FloatingPointLiteral as VHDLModel_FloatingPointLiteral,
+ CharacterLiteral as VHDLModel_CharacterLiteral,
+)
__all__ = []
diff --git a/pyGHDL/dom/Misc.py b/pyGHDL/dom/Misc.py
index 0f26119a2..837234a9a 100644
--- a/pyGHDL/dom/Misc.py
+++ b/pyGHDL/dom/Misc.py
@@ -36,22 +36,35 @@
Add a module documentation.
"""
from pathlib import Path
-from typing import Any
+from typing import Any
import pyGHDL.libghdl.utils
from pydecor import export
from pyGHDL.dom._Utils import GetIirKindOfNode
-from pyVHDLModel.VHDLModel import Design as VHDLModel_Design
-from pyVHDLModel.VHDLModel import Library as VHDLModel_Library
-from pyVHDLModel.VHDLModel import Document as VHDLModel_Document
-
-import pyGHDL.libghdl as libghdl
-from pyGHDL.libghdl import name_table, files_map, errorout_memory, LibGHDLException, utils
-from pyGHDL.libghdl.vhdl import nodes, sem_lib
-
-from pyGHDL.dom.Common import DOMException, GHDLMixin
-from pyGHDL.dom.DesignUnit import Entity, Architecture, Package, PackageBody, Context, Configuration
+from pyVHDLModel.VHDLModel import Design as VHDLModel_Design
+from pyVHDLModel.VHDLModel import Library as VHDLModel_Library
+from pyVHDLModel.VHDLModel import Document as VHDLModel_Document
+
+import pyGHDL.libghdl as libghdl
+from pyGHDL.libghdl import (
+ name_table,
+ files_map,
+ errorout_memory,
+ LibGHDLException,
+ utils,
+)
+from pyGHDL.libghdl.vhdl import nodes, sem_lib
+
+from pyGHDL.dom.Common import DOMException, GHDLMixin
+from pyGHDL.dom.DesignUnit import (
+ Entity,
+ Architecture,
+ Package,
+ PackageBody,
+ Context,
+ Configuration,
+)
__all__ = []
@@ -95,13 +108,15 @@ class Document(VHDLModel_Document, GHDLMixin):
GHDLMixin.__init__(self)
self.__ghdl_init()
- if (dontParse == False):
+ if dontParse == False:
self.parse()
def __ghdl_init(self):
# Read input file
self.__ghdlFileID = name_table.Get_Identifier(str(self.Path))
- self.__ghdlSourceFileEntry = files_map.Read_Source_File(name_table.Null_Identifier, self.__ghdlFileID)
+ self.__ghdlSourceFileEntry = files_map.Read_Source_File(
+ name_table.Null_Identifier, self.__ghdlFileID
+ )
if self.__ghdlSourceFileEntry == files_map.No_Source_File_Entry:
raise LibGHDLException("Cannot load file '{!s}'".format(self.Path))
@@ -119,32 +134,33 @@ class Document(VHDLModel_Document, GHDLMixin):
libraryUnit = nodes.Get_Library_Unit(unit)
nodeKind = GetIirKindOfNode(libraryUnit)
- if (nodeKind == nodes.Iir_Kind.Entity_Declaration):
+ if nodeKind == nodes.Iir_Kind.Entity_Declaration:
entity = Entity.parse(libraryUnit)
self.Entities.append(entity)
- elif (nodeKind == nodes.Iir_Kind.Architecture_Body):
+ elif nodeKind == nodes.Iir_Kind.Architecture_Body:
architecture = Architecture.parse(libraryUnit)
self.Architectures.append(architecture)
- elif (nodeKind == nodes.Iir_Kind.Package_Declaration):
+ elif nodeKind == nodes.Iir_Kind.Package_Declaration:
package = Package.parse(libraryUnit)
self.Packages.append(package)
- elif (nodeKind == nodes.Iir_Kind.Package_Body):
+ elif nodeKind == nodes.Iir_Kind.Package_Body:
packageBody = PackageBody.parse(libraryUnit)
self.PackageBodies.append(packageBody)
- elif (nodeKind == nodes.Iir_Kind.Context_Declaration):
+ elif nodeKind == nodes.Iir_Kind.Context_Declaration:
context = Context.parse(libraryUnit)
self.Contexts.append(context)
- elif (nodeKind == nodes.Iir_Kind.Configuration_Declaration):
+ elif nodeKind == nodes.Iir_Kind.Configuration_Declaration:
configuration = Configuration.parse(libraryUnit)
self.Configurations.append(configuration)
else:
raise DOMException(
"Unknown design unit kind '{kindName}'({kind}).".format(
- kindName=nodeKind.name, kind=nodeKind)
+ kindName=nodeKind.name, kind=nodeKind
+ )
)
diff --git a/pyGHDL/dom/Object.py b/pyGHDL/dom/Object.py
index 924c28662..f719cbed5 100644
--- a/pyGHDL/dom/Object.py
+++ b/pyGHDL/dom/Object.py
@@ -32,18 +32,22 @@
# ============================================================================
from pydecor import export
-from pyVHDLModel.VHDLModel import \
- Constant as VHDLModel_Constant, \
- Variable as VHDLModel_Variable, \
- Signal as VHDLModel_Signal, \
- Expression, SubTypeOrSymbol
+from pyVHDLModel.VHDLModel import (
+ Constant as VHDLModel_Constant,
+ Variable as VHDLModel_Variable,
+ Signal as VHDLModel_Signal,
+ Expression,
+ SubTypeOrSymbol,
+)
__all__ = []
@export
class Constant(VHDLModel_Constant):
- def __init__(self, name: str, subType: SubTypeOrSymbol, defaultExpression: Expression):
+ def __init__(
+ self, name: str, subType: SubTypeOrSymbol, defaultExpression: Expression
+ ):
super().__init__(name)
self._name = name
@@ -53,7 +57,9 @@ class Constant(VHDLModel_Constant):
@export
class Variable(VHDLModel_Variable):
- def __init__(self, name: str, subType: SubTypeOrSymbol, defaultExpression: Expression):
+ def __init__(
+ self, name: str, subType: SubTypeOrSymbol, defaultExpression: Expression
+ ):
super().__init__(name)
self._name = name
@@ -63,10 +69,11 @@ class Variable(VHDLModel_Variable):
@export
class Signal(VHDLModel_Signal):
- def __init__(self, name: str, subType: SubTypeOrSymbol, defaultExpression: Expression):
+ def __init__(
+ self, name: str, subType: SubTypeOrSymbol, defaultExpression: Expression
+ ):
super().__init__(name)
self._name = name
self._subType = subType
self._defaultExpression = defaultExpression
-
diff --git a/pyGHDL/dom/Range.py b/pyGHDL/dom/Range.py
index 45675cd19..1a5ac518c 100644
--- a/pyGHDL/dom/Range.py
+++ b/pyGHDL/dom/Range.py
@@ -32,10 +32,12 @@
# ============================================================================
from pydecor import export
-from pyVHDLModel.VHDLModel import \
- Range as VHDLModel_Range, \
- RangeExpression as VHDLModel_RangeExpression, \
- Direction, Expression
+from pyVHDLModel.VHDLModel import (
+ Range as VHDLModel_Range,
+ RangeExpression as VHDLModel_RangeExpression,
+ Direction,
+ Expression,
+)
__all__ = []
diff --git a/pyGHDL/dom/Symbol.py b/pyGHDL/dom/Symbol.py
index 9b765872d..09774a634 100644
--- a/pyGHDL/dom/Symbol.py
+++ b/pyGHDL/dom/Symbol.py
@@ -34,11 +34,12 @@ from pydecor import export
from typing import List
-from pyVHDLModel.VHDLModel import \
- SimpleSubTypeSymbol as VHDLModel_SimpleSubTypeSymbol, \
- ConstrainedSubTypeSymbol as VHDLModel_ConstrainedSubTypeSymbol, \
- SimpleObjectSymbol as VHDLModel_SimpleObjectSymbol, \
- Constraint
+from pyVHDLModel.VHDLModel import (
+ SimpleSubTypeSymbol as VHDLModel_SimpleSubTypeSymbol,
+ ConstrainedSubTypeSymbol as VHDLModel_ConstrainedSubTypeSymbol,
+ SimpleObjectSymbol as VHDLModel_SimpleObjectSymbol,
+ Constraint,
+)
__all__ = []
@@ -54,6 +55,7 @@ class ConstrainedSubTypeSymbol(VHDLModel_ConstrainedSubTypeSymbol):
def __init__(self, subTypeName: str, constraints: List[Constraint] = None):
super().__init__(subTypeName=subTypeName, constraints=constraints)
+
@export
class SimpleObjectSymbol(VHDLModel_SimpleObjectSymbol):
def __init__(self, symbolName: str):
diff --git a/pyGHDL/dom/_Translate.py b/pyGHDL/dom/_Translate.py
index e93b20b07..9435010ab 100644
--- a/pyGHDL/dom/_Translate.py
+++ b/pyGHDL/dom/_Translate.py
@@ -5,14 +5,25 @@ from pydecor import export
from pyVHDLModel.VHDLModel import Constraint, Direction, Expression, SubTypeOrSymbol
from pyGHDL.libghdl import utils, name_table
-from pyGHDL.libghdl.utils import flist_iter
-from pyGHDL.libghdl.vhdl import nodes
-from pyGHDL.dom._Utils import NodeToName, GetIirKindOfNode
-from pyGHDL.dom.Common import DOMException
-from pyGHDL.dom.Range import Range, RangeExpression
-from pyGHDL.dom.Symbol import SimpleObjectSymbol, SimpleSubTypeSymbol, ConstrainedSubTypeSymbol
+from pyGHDL.libghdl.utils import flist_iter
+from pyGHDL.libghdl.vhdl import nodes
+from pyGHDL.dom._Utils import NodeToName, GetIirKindOfNode
+from pyGHDL.dom.Common import DOMException
+from pyGHDL.dom.Range import Range, RangeExpression
+from pyGHDL.dom.Symbol import (
+ SimpleObjectSymbol,
+ SimpleSubTypeSymbol,
+ ConstrainedSubTypeSymbol,
+)
from pyGHDL.dom.Literal import IntegerLiteral, CharacterLiteral, FloatingPointLiteral
-from pyGHDL.dom.Expression import SubtractionExpression, AdditionExpression, MultiplyExpression, DivisionExpression, InverseExpression, ExponentiationExpression
+from pyGHDL.dom.Expression import (
+ SubtractionExpression,
+ AdditionExpression,
+ MultiplyExpression,
+ DivisionExpression,
+ InverseExpression,
+ ExponentiationExpression,
+)
__all__ = []
@@ -22,29 +33,32 @@ def GetSubtypeIndicationFromNode(node, entity: str, name: str) -> SubTypeOrSymbo
subTypeIndication = nodes.Get_Subtype_Indication(node)
subTypeKind = GetIirKindOfNode(subTypeIndication)
- if (subTypeKind == nodes.Iir_Kind.Simple_Name):
+ if subTypeKind == nodes.Iir_Kind.Simple_Name:
subTypeName = NodeToName(subTypeIndication)
subType = SimpleSubTypeSymbol(subTypeName)
- elif (subTypeKind == nodes.Iir_Kind.Array_Subtype_Definition):
+ elif subTypeKind == nodes.Iir_Kind.Array_Subtype_Definition:
typeMark = nodes.Get_Subtype_Type_Mark(subTypeIndication)
typeMarkName = NodeToName(typeMark)
constraints = GetArrayConstraintsFromSubtypeIndication(subTypeIndication)
subType = ConstrainedSubTypeSymbol(typeMarkName, constraints)
- elif (subTypeKind == nodes.Iir_Kind.Subtype_Definition):
+ elif subTypeKind == nodes.Iir_Kind.Subtype_Definition:
raise DOMException(
"Unknown handling of subtype kind '{kind}' of subtype indication '{indication}' while parsing {entity} '{name}'.".format(
- kind=subTypeKind, indication=subTypeIndication, entity=entity, name=name)
+ kind=subTypeKind, indication=subTypeIndication, entity=entity, name=name
+ )
)
else:
raise DOMException(
"Unknown subtype kind '{kind}' of subtype indication '{indication}' while parsing {entity} '{name}'.".format(
- kind=subTypeKind, indication=subTypeIndication, entity=entity, name=name)
+ kind=subTypeKind, indication=subTypeIndication, entity=entity, name=name
+ )
)
return subType
+
@export
def GetArrayConstraintsFromSubtypeIndication(subTypeIndication) -> List[Constraint]:
constraints = []
@@ -58,7 +72,7 @@ def GetArrayConstraintsFromSubtypeIndication(subTypeIndication) -> List[Constrai
r = Range(
GetExpressionFromNode(leftBound),
GetExpressionFromNode(rightBound),
- Direction.DownTo if direction else Direction.To
+ Direction.DownTo if direction else Direction.To,
)
constraints.append(RangeExpression(r))
elif constraintKind == nodes.Iir_Kind.Attribute_Name:
@@ -68,7 +82,10 @@ def GetArrayConstraintsFromSubtypeIndication(subTypeIndication) -> List[Constrai
else:
raise DOMException(
"Unknown constraint kind '{kind}' for constraint '{constraint}' in subtype indication '{indication}'.".format(
- kind=constraintKind, constraint=constraint, indication=subTypeIndication)
+ kind=constraintKind,
+ constraint=constraint,
+ indication=subTypeIndication,
+ )
)
return constraints
@@ -117,9 +134,11 @@ def GetExpressionFromNode(node) -> Expression:
else:
raise DOMException(
"Unknown expression kind '{kindName}'({kind}) in expression '{expr}'.".format(
- kind=kind, kindName=kind.name, expr=node)
+ kind=kind, kindName=kind.name, expr=node
+ )
)
+
# FIXME: rewrite to generator
@export
def GetGenericsFromChainedNodes(nodeChain):
@@ -135,11 +154,13 @@ def GetGenericsFromChainedNodes(nodeChain):
else:
raise DOMException(
"Unknown generic kind '{kindName}'({kind}) in generic '{generic}'.".format(
- kind=kind, kindName=kind.name, generic=generic)
+ kind=kind, kindName=kind.name, generic=generic
+ )
)
return result
+
# FIXME: rewrite to generator
@export
def GetPortsFromChainedNodes(nodeChain):
@@ -155,11 +176,13 @@ def GetPortsFromChainedNodes(nodeChain):
else:
raise DOMException(
"Unknown port kind '{kindName}'({kind}) in port '{port}'.".format(
- kind=kind, kindName=kind.name, port=port)
+ kind=kind, kindName=kind.name, port=port
+ )
)
return result
+
def GetDeclaredItemsFromChainedNodes(nodeChain, entity: str, name: str):
result = []
for item in utils.chain_iter(nodeChain):
@@ -168,7 +191,9 @@ def GetDeclaredItemsFromChainedNodes(nodeChain, entity: str, name: str):
from pyGHDL.dom.Object import Constant
constantName = NodeToName(item)
- subTypeIndication = GetSubtypeIndicationFromNode(item, "constant", constantName)
+ subTypeIndication = GetSubtypeIndicationFromNode(
+ item, "constant", constantName
+ )
defaultExpression = GetExpressionFromNode(nodes.Get_Default_Value(item))
constant = Constant(constantName, subTypeIndication, defaultExpression)
@@ -202,7 +227,8 @@ def GetDeclaredItemsFromChainedNodes(nodeChain, entity: str, name: str):
else:
raise DOMException(
"Unknown declared item kind '{kindName}'({kind}) in {entity} '{name}'.".format(
- kind=kind, kindName=kind.name, entity=entity, name=name)
+ kind=kind, kindName=kind.name, entity=entity, name=name
+ )
)
return result
diff --git a/pyGHDL/dom/_Utils.py b/pyGHDL/dom/_Utils.py
index f0c838517..b74bdfa96 100644
--- a/pyGHDL/dom/_Utils.py
+++ b/pyGHDL/dom/_Utils.py
@@ -1,21 +1,22 @@
from pydecor import export
-from pyVHDLModel.VHDLModel import Mode
+from pyVHDLModel.VHDLModel import Mode
-from pyGHDL.libghdl import LibGHDLException, name_table
+from pyGHDL.libghdl import LibGHDLException, name_table
from pyGHDL.libghdl.vhdl import nodes
__all__ = []
__MODE_TRANSLATION = {
- nodes.Iir_Mode.In_Mode: Mode.In,
- nodes.Iir_Mode.Out_Mode: Mode.Out,
- nodes.Iir_Mode.Inout_Mode: Mode.InOut,
- nodes.Iir_Mode.Buffer_Mode: Mode.Buffer,
- nodes.Iir_Mode.Linkage_Mode: Mode.Linkage
+ nodes.Iir_Mode.In_Mode: Mode.In,
+ nodes.Iir_Mode.Out_Mode: Mode.Out,
+ nodes.Iir_Mode.Inout_Mode: Mode.InOut,
+ nodes.Iir_Mode.Buffer_Mode: Mode.Buffer,
+ nodes.Iir_Mode.Linkage_Mode: Mode.Linkage,
}
+
@export
def GetIirKindOfNode(node) -> nodes.Iir_Kind:
kind: int = nodes.Get_Kind(node)
diff --git a/pyGHDL/dom/formatting/prettyprint.py b/pyGHDL/dom/formatting/prettyprint.py
index a64f2a4f5..387706cac 100644
--- a/pyGHDL/dom/formatting/prettyprint.py
+++ b/pyGHDL/dom/formatting/prettyprint.py
@@ -3,53 +3,83 @@ from typing import List, Union
from pydecor import export
from pyGHDL.dom.Object import Constant, Signal
-from pyVHDLModel.VHDLModel import GenericInterfaceItem, Expression, Direction, Mode, NamedEntity, PortInterfaceItem, BinaryExpression, IdentityExpression, \
- UnaryExpression
+from pyVHDLModel.VHDLModel import (
+ GenericInterfaceItem,
+ Expression,
+ Direction,
+ Mode,
+ NamedEntity,
+ PortInterfaceItem,
+ BinaryExpression,
+ IdentityExpression,
+ UnaryExpression,
+)
from pyGHDL import GHDLBaseException
from pyGHDL.dom.Misc import Document
-from pyGHDL.dom.DesignUnit import Entity, Architecture, Package, PackageBody, Configuration, Context
-from pyGHDL.dom.InterfaceItem import GenericConstantInterfaceItem, PortSignalInterfaceItem
-from pyGHDL.dom.Symbol import SimpleSubTypeSymbol, ConstrainedSubTypeSymbol, SimpleObjectSymbol
+from pyGHDL.dom.DesignUnit import (
+ Entity,
+ Architecture,
+ Package,
+ PackageBody,
+ Configuration,
+ Context,
+)
+from pyGHDL.dom.InterfaceItem import (
+ GenericConstantInterfaceItem,
+ PortSignalInterfaceItem,
+)
+from pyGHDL.dom.Symbol import (
+ SimpleSubTypeSymbol,
+ ConstrainedSubTypeSymbol,
+ SimpleObjectSymbol,
+)
from pyGHDL.dom.Literal import IntegerLiteral, CharacterLiteral, FloatingPointLiteral
-from pyGHDL.dom.Expression import SubtractionExpression, AdditionExpression, MultiplyExpression, DivisionExpression, InverseExpression, AbsoluteExpression, \
- NegationExpression, ExponentiationExpression
+from pyGHDL.dom.Expression import (
+ SubtractionExpression,
+ AdditionExpression,
+ MultiplyExpression,
+ DivisionExpression,
+ InverseExpression,
+ AbsoluteExpression,
+ NegationExpression,
+ ExponentiationExpression,
+)
StringBuffer = List[str]
-DirectionTranslation = {
- Direction.To: "to",
- Direction.DownTo: "downto"
-}
+DirectionTranslation = {Direction.To: "to", Direction.DownTo: "downto"}
ModeTranslation = {
- Mode.In: "in",
- Mode.Out: "out",
- Mode.InOut: "inout",
- Mode.Buffer: "buffer",
- Mode.Linkage: "linkage"
+ Mode.In: "in",
+ Mode.Out: "out",
+ Mode.InOut: "inout",
+ Mode.Buffer: "buffer",
+ Mode.Linkage: "linkage",
}
UnaryExpressionTranslation = {
- IdentityExpression: " +",
- NegationExpression: " -",
- InverseExpression: "not ",
- AbsoluteExpression: "abs ",
+ IdentityExpression: " +",
+ NegationExpression: " -",
+ InverseExpression: "not ",
+ AbsoluteExpression: "abs ",
}
BinaryExpressionTranslation = {
- AdditionExpression: " + ",
- SubtractionExpression: " - ",
- MultiplyExpression: " * ",
- DivisionExpression: " / ",
- ExponentiationExpression: "**"
+ AdditionExpression: " + ",
+ SubtractionExpression: " - ",
+ MultiplyExpression: " * ",
+ DivisionExpression: " / ",
+ ExponentiationExpression: "**",
}
+
@export
class PrettyPrintException(GHDLBaseException):
pass
+
@export
class PrettyPrint:
# _buffer: StringBuffer
@@ -60,30 +90,32 @@ class PrettyPrint:
def formatDocument(self, document: Document, level: int = 0) -> StringBuffer:
buffer = []
prefix = " " * level
- buffer.append("{prefix}Document '{doc!s}':".format(doc=document.Path, prefix=prefix))
+ buffer.append(
+ "{prefix}Document '{doc!s}':".format(doc=document.Path, prefix=prefix)
+ )
buffer.append("{prefix} Entities:".format(prefix=prefix))
for entity in document.Entities:
- for line in self.formatEntity(entity, level+1):
+ for line in self.formatEntity(entity, level + 1):
buffer.append(line)
buffer.append("{prefix} Architectures:".format(prefix=prefix))
for architecture in document.Architectures:
- for line in self.formatArchitecture(architecture, level+1):
+ for line in self.formatArchitecture(architecture, level + 1):
buffer.append(line)
buffer.append("{prefix} Packages:".format(prefix=prefix))
for package in document.Packages:
- for line in self.formatPackage(package, level+1):
+ for line in self.formatPackage(package, level + 1):
buffer.append(line)
buffer.append("{prefix} PackageBodies:".format(prefix=prefix))
for packageBodies in document.PackageBodies:
- for line in self.formatPackageBody(packageBodies, level+1):
+ for line in self.formatPackageBody(packageBodies, level + 1):
buffer.append(line)
buffer.append("{prefix} Configurations:".format(prefix=prefix))
for configuration in document.Configurations:
- for line in self.formatConfiguration(configuration, level+1):
+ for line in self.formatConfiguration(configuration, level + 1):
buffer.append(line)
buffer.append("{prefix} Contexts:".format(prefix=prefix))
for context in document.Contexts:
- for line in self.formatContext(context, level+1):
+ for line in self.formatContext(context, level + 1):
buffer.append(line)
return buffer
@@ -107,7 +139,9 @@ class PrettyPrint:
return buffer
- def formatArchitecture(self, architecture: Architecture, level: int = 0) -> StringBuffer:
+ def formatArchitecture(
+ self, architecture: Architecture, level: int = 0
+ ) -> StringBuffer:
buffer = []
prefix = " " * level
buffer.append("{prefix}- {name}".format(name=architecture.Name, prefix=prefix))
@@ -129,7 +163,9 @@ class PrettyPrint:
return buffer
- def formatPackageBody(self, packageBody: PackageBody, level: int = 0) -> StringBuffer:
+ def formatPackageBody(
+ self, packageBody: PackageBody, level: int = 0
+ ) -> StringBuffer:
buffer = []
prefix = " " * level
buffer.append("{prefix}- {name}".format(name=packageBody.Name, prefix=prefix))
@@ -140,7 +176,9 @@ class PrettyPrint:
return buffer
- def formatConfiguration(self, configuration: Configuration, level: int = 0) -> StringBuffer:
+ def formatConfiguration(
+ self, configuration: Configuration, level: int = 0
+ ) -> StringBuffer:
buffer = []
prefix = " " * level
buffer.append("{prefix}- {name}".format(name=configuration.Name, prefix=prefix))
@@ -154,19 +192,29 @@ class PrettyPrint:
return buffer
- def formatGeneric(self, generic: Union[NamedEntity, GenericInterfaceItem], level: int = 0) -> StringBuffer:
+ def formatGeneric(
+ self, generic: Union[NamedEntity, GenericInterfaceItem], level: int = 0
+ ) -> StringBuffer:
if isinstance(generic, GenericConstantInterfaceItem):
return self.formatGenericConstant(generic, level)
else:
- raise PrettyPrintException("Unhandled generic kind for generic '{name}'.".format(name=generic.Name))
+ raise PrettyPrintException(
+ "Unhandled generic kind for generic '{name}'.".format(name=generic.Name)
+ )
- def formatPort(self, port: Union[NamedEntity, PortInterfaceItem], level: int = 0) -> StringBuffer:
+ def formatPort(
+ self, port: Union[NamedEntity, PortInterfaceItem], level: int = 0
+ ) -> StringBuffer:
if isinstance(port, PortSignalInterfaceItem):
return self.formatPortSignal(port, level)
else:
- raise PrettyPrintException("Unhandled port kind for port '{name}'.".format(name=port.Name))
+ raise PrettyPrintException(
+ "Unhandled port kind for port '{name}'.".format(name=port.Name)
+ )
- def formatGenericConstant(self, generic: GenericConstantInterfaceItem, level: int = 0) -> StringBuffer:
+ def formatGenericConstant(
+ self, generic: GenericConstantInterfaceItem, level: int = 0
+ ) -> StringBuffer:
buffer = []
prefix = " " * level
subType = generic.SubType
@@ -176,7 +224,7 @@ class PrettyPrint:
prefix=prefix,
name=generic.Name,
mode=ModeTranslation[generic.Mode],
- type=subType.SymbolName
+ type=subType.SymbolName,
)
)
elif isinstance(subType, ConstrainedSubTypeSymbol):
@@ -187,19 +235,31 @@ class PrettyPrint:
mode=ModeTranslation[generic.Mode],
type=subType.SymbolName,
constraints=", ".join(
- ["{left} {dir} {right}".format(
- left=self.formatExpression(constraint.Range.LeftBound),
- right=self.formatExpression(constraint.Range.RightBound),
- dir=DirectionTranslation[constraint.Range.Direction])
- for constraint in subType.Constraints])
+ [
+ "{left} {dir} {right}".format(
+ left=self.formatExpression(constraint.Range.LeftBound),
+ right=self.formatExpression(
+ constraint.Range.RightBound
+ ),
+ dir=DirectionTranslation[constraint.Range.Direction],
+ )
+ for constraint in subType.Constraints
+ ]
+ ),
)
)
else:
- raise PrettyPrintException("Unhandled constraint kind for generic '{name}'.".format(name=generic.Name))
+ raise PrettyPrintException(
+ "Unhandled constraint kind for generic '{name}'.".format(
+ name=generic.Name
+ )
+ )
return buffer
- def formatPortSignal(self, port: PortSignalInterfaceItem, level: int = 0) -> StringBuffer:
+ def formatPortSignal(
+ self, port: PortSignalInterfaceItem, level: int = 0
+ ) -> StringBuffer:
buffer = []
prefix = " " * level
@@ -208,7 +268,9 @@ class PrettyPrint:
prefix=prefix,
name=port.Name,
mode=ModeTranslation[port.Mode],
- subtypeindication=self.formatSubtypeIndication(port.SubType, "port", port.Name)
+ subtypeindication=self.formatSubtypeIndication(
+ port.SubType, "port", port.Name
+ ),
)
)
@@ -223,8 +285,10 @@ class PrettyPrint:
"{prefix}- constant {name} : {subtype} := {expr}".format(
prefix=prefix,
name=item.Name,
- subtype=self.formatSubtypeIndication(item.SubType, "constant", item.Name),
- expr=self.formatExpression(item.DefaultExpression)
+ subtype=self.formatSubtypeIndication(
+ item.SubType, "constant", item.Name
+ ),
+ expr=self.formatExpression(item.DefaultExpression),
)
)
elif isinstance(item, Signal):
@@ -232,10 +296,14 @@ class PrettyPrint:
"{prefix}- signal {name} : {subtype}{initValue}".format(
prefix=prefix,
name=item.Name,
- subtype=self.formatSubtypeIndication(item.SubType, "signal", item.Name),
+ subtype=self.formatSubtypeIndication(
+ item.SubType, "signal", item.Name
+ ),
initValue=" := {expr}".format(
expr=self.formatExpression(item.DefaultExpression)
- ) if item.DefaultExpression is not None else ""
+ )
+ if item.DefaultExpression is not None
+ else "",
)
)
else:
@@ -248,19 +316,25 @@ class PrettyPrint:
return "{type}".format(type=subTypeIndication.SymbolName)
elif isinstance(subTypeIndication, ConstrainedSubTypeSymbol):
constraints = ", ".join(
- ["{left} {dir} {right}".format(
- left=self.formatExpression(constraint.Range.LeftBound),
- right=self.formatExpression(constraint.Range.RightBound),
- dir=DirectionTranslation[constraint.Range.Direction]
- ) for constraint in subTypeIndication.Constraints]
+ [
+ "{left} {dir} {right}".format(
+ left=self.formatExpression(constraint.Range.LeftBound),
+ right=self.formatExpression(constraint.Range.RightBound),
+ dir=DirectionTranslation[constraint.Range.Direction],
+ )
+ for constraint in subTypeIndication.Constraints
+ ]
)
return "{type}({constraints})".format(
- type=subTypeIndication.SymbolName,
- constraints=constraints
+ type=subTypeIndication.SymbolName, constraints=constraints
)
else:
- raise PrettyPrintException("Unhandled constraint kind for {entity} '{name}'.".format(entity=entity, name=name))
+ raise PrettyPrintException(
+ "Unhandled constraint kind for {entity} '{name}'.".format(
+ entity=entity, name=name
+ )
+ )
def formatExpression(self, expression: Expression) -> str:
if isinstance(expression, SimpleObjectSymbol):
@@ -278,8 +352,7 @@ class PrettyPrint:
raise PrettyPrintException("Unhandled operator for unary expression.")
return "{operator}{operand}".format(
- operand=self.formatExpression(expression.Operand),
- operator=operator
+ operand=self.formatExpression(expression.Operand), operator=operator
)
elif isinstance(expression, BinaryExpression):
try:
@@ -290,7 +363,7 @@ class PrettyPrint:
return "{left}{operator}{right}".format(
left=self.formatExpression(expression.LeftOperand),
right=self.formatExpression(expression.RightOperand),
- operator=operator
+ operator=operator,
)
else:
raise PrettyPrintException("Unhandled expression kind.")
diff --git a/pyGHDL/libghdl/__init__.py b/pyGHDL/libghdl/__init__.py
index 1d1701aaa..1477d9361 100644
--- a/pyGHDL/libghdl/__init__.py
+++ b/pyGHDL/libghdl/__init__.py
@@ -42,10 +42,15 @@ from pydecor import export
from pyGHDL import GHDLBaseException
from pyGHDL.libghdl._types import Iir
-#from pyGHDL.libghdl._decorator import BindToLibGHDL
+
+# from pyGHDL.libghdl._decorator import BindToLibGHDL
from pyGHDL.libghdl.version import __version__
+class LibGHDLException(GHDLBaseException):
+ pass
+
+
def _get_libghdl_name() -> Path:
"""Get the name of the libghdl library (with version and extension)"""
ver = __version__.replace("-", "_").replace(".", "_")
@@ -159,7 +164,7 @@ def finalize() -> None:
@export
-#@BindToLibGHDL("options__initialize")
+# @BindToLibGHDL("options__initialize")
def initialize() -> None:
"""Initialize or re-initialize the shared library."""
libghdl.options__initialize()
@@ -179,7 +184,7 @@ def set_option(Opt: str) -> bool:
@export
-#@BindToLibGHDL("libghdl__analyze_init")
+# @BindToLibGHDL("libghdl__analyze_init")
def analyze_init() -> None:
"""
Initialize the analyzer.
@@ -191,7 +196,7 @@ def analyze_init() -> None:
@export
-#@BindToLibGHDL("libghdl__analyze_init_status")
+# @BindToLibGHDL("libghdl__analyze_init_status")
def analyze_init_status() -> int:
"""
Initialize the analyzer.
@@ -215,12 +220,7 @@ def analyze_file(fname: str) -> Iir:
@export
-#@BindToLibGHDL("ghdllocal__disp_config_prefixes")
+# @BindToLibGHDL("ghdllocal__disp_config_prefixes")
def disp_config() -> None:
"""Display the configured prefixes for libghdl."""
libghdl.ghdllocal__disp_config_prefixes()
-
-
-@export
-class LibGHDLException(GHDLBaseException):
- pass
diff --git a/pyGHDL/libghdl/_decorator.py b/pyGHDL/libghdl/_decorator.py
index 4266d31d9..e27754121 100644
--- a/pyGHDL/libghdl/_decorator.py
+++ b/pyGHDL/libghdl/_decorator.py
@@ -82,24 +82,30 @@ def BindToLibGHDL(subprogramName):
typeHintCount = len(typeHints)
if typeHintCount == 0:
- raise ValueError("Function {0} is not annotated with types.".format(func.__name__))
+ raise ValueError(
+ "Function {0} is not annotated with types.".format(func.__name__)
+ )
try:
- returnType = typeHints['return']
+ returnType = typeHints["return"]
except KeyError:
- raise ValueError("Function {0} is not annotated with a return type.".format(func.__name__))
+ raise ValueError(
+ "Function {0} is not annotated with a return type.".format(
+ func.__name__
+ )
+ )
if (typeHintCount - 1) != func.__code__.co_argcount:
- raise ValueError("Number of type annotations ({0}) for function '{1}' does not match number of parameters ({2}).".format(
- typeHintCount - 1,
- func.__name__,
- func.__code__.co_argcount)
+ raise ValueError(
+ "Number of type annotations ({0}) for function '{1}' does not match number of parameters ({2}).".format(
+ typeHintCount - 1, func.__name__, func.__code__.co_argcount
+ )
)
- # print(typeHints)
+ # print(typeHints)
parameters = typeHints.copy()
- del parameters['return']
+ del parameters["return"]
parameterTypes = []
for parameter in parameters.values():
@@ -117,9 +123,17 @@ def BindToLibGHDL(subprogramName):
if (parameter.__bound__ is int) or (parameter.__bound__ is c_int32):
parameterTypes.append(c_int32)
else:
- raise TypeError("Unsupported parameter type '{0!s}' in function '{1}'.".format(parameter, func.__name__))
+ raise TypeError(
+ "Unsupported parameter type '{0!s}' in function '{1}'.".format(
+ parameter, func.__name__
+ )
+ )
else:
- raise TypeError("Unsupported parameter type '{0!s}' in function '{1}'.".format(parameter, func.__name__))
+ raise TypeError(
+ "Unsupported parameter type '{0!s}' in function '{1}'.".format(
+ parameter, func.__name__
+ )
+ )
if returnType is None:
resultType = None
@@ -129,19 +143,27 @@ def BindToLibGHDL(subprogramName):
resultType = c_char
elif returnType is c_char_p:
resultType = c_char_p
- elif (returnType is int):
+ elif returnType is int:
resultType = c_int32
- elif (returnType is bool):
+ elif returnType is bool:
resultType = c_bool
elif isinstance(returnType, TypeVar):
if (returnType.__bound__ is int) or (returnType.__bound__ is c_int32):
resultType = c_int32
else:
- raise Exception("Unsupported return type '{0!s}' in function '{1}'.".format(returnType, func.__name__))
+ raise Exception(
+ "Unsupported return type '{0!s}' in function '{1}'.".format(
+ returnType, func.__name__
+ )
+ )
elif issubclass(returnType, Structure):
resultType = returnType
else:
- raise Exception("Unsupported return type '{0!s}' in function '{1}'.".format(returnType, func.__name__))
+ raise Exception(
+ "Unsupported return type '{0!s}' in function '{1}'.".format(
+ returnType, func.__name__
+ )
+ )
functionPointer = getattr(libghdl, subprogramName)
functionPointer.parameterTypes = parameterTypes
diff --git a/pyGHDL/libghdl/_types.py b/pyGHDL/libghdl/_types.py
index 132dbfab9..21be42c64 100644
--- a/pyGHDL/libghdl/_types.py
+++ b/pyGHDL/libghdl/_types.py
@@ -39,7 +39,7 @@ __all__ = [
"NameId",
"SourceFileEntry",
"Iir",
- "IirKind"
+ "IirKind",
]
ErrorIndex = TypeVar("ErrorIndex", bound=int)
@@ -56,4 +56,6 @@ Iir_Design_File = TypeVar("Iir_Design_File", bound=int)
Iir_Design_Unit = TypeVar("Iir_Design_Unit", bound=int)
Iir_Library_Declaration = TypeVar("Iir_Library_Declaration", bound=c_int32)
Iir_Package_Declaration = TypeVar("Iir_Package_Declaration", bound=c_int32)
-Iir_Enumeration_Type_Definition = TypeVar("Iir_Enumeration_Type_Definition", bound=c_int32)
+Iir_Enumeration_Type_Definition = TypeVar(
+ "Iir_Enumeration_Type_Definition", bound=c_int32
+)
diff --git a/pyGHDL/libghdl/errorout_memory.py b/pyGHDL/libghdl/errorout_memory.py
index 5187d5e3c..c6577540d 100644
--- a/pyGHDL/libghdl/errorout_memory.py
+++ b/pyGHDL/libghdl/errorout_memory.py
@@ -107,11 +107,12 @@ def Get_Error_Record(Idx: ErrorIndex) -> Error_Message:
"""
-#@export
+# @export
@BindToLibGHDL("errorout__memory__get_error_message_addr")
def _Get_Error_Message(Idx: ErrorIndex) -> c_char_p:
pass
+
@export
def Get_Error_Message(Idx: ErrorIndex) -> str:
"""
diff --git a/pyGHDL/libghdl/files_map.py b/pyGHDL/libghdl/files_map.py
index 7e2ae0abc..ceda483c5 100644
--- a/pyGHDL/libghdl/files_map.py
+++ b/pyGHDL/libghdl/files_map.py
@@ -87,7 +87,9 @@ def Location_File_To_Line(Location: Location_Type, File: SourceFileEntry) -> int
@export
@BindToLibGHDL("files_map__location_file_line_to_offset")
-def Location_File_Line_To_Offset(Location: Location_Type, File: SourceFileEntry, Line: int) -> int:
+def Location_File_Line_To_Offset(
+ Location: Location_Type, File: SourceFileEntry, Line: int
+) -> int:
"""
Get the offset in :obj:`Line` of :obj:`Location`.
@@ -100,7 +102,9 @@ def Location_File_Line_To_Offset(Location: Location_Type, File: SourceFileEntry,
@export
@BindToLibGHDL("files_map__location_file_line_to_col")
-def Location_File_Line_To_Col(Location: Location_Type, File: SourceFileEntry, Line: int) -> int:
+def Location_File_Line_To_Col(
+ Location: Location_Type, File: SourceFileEntry, Line: int
+) -> int:
"""
Get logical column (with HT expanded) from :obj:`Location`, :obj:`File` and
:obj:`Line`.
@@ -219,7 +223,9 @@ def Read_Source_File(Directory: NameId, Name: NameId) -> SourceFileEntry:
@export
@BindToLibGHDL("files_map__reserve_source_file")
-def Reserve_Source_File(Directory: NameId, Name: NameId, Length: int) -> SourceFileEntry:
+def Reserve_Source_File(
+ Directory: NameId, Name: NameId, Length: int
+) -> SourceFileEntry:
"""
Reserve an entry, but do not read any file.
diff --git a/pyGHDL/libghdl/files_map_editor.py b/pyGHDL/libghdl/files_map_editor.py
index 1b1f86a01..eceb3efe2 100644
--- a/pyGHDL/libghdl/files_map_editor.py
+++ b/pyGHDL/libghdl/files_map_editor.py
@@ -41,9 +41,17 @@ from pyGHDL.libghdl._decorator import BindToLibGHDL
from pyGHDL.libghdl._types import SourceFileEntry
-#@export
+# @export
@BindToLibGHDL("files_map__editor__replace_text_ptr")
-def _Replace_Text(File: SourceFileEntry, Start_Line: int, Start_Offset: int, End_Line: int, End_Offset: int, Text_Pointer: c_char_p, Text_Length: int) -> bool:
+def _Replace_Text(
+ File: SourceFileEntry,
+ Start_Line: int,
+ Start_Offset: int,
+ End_Line: int,
+ End_Offset: int,
+ Text_Pointer: c_char_p,
+ Text_Length: int,
+) -> bool:
"""Replace [START; END) by TEXT.
:param File: File where to replace a text section.
@@ -58,8 +66,15 @@ def _Replace_Text(File: SourceFileEntry, Start_Line: int, Start_Offset: int, End
@export
-def Replace_Text(File: SourceFileEntry, Start_Line: int, Start_Offset: int, End_Line: int, End_Offset: int, Text: str) -> bool:
- """ Replace [START; END) by TEXT.
+def Replace_Text(
+ File: SourceFileEntry,
+ Start_Line: int,
+ Start_Offset: int,
+ End_Line: int,
+ End_Offset: int,
+ Text: str,
+) -> bool:
+ """Replace [START; END) by TEXT.
:param File: File where to replace a text section.
:param Start_Line: undocumented
@@ -70,11 +85,19 @@ def Replace_Text(File: SourceFileEntry, Start_Line: int, Start_Offset: int, End_
:return: Return True in case of success, False in case of failure (the gap is too small).
"""
buffer = Text.encode("utf-8")
- return _Replace_Text(File, Start_Line, Start_Offset, End_Line, End_Offset, c_char_p(buffer), len(buffer))
+ return _Replace_Text(
+ File,
+ Start_Line,
+ Start_Offset,
+ End_Line,
+ End_Offset,
+ c_char_p(buffer),
+ len(buffer),
+ )
@export
-#@BindToLibGHDL("files_map__editor__fill_text_ptr")
+# @BindToLibGHDL("files_map__editor__fill_text_ptr")
def Fill_Text(File: SourceFileEntry, Text_Pointer, Text_Length: int) -> None:
"""Replace the content of :obj:`File` with TEXT.
@@ -88,8 +111,10 @@ def Fill_Text(File: SourceFileEntry, Text_Pointer, Text_Length: int) -> None:
@export
-#@BindToLibGHDL("files_map__editor__check_buffer_content")
-def Check_Buffer_Content(File: SourceFileEntry, String_Pointer, String_Length: int) -> None:
+# @BindToLibGHDL("files_map__editor__check_buffer_content")
+def Check_Buffer_Content(
+ File: SourceFileEntry, String_Pointer, String_Length: int
+) -> None:
"""
Check that content of :obj:`File` is STR[1 .. STR_LEN].
diff --git a/pyGHDL/libghdl/flags.py b/pyGHDL/libghdl/flags.py
index e5f910995..fc3107e79 100644
--- a/pyGHDL/libghdl/flags.py
+++ b/pyGHDL/libghdl/flags.py
@@ -40,7 +40,7 @@ __all__ = [
"Flag_Elocations",
"Verbose",
"Flag_Elaborate_With_Outdated",
- "Flag_Force_Analysis"
+ "Flag_Force_Analysis",
]
assert sizeof(c_bool) == 1
@@ -49,6 +49,8 @@ Flag_Elocations = c_bool.in_dll(libghdl, "flags__flag_elocations")
Verbose = c_bool.in_dll(libghdl, "flags__verbose")
-Flag_Elaborate_With_Outdated = c_bool.in_dll(libghdl, "flags__flag_elaborate_with_outdated")
+Flag_Elaborate_With_Outdated = c_bool.in_dll(
+ libghdl, "flags__flag_elaborate_with_outdated"
+)
Flag_Force_Analysis = c_bool.in_dll(libghdl, "flags__flag_force_analysis")
diff --git a/pyGHDL/libghdl/libraries.py b/pyGHDL/libghdl/libraries.py
index ef3d8e98d..963f390d9 100644
--- a/pyGHDL/libghdl/libraries.py
+++ b/pyGHDL/libghdl/libraries.py
@@ -37,13 +37,16 @@ from ctypes import c_int32
from pydecor import export
from pyGHDL.libghdl import libghdl
-from pyGHDL.libghdl._types import NameId, Iir_Library_Declaration, Iir_Design_Unit, Iir_Design_File, Location_Type
+from pyGHDL.libghdl._types import (
+ NameId,
+ Iir_Library_Declaration,
+ Iir_Design_Unit,
+ Iir_Design_File,
+ Location_Type,
+)
from pyGHDL.libghdl._decorator import BindToLibGHDL
-__all__ = [
- "Library_Location",
- "Work_Library"
-]
+__all__ = ["Library_Location", "Work_Library"]
Library_Location: Location_Type = c_int32.in_dll(libghdl, "libraries__library_location")
"""
@@ -51,7 +54,9 @@ A location for library declarations (such as library WORK). Use ``.value`` to
access this variable inside libghdl.
"""
-Work_Library:Iir_Library_Declaration = c_int32.in_dll(libghdl, "libraries__work_library")
+Work_Library: Iir_Library_Declaration = c_int32.in_dll(
+ libghdl, "libraries__work_library"
+)
"""
Library declaration for the work library. Note: the identifier of the work_library
is ``work_library_name``, which may be different from 'WORK'. Use ``.value`` to
@@ -126,7 +131,9 @@ def Get_Library_No_Create(Ident: NameId) -> Iir_Library_Declaration:
@export
@BindToLibGHDL("libraries__find_primary_unit")
-def Find_Primary_Unit(Library: Iir_Library_Declaration, Name: NameId) -> Iir_Design_Unit:
+def Find_Primary_Unit(
+ Library: Iir_Library_Declaration, Name: NameId
+) -> Iir_Design_Unit:
"""
Just return the design_unit for :obj:`Name`, or ``NULL`` if not found.
diff --git a/pyGHDL/libghdl/name_table.py b/pyGHDL/libghdl/name_table.py
index ddb5ba491..408168797 100644
--- a/pyGHDL/libghdl/name_table.py
+++ b/pyGHDL/libghdl/name_table.py
@@ -39,9 +39,7 @@ from pydecor import export
from pyGHDL.libghdl._types import NameId
from pyGHDL.libghdl._decorator import BindToLibGHDL
-__all__ = [
- "Null_Identifier"
-]
+__all__ = ["Null_Identifier"]
Null_Identifier = 0
@@ -57,7 +55,7 @@ def Get_Name_Length(Id: NameId) -> int:
"""
-#@export
+# @export
@BindToLibGHDL("name_table__get_name_ptr")
def _Get_Name_Ptr(Id: NameId) -> c_char_p:
""""""
@@ -76,7 +74,7 @@ def Get_Name_Ptr(Id: NameId) -> str:
return _Get_Name_Ptr(Id).decode("utf-8")
-#@export
+# @export
@BindToLibGHDL("name_table__get_character")
def _Get_Character(Id: NameId) -> c_char:
""""""
@@ -97,7 +95,7 @@ def Get_Character(Id: NameId) -> str:
return _Get_Character(Id).decode("utf-8")
-#@export
+# @export
@BindToLibGHDL("name_table__get_identifier_with_len")
def _Get_Identifier(string: c_char_p, length: int) -> NameId:
""""""
diff --git a/pyGHDL/libghdl/vhdl/canon.py b/pyGHDL/libghdl/vhdl/canon.py
index e9bddb07c..086755c35 100644
--- a/pyGHDL/libghdl/vhdl/canon.py
+++ b/pyGHDL/libghdl/vhdl/canon.py
@@ -36,13 +36,11 @@ from ctypes import c_bool
from pyGHDL.libghdl import libghdl
-__all__ = [
- "Flag_Concurrent_Stmts",
- "Flag_Configurations",
- "Flag_Associations"
-]
+__all__ = ["Flag_Concurrent_Stmts", "Flag_Configurations", "Flag_Associations"]
-Flag_Concurrent_Stmts = c_bool.in_dll(libghdl, "vhdl__canon__canon_flag_concurrent_stmts")
+Flag_Concurrent_Stmts = c_bool.in_dll(
+ libghdl, "vhdl__canon__canon_flag_concurrent_stmts"
+)
Flag_Configurations = c_bool.in_dll(libghdl, "vhdl__canon__canon_flag_configurations")
diff --git a/pyGHDL/libghdl/vhdl/flists.py b/pyGHDL/libghdl/vhdl/flists.py
index b4217b36d..3829921f3 100644
--- a/pyGHDL/libghdl/vhdl/flists.py
+++ b/pyGHDL/libghdl/vhdl/flists.py
@@ -38,10 +38,7 @@ from pydecor import export
from pyGHDL.libghdl._decorator import BindToLibGHDL
-__all__ = [
- "Flist_Type",
- "Ffirst"
-]
+__all__ = ["Flist_Type", "Ffirst"]
Flist_Type = c_int32 #: First index of a ``FList``.
diff --git a/pyGHDL/libghdl/vhdl/formatters.py b/pyGHDL/libghdl/vhdl/formatters.py
index 42e8a6679..72b72010e 100644
--- a/pyGHDL/libghdl/vhdl/formatters.py
+++ b/pyGHDL/libghdl/vhdl/formatters.py
@@ -54,7 +54,7 @@ def Indent_String(File: int, Handle: int, FirstLine: int, LastLine: int) -> None
@export
-#@BindToLibGHDL("vhdl__formatters__allocate_handle")
+# @BindToLibGHDL("vhdl__formatters__allocate_handle")
def Allocate_Handle():
"""
.. todo:: Undocumented in Ada code.
@@ -65,7 +65,7 @@ def Allocate_Handle():
@export
-#@BindToLibGHDL("vhdl__formatters__get_length")
+# @BindToLibGHDL("vhdl__formatters__get_length")
def Get_Length(Handle) -> int:
"""
.. todo:: Undocumented in Ada code.
@@ -80,7 +80,7 @@ def Get_Length(Handle) -> int:
@export
-#@BindToLibGHDL("vhdl__formatters__get_c_string")
+# @BindToLibGHDL("vhdl__formatters__get_c_string")
def Get_C_String(Handle):
"""
.. todo:: Undocumented in Ada code.
@@ -95,7 +95,7 @@ def Get_C_String(Handle):
@export
-#@BindToLibGHDL("vhdl__formatters__free_handle")
+# @BindToLibGHDL("vhdl__formatters__free_handle")
def Free_Handle(Handle) -> None:
"""
.. todo:: Undocumented in Ada code.
diff --git a/pyGHDL/libghdl/vhdl/ieee.py b/pyGHDL/libghdl/vhdl/ieee.py
index 66396143e..652782b55 100644
--- a/pyGHDL/libghdl/vhdl/ieee.py
+++ b/pyGHDL/libghdl/vhdl/ieee.py
@@ -35,19 +35,19 @@ from ctypes import c_int
from pyGHDL.libghdl import libghdl
-__all__ = [
- "Std_Logic_1164_Pkg",
- "Std_Logic_Type",
- "Std_Logic_Vector_Type"
-]
+__all__ = ["Std_Logic_1164_Pkg", "Std_Logic_Type", "Std_Logic_Vector_Type"]
-Std_Logic_1164_Pkg = c_int.in_dll(libghdl, "vhdl__ieee__std_logic_1164__std_logic_1164_pkg")
+Std_Logic_1164_Pkg = c_int.in_dll(
+ libghdl, "vhdl__ieee__std_logic_1164__std_logic_1164_pkg"
+)
# Get value
Std_Logic_Type = c_int.in_dll(libghdl, "vhdl__ieee__std_logic_1164__std_logic_type")
# Get value
-Std_Logic_Vector_Type = c_int.in_dll(libghdl, "vhdl__ieee__std_logic_1164__std_logic_vector_type")
+Std_Logic_Vector_Type = c_int.in_dll(
+ libghdl, "vhdl__ieee__std_logic_1164__std_logic_vector_type"
+)
# Get value
# Rising_Edge = c_int.in_dll(libghdl, "vhdl__ieee__std_logic_1164__rising_edge")
diff --git a/pyGHDL/libghdl/vhdl/lists.py b/pyGHDL/libghdl/vhdl/lists.py
index 1499c4dca..d9e4fda6c 100644
--- a/pyGHDL/libghdl/vhdl/lists.py
+++ b/pyGHDL/libghdl/vhdl/lists.py
@@ -42,11 +42,7 @@ from pyGHDL.libghdl._decorator import BindToLibGHDL
@export
class Iterator(Structure):
- _fields_ = [
- ("chunk", c_int32),
- ("chunk_idx", c_int32),
- ("remain", c_int32)
- ]
+ _fields_ = [("chunk", c_int32), ("chunk_idx", c_int32), ("remain", c_int32)]
@export
@@ -71,7 +67,7 @@ def Iterate(List: int) -> Iterator:
@export
-#@BindToLibGHDL("vhdl__lists__is_valid")
+# @BindToLibGHDL("vhdl__lists__is_valid")
def Is_Valid(it: Iterator) -> bool:
"""
Check if iterator reached the end.
@@ -87,7 +83,7 @@ def Is_Valid(it: Iterator) -> bool:
@export
-#@BindToLibGHDL("vhdl__lists__next")
+# @BindToLibGHDL("vhdl__lists__next")
def Next(it: Iterator) -> bool:
"""
Move iterator to the next element.
@@ -103,7 +99,7 @@ def Next(it: Iterator) -> bool:
@export
-#@BindToLibGHDL("vhdl__lists__get_element")
+# @BindToLibGHDL("vhdl__lists__get_element")
def Get_Element(it: Iterator) -> int:
"""
Get the current element from iterator.
diff --git a/pyGHDL/libghdl/vhdl/nodes_utils.py b/pyGHDL/libghdl/vhdl/nodes_utils.py
index f2b9c8bba..7cecb6825 100644
--- a/pyGHDL/libghdl/vhdl/nodes_utils.py
+++ b/pyGHDL/libghdl/vhdl/nodes_utils.py
@@ -34,7 +34,7 @@
from pydecor import export
-from pyGHDL.libghdl._types import Iir
+from pyGHDL.libghdl._types import Iir
from pyGHDL.libghdl._decorator import BindToLibGHDL
diff --git a/pyGHDL/libghdl/vhdl/parse.py b/pyGHDL/libghdl/vhdl/parse.py
index 4f7412274..c3135961f 100644
--- a/pyGHDL/libghdl/vhdl/parse.py
+++ b/pyGHDL/libghdl/vhdl/parse.py
@@ -41,9 +41,7 @@ from pyGHDL.libghdl._types import Iir
from pyGHDL.libghdl._decorator import BindToLibGHDL
-__all__ = [
- "Flag_Parse_Parenthesis"
-]
+__all__ = ["Flag_Parse_Parenthesis"]
Flag_Parse_Parenthesis = c_bool.in_dll(libghdl, "vhdl__parse__flag_parse_parenthesis")
diff --git a/pyGHDL/libghdl/vhdl/scanner.py b/pyGHDL/libghdl/vhdl/scanner.py
index 2ed1d9b11..15d41e9a9 100644
--- a/pyGHDL/libghdl/vhdl/scanner.py
+++ b/pyGHDL/libghdl/vhdl/scanner.py
@@ -41,10 +41,7 @@ from pyGHDL.libghdl._types import SourceFileEntry, NameId
from pyGHDL.libghdl._decorator import BindToLibGHDL
-__all__ = [
- "Current_Token",
- "Flag_Comment"
-]
+__all__ = ["Current_Token", "Flag_Comment"]
# This is a c_int, so you want to use its .value
Current_Token = c_int.in_dll(libghdl, "vhdl__scanner__current_token")
diff --git a/pyGHDL/libghdl/vhdl/sem_lib.py b/pyGHDL/libghdl/vhdl/sem_lib.py
index 9702302a2..c281a299c 100644
--- a/pyGHDL/libghdl/vhdl/sem_lib.py
+++ b/pyGHDL/libghdl/vhdl/sem_lib.py
@@ -34,7 +34,7 @@
from pydecor import export
-from pyGHDL.libghdl._types import SourceFileEntry, Iir_Design_File, Iir_Design_Unit
+from pyGHDL.libghdl._types import SourceFileEntry, Iir_Design_File, Iir_Design_Unit
from pyGHDL.libghdl._decorator import BindToLibGHDL
diff --git a/pyGHDL/libghdl/vhdl/std_package.py b/pyGHDL/libghdl/vhdl/std_package.py
index 690dc78a4..600aaea83 100644
--- a/pyGHDL/libghdl/vhdl/std_package.py
+++ b/pyGHDL/libghdl/vhdl/std_package.py
@@ -35,21 +35,25 @@
from ctypes import c_int32
from pyGHDL.libghdl import libghdl
-from pyGHDL.libghdl._types import Location_Type, Iir_Package_Declaration, Iir_Enumeration_Type_Definition
+from pyGHDL.libghdl._types import (
+ Location_Type,
+ Iir_Package_Declaration,
+ Iir_Enumeration_Type_Definition,
+)
-__all__ = [
- "Std_Location",
- "Standard_Package",
- "Character_Type_Definition"
-]
+__all__ = ["Std_Location", "Standard_Package", "Character_Type_Definition"]
Std_Location: Location_Type = c_int32.in_dll(libghdl, "vhdl__std_package__std_location")
"""Virtual location for the ``std.standard`` package. Use ``.value`` to access this variable inside libghdl."""
-Standard_Package: Iir_Package_Declaration = c_int32.in_dll(libghdl, "vhdl__std_package__standard_package")
+Standard_Package: Iir_Package_Declaration = c_int32.in_dll(
+ libghdl, "vhdl__std_package__standard_package"
+)
"""Virtual package ``std.package``. Use ``.value`` to access this variable inside libghdl."""
-Character_Type_Definition: Iir_Enumeration_Type_Definition = c_int32.in_dll(libghdl, "vhdl__std_package__character_type_definition")
+Character_Type_Definition: Iir_Enumeration_Type_Definition = c_int32.in_dll(
+ libghdl, "vhdl__std_package__character_type_definition"
+)
"""Predefined character. Use ``.value`` to access this variable inside libghdl."""