diff options
Diffstat (limited to 'pyGHDL/dom/InterfaceItem.py')
| -rw-r--r-- | pyGHDL/dom/InterfaceItem.py | 44 | 
1 files changed, 31 insertions, 13 deletions
diff --git a/pyGHDL/dom/InterfaceItem.py b/pyGHDL/dom/InterfaceItem.py index fb8a1b320..aa63f3094 100644 --- a/pyGHDL/dom/InterfaceItem.py +++ b/pyGHDL/dom/InterfaceItem.py @@ -30,7 +30,7 @@  #  # SPDX-License-Identifier: GPL-2.0-or-later  # ============================================================================ -from typing import List +from typing import List, Iterable  from pyTooling.Decorators import export @@ -75,15 +75,18 @@ class GenericConstantInterfaceItem(VHDLModel_GenericConstantInterfaceItem, DOMMi          DOMMixin.__init__(self, node)      @classmethod -    def parse(cls, genericNode: Iir) -> "GenericConstantInterfaceItem": +    def parse(cls, genericNode: Iir, furtherIdentifiers: Iterable[str] = None) -> "GenericConstantInterfaceItem":          name = GetNameOfNode(genericNode)          documentation = GetDocumentationOfNode(genericNode) +        identifiers = [name] +        if furtherIdentifiers is not None: +            identifiers.extend(furtherIdentifiers)          mode = GetModeOfNode(genericNode)          subtypeIndication = GetSubtypeIndicationFromNode(genericNode, "generic", name)          default = nodes.Get_Default_Value(genericNode)          value = GetExpressionFromNode(default) if default else None -        return cls(genericNode, [name], mode, subtypeIndication, value, documentation) +        return cls(genericNode, identifiers, mode, subtypeIndication, value, documentation)  @export @@ -157,16 +160,19 @@ class PortSignalInterfaceItem(VHDLModel_PortSignalInterfaceItem, DOMMixin):          DOMMixin.__init__(self, node)      @classmethod -    def parse(cls, portNode: Iir) -> "PortSignalInterfaceItem": +    def parse(cls, portNode: Iir, furtherIdentifiers: Iterable[str] = None) -> "PortSignalInterfaceItem":          name = GetNameOfNode(portNode)          documentation = GetDocumentationOfNode(portNode) +        identifiers = [name] +        if furtherIdentifiers is not None: +            identifiers.extend(furtherIdentifiers)          mode = GetModeOfNode(portNode)          subtypeIndication = GetSubtypeIndicationFromNode(portNode, "port", name)          defaultValue = nodes.Get_Default_Value(portNode)          value = GetExpressionFromNode(defaultValue) if defaultValue != nodes.Null_Iir else None -        return cls(portNode, [name], mode, subtypeIndication, value, documentation) +        return cls(portNode, identifiers, mode, subtypeIndication, value, documentation)  @export @@ -184,16 +190,19 @@ class ParameterConstantInterfaceItem(VHDLModel_ParameterConstantInterfaceItem, D          DOMMixin.__init__(self, node)      @classmethod -    def parse(cls, parameterNode: Iir) -> "ParameterConstantInterfaceItem": +    def parse(cls, parameterNode: Iir, furtherIdentifiers: Iterable[str] = None) -> "ParameterConstantInterfaceItem":          name = GetNameOfNode(parameterNode)          documentation = GetDocumentationOfNode(parameterNode) +        identifiers = [name] +        if furtherIdentifiers is not None: +            identifiers.extend(furtherIdentifiers)          mode = GetModeOfNode(parameterNode)          subtypeIndication = GetSubtypeIndicationFromNode(parameterNode, "parameter", name)          defaultValue = nodes.Get_Default_Value(parameterNode)          value = GetExpressionFromNode(defaultValue) if defaultValue != nodes.Null_Iir else None -        return cls(parameterNode, [name], mode, subtypeIndication, value, documentation) +        return cls(parameterNode, identifiers, mode, subtypeIndication, value, documentation)  @export @@ -211,16 +220,19 @@ class ParameterVariableInterfaceItem(VHDLModel_ParameterVariableInterfaceItem, D          DOMMixin.__init__(self, node)      @classmethod -    def parse(cls, parameterNode: Iir) -> "ParameterVariableInterfaceItem": +    def parse(cls, parameterNode: Iir, furtherIdentifiers: Iterable[str] = None) -> "ParameterVariableInterfaceItem":          name = GetNameOfNode(parameterNode)          documentation = GetDocumentationOfNode(parameterNode) +        identifiers = [name] +        if furtherIdentifiers is not None: +            identifiers.extend(furtherIdentifiers)          mode = GetModeOfNode(parameterNode)          subtypeIndication = GetSubtypeIndicationFromNode(parameterNode, "parameter", name)          defaultValue = nodes.Get_Default_Value(parameterNode)          value = GetExpressionFromNode(defaultValue) if defaultValue != nodes.Null_Iir else None -        return cls(parameterNode, [name], mode, subtypeIndication, value, documentation) +        return cls(parameterNode, identifiers, mode, subtypeIndication, value, documentation)  @export @@ -238,16 +250,19 @@ class ParameterSignalInterfaceItem(VHDLModel_ParameterSignalInterfaceItem, DOMMi          DOMMixin.__init__(self, node)      @classmethod -    def parse(cls, parameterNode: Iir) -> "ParameterSignalInterfaceItem": +    def parse(cls, parameterNode: Iir, furtherIdentifiers: Iterable[str] = None) -> "ParameterSignalInterfaceItem":          name = GetNameOfNode(parameterNode)          documentation = GetDocumentationOfNode(parameterNode) +        identifiers = [name] +        if furtherIdentifiers is not None: +            identifiers.extend(furtherIdentifiers)          mode = GetModeOfNode(parameterNode)          subtypeIndication = GetSubtypeIndicationFromNode(parameterNode, "parameter", name)          defaultValue = nodes.Get_Default_Value(parameterNode)          value = GetExpressionFromNode(defaultValue) if defaultValue != nodes.Null_Iir else None -        return cls(parameterNode, [name], mode, subtypeIndication, value, documentation) +        return cls(parameterNode, identifiers, mode, subtypeIndication, value, documentation)  @export @@ -257,9 +272,12 @@ class ParameterFileInterfaceItem(VHDLModel_ParameterFileInterfaceItem, DOMMixin)          DOMMixin.__init__(self, node)      @classmethod -    def parse(cls, parameterNode: Iir) -> "ParameterFileInterfaceItem": +    def parse(cls, parameterNode: Iir, furtherIdentifiers: Iterable[str] = None) -> "ParameterFileInterfaceItem":          name = GetNameOfNode(parameterNode)          documentation = GetDocumentationOfNode(parameterNode) +        identifiers = [name] +        if furtherIdentifiers is not None: +            identifiers.extend(furtherIdentifiers)          subtypeIndication = GetSubtypeIndicationFromNode(parameterNode, "parameter", name) -        return cls(parameterNode, [name], subtypeIndication, documentation) +        return cls(parameterNode, identifiers, subtypeIndication, documentation)  | 
