From ca39821dc013a877a8dbdfabbc3b861eb4d4d2e3 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 26 Jul 2021 00:13:11 +0200 Subject: Adjusted to renaming in pyVHDLModel. --- pyGHDL/dom/InterfaceItem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pyGHDL/dom/InterfaceItem.py') diff --git a/pyGHDL/dom/InterfaceItem.py b/pyGHDL/dom/InterfaceItem.py index 4ebea735a..9f4d1c5e2 100644 --- a/pyGHDL/dom/InterfaceItem.py +++ b/pyGHDL/dom/InterfaceItem.py @@ -32,7 +32,7 @@ # ============================================================================ from pydecor import export -from pyVHDLModel.VHDLModel import ( +from pyVHDLModel.SyntaxModel import ( GenericConstantInterfaceItem as VHDLModel_GenericConstantInterfaceItem, GenericTypeInterfaceItem as VHDLModel_GenericTypeInterfaceItem, GenericPackageInterfaceItem as VHDLModel_GenericPackageInterfaceItem, -- cgit v1.2.3 From 1a67eb54fc54601dd4945d75d53da87b8e152053 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 26 Jul 2021 02:36:23 +0200 Subject: Handle declarations with multiple identifiers. --- pyGHDL/dom/InterfaceItem.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'pyGHDL/dom/InterfaceItem.py') diff --git a/pyGHDL/dom/InterfaceItem.py b/pyGHDL/dom/InterfaceItem.py index 9f4d1c5e2..fc4e6e5a9 100644 --- a/pyGHDL/dom/InterfaceItem.py +++ b/pyGHDL/dom/InterfaceItem.py @@ -30,6 +30,8 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ +from typing import List + from pydecor import export from pyVHDLModel.SyntaxModel import ( @@ -63,12 +65,12 @@ class GenericConstantInterfaceItem(VHDLModel_GenericConstantInterfaceItem, DOMMi def __init__( self, node: Iir, - identifier: str, + identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: Expression, ): - super().__init__(identifier, mode, subtype, defaultExpression) + super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) @classmethod @@ -79,7 +81,7 @@ class GenericConstantInterfaceItem(VHDLModel_GenericConstantInterfaceItem, DOMMi default = nodes.Get_Default_Value(genericNode) value = GetExpressionFromNode(default) if default else None - return cls(genericNode, name, mode, subtypeIndication, value) + return cls(genericNode, [name, ], mode, subtypeIndication, value) @export @@ -155,12 +157,12 @@ class PortSignalInterfaceItem(VHDLModel_PortSignalInterfaceItem, DOMMixin): def __init__( self, node: Iir, - identifier: str, + identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: Expression = None, ): - super().__init__(identifier, mode, subtype, defaultExpression) + super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) @classmethod @@ -176,7 +178,7 @@ class PortSignalInterfaceItem(VHDLModel_PortSignalInterfaceItem, DOMMixin): else None ) - return cls(portNode, name, mode, subtypeIndication, value) + return cls(portNode, [name, ], mode, subtypeIndication, value) @export @@ -186,12 +188,12 @@ class ParameterConstantInterfaceItem( def __init__( self, node: Iir, - identifier: str, + identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: Expression = None, ): - super().__init__(identifier, mode, subtype, defaultExpression) + super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) @classmethod @@ -209,7 +211,7 @@ class ParameterConstantInterfaceItem( else None ) - return cls(parameterNode, name, mode, subtypeIndication, value) + return cls(parameterNode, [name, ], mode, subtypeIndication, value) @export @@ -219,12 +221,12 @@ class ParameterVariableInterfaceItem( def __init__( self, node: Iir, - identifier: str, + identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: Expression = None, ): - super().__init__(identifier, mode, subtype, defaultExpression) + super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) @classmethod @@ -242,7 +244,7 @@ class ParameterVariableInterfaceItem( else None ) - return cls(parameterNode, name, mode, subtypeIndication, value) + return cls(parameterNode, [name, ], mode, subtypeIndication, value) @export @@ -250,12 +252,12 @@ class ParameterSignalInterfaceItem(VHDLModel_ParameterSignalInterfaceItem, DOMMi def __init__( self, node: Iir, - identifier: str, + identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: Expression = None, ): - super().__init__(identifier, mode, subtype, defaultExpression) + super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) @classmethod @@ -273,7 +275,7 @@ class ParameterSignalInterfaceItem(VHDLModel_ParameterSignalInterfaceItem, DOMMi else None ) - return cls(parameterNode, name, mode, subtypeIndication, value) + return cls(parameterNode, [name, ], mode, subtypeIndication, value) @export @@ -281,10 +283,10 @@ class ParameterFileInterfaceItem(VHDLModel_ParameterFileInterfaceItem, DOMMixin) def __init__( self, node: Iir, - identifier: str, + identifiers: List[str], subtype: SubtypeOrSymbol, ): - super().__init__(identifier, subtype) + super().__init__(identifiers, subtype) DOMMixin.__init__(self, node) @classmethod @@ -294,4 +296,4 @@ class ParameterFileInterfaceItem(VHDLModel_ParameterFileInterfaceItem, DOMMixin) parameterNode, "parameter", name ) - return cls(parameterNode, name, subtypeIndication) + return cls(parameterNode, [name, ], subtypeIndication) -- cgit v1.2.3 From 77f969a11ea5ac38f007dbf3aab986dcf10125b0 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 26 Jul 2021 03:11:03 +0200 Subject: Also handle multiple identifiers in signal, variable, object and file declarations. --- pyGHDL/dom/InterfaceItem.py | 58 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 6 deletions(-) (limited to 'pyGHDL/dom/InterfaceItem.py') diff --git a/pyGHDL/dom/InterfaceItem.py b/pyGHDL/dom/InterfaceItem.py index fc4e6e5a9..2396ff0c8 100644 --- a/pyGHDL/dom/InterfaceItem.py +++ b/pyGHDL/dom/InterfaceItem.py @@ -81,7 +81,15 @@ class GenericConstantInterfaceItem(VHDLModel_GenericConstantInterfaceItem, DOMMi default = nodes.Get_Default_Value(genericNode) value = GetExpressionFromNode(default) if default else None - return cls(genericNode, [name, ], mode, subtypeIndication, value) + return cls( + genericNode, + list( + name, + ), + mode, + subtypeIndication, + value, + ) @export @@ -178,7 +186,15 @@ class PortSignalInterfaceItem(VHDLModel_PortSignalInterfaceItem, DOMMixin): else None ) - return cls(portNode, [name, ], mode, subtypeIndication, value) + return cls( + portNode, + list( + name, + ), + mode, + subtypeIndication, + value, + ) @export @@ -211,7 +227,15 @@ class ParameterConstantInterfaceItem( else None ) - return cls(parameterNode, [name, ], mode, subtypeIndication, value) + return cls( + parameterNode, + list( + name, + ), + mode, + subtypeIndication, + value, + ) @export @@ -244,7 +268,15 @@ class ParameterVariableInterfaceItem( else None ) - return cls(parameterNode, [name, ], mode, subtypeIndication, value) + return cls( + parameterNode, + list( + name, + ), + mode, + subtypeIndication, + value, + ) @export @@ -275,7 +307,15 @@ class ParameterSignalInterfaceItem(VHDLModel_ParameterSignalInterfaceItem, DOMMi else None ) - return cls(parameterNode, [name, ], mode, subtypeIndication, value) + return cls( + parameterNode, + list( + name, + ), + mode, + subtypeIndication, + value, + ) @export @@ -296,4 +336,10 @@ class ParameterFileInterfaceItem(VHDLModel_ParameterFileInterfaceItem, DOMMixin) parameterNode, "parameter", name ) - return cls(parameterNode, [name, ], subtypeIndication) + return cls( + parameterNode, + list( + name, + ), + subtypeIndication, + ) -- cgit v1.2.3 From 47ec53b54ce661a806f371734754483ef906c563 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 26 Jul 2021 21:38:43 +0200 Subject: Also handle multiple identifiers in record elements. --- pyGHDL/dom/InterfaceItem.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'pyGHDL/dom/InterfaceItem.py') diff --git a/pyGHDL/dom/InterfaceItem.py b/pyGHDL/dom/InterfaceItem.py index 2396ff0c8..3a9c7238f 100644 --- a/pyGHDL/dom/InterfaceItem.py +++ b/pyGHDL/dom/InterfaceItem.py @@ -83,9 +83,9 @@ class GenericConstantInterfaceItem(VHDLModel_GenericConstantInterfaceItem, DOMMi return cls( genericNode, - list( + [ name, - ), + ], mode, subtypeIndication, value, @@ -188,9 +188,9 @@ class PortSignalInterfaceItem(VHDLModel_PortSignalInterfaceItem, DOMMixin): return cls( portNode, - list( + [ name, - ), + ], mode, subtypeIndication, value, @@ -229,9 +229,9 @@ class ParameterConstantInterfaceItem( return cls( parameterNode, - list( + [ name, - ), + ], mode, subtypeIndication, value, @@ -270,9 +270,9 @@ class ParameterVariableInterfaceItem( return cls( parameterNode, - list( + [ name, - ), + ], mode, subtypeIndication, value, @@ -309,9 +309,9 @@ class ParameterSignalInterfaceItem(VHDLModel_ParameterSignalInterfaceItem, DOMMi return cls( parameterNode, - list( + [ name, - ), + ], mode, subtypeIndication, value, @@ -338,8 +338,8 @@ class ParameterFileInterfaceItem(VHDLModel_ParameterFileInterfaceItem, DOMMixin) return cls( parameterNode, - list( + [ name, - ), + ], subtypeIndication, ) -- cgit v1.2.3 From 8b98e2883b40b00922c9944c2470211ee055a9a5 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 23 Aug 2021 09:02:47 +0200 Subject: Fixes due to a bug in pyVHDLModel. Name Context was used twice. --- pyGHDL/dom/InterfaceItem.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pyGHDL/dom/InterfaceItem.py') diff --git a/pyGHDL/dom/InterfaceItem.py b/pyGHDL/dom/InterfaceItem.py index 3a9c7238f..af1b681cd 100644 --- a/pyGHDL/dom/InterfaceItem.py +++ b/pyGHDL/dom/InterfaceItem.py @@ -47,7 +47,7 @@ from pyVHDLModel.SyntaxModel import ( ParameterFileInterfaceItem as VHDLModel_ParameterFileInterfaceItem, Mode, SubtypeOrSymbol, - Expression, + ExpressionUnion, ) from pyGHDL.libghdl._types import Iir @@ -68,7 +68,7 @@ class GenericConstantInterfaceItem(VHDLModel_GenericConstantInterfaceItem, DOMMi identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, - defaultExpression: Expression, + defaultExpression: ExpressionUnion, ): super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) @@ -168,7 +168,7 @@ class PortSignalInterfaceItem(VHDLModel_PortSignalInterfaceItem, DOMMixin): identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, - defaultExpression: Expression = None, + defaultExpression: ExpressionUnion = None, ): super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) @@ -207,7 +207,7 @@ class ParameterConstantInterfaceItem( identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, - defaultExpression: Expression = None, + defaultExpression: ExpressionUnion = None, ): super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) @@ -248,7 +248,7 @@ class ParameterVariableInterfaceItem( identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, - defaultExpression: Expression = None, + defaultExpression: ExpressionUnion = None, ): super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) @@ -287,7 +287,7 @@ class ParameterSignalInterfaceItem(VHDLModel_ParameterSignalInterfaceItem, DOMMi identifiers: List[str], mode: Mode, subtype: SubtypeOrSymbol, - defaultExpression: Expression = None, + defaultExpression: ExpressionUnion = None, ): super().__init__(identifiers, mode, subtype, defaultExpression) DOMMixin.__init__(self, node) -- cgit v1.2.3