diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-06-18 10:19:59 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-06-18 19:19:27 +0200 |
commit | 823ee7dd560da1e8f08a34685c03f98ccc89b390 (patch) | |
tree | 9b628795399605aa478ab2e95feec7004ca43575 /pyGHDL/dom/InterfaceItem.py | |
parent | 05755b53e1d723ff4d2c9de79c61badd42491b13 (diff) | |
download | ghdl-823ee7dd560da1e8f08a34685c03f98ccc89b390.tar.gz ghdl-823ee7dd560da1e8f08a34685c03f98ccc89b390.tar.bz2 ghdl-823ee7dd560da1e8f08a34685c03f98ccc89b390.zip |
Added handling of Floating Point.
Diffstat (limited to 'pyGHDL/dom/InterfaceItem.py')
-rw-r--r-- | pyGHDL/dom/InterfaceItem.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/pyGHDL/dom/InterfaceItem.py b/pyGHDL/dom/InterfaceItem.py index 028adc690..fcb8b0ef3 100644 --- a/pyGHDL/dom/InterfaceItem.py +++ b/pyGHDL/dom/InterfaceItem.py @@ -30,6 +30,9 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ +from pyGHDL.libghdl.vhdl.nodes import Null_Iir + +from pyGHDL.libghdl.vhdl import nodes from pydecor import export from pyVHDLModel.VHDLModel import ( @@ -41,7 +44,7 @@ from pyVHDLModel.VHDLModel import ( ) from pyGHDL.dom._Utils import NodeToName, GetModeOfNode -from pyGHDL.dom._Translate import GetSubtypeIndicationFromNode +from pyGHDL.dom._Translate import GetSubtypeIndicationFromNode, GetExpressionFromNode from pyGHDL.dom.Common import GHDLMixin __all__ = [] @@ -54,14 +57,16 @@ class GenericConstantInterfaceItem(VHDLModel_GenericConstantInterfaceItem, GHDLM name = NodeToName(generic) mode = GetModeOfNode(generic) subTypeIndication = GetSubtypeIndicationFromNode(generic, "generic", name) + value = GetExpressionFromNode(nodes.Get_Default_Value(generic)) - generic = cls(name, mode, subTypeIndication) + generic = cls(name, mode, subTypeIndication, value) return generic - def __init__(self, name: str, mode: Mode, subType: SubTypeOrSymbol): + def __init__(self, name: str, mode: Mode, subType: SubTypeOrSymbol, defaultExpression: Expression): super().__init__(name=name, mode=mode) self._subType = subType + self._defaultExpression = defaultExpression @export @@ -72,7 +77,10 @@ class PortSignalInterfaceItem(VHDLModel_PortSignalInterfaceItem, GHDLMixin): mode = GetModeOfNode(port) subTypeIndication = GetSubtypeIndicationFromNode(port, "port", name) - port = cls(name, mode, subTypeIndication) + defaultValue = nodes.Get_Default_Value(port) + value = GetExpressionFromNode(defaultValue) if defaultValue != Null_Iir else None + + port = cls(name, mode, subTypeIndication, value) return port |