aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/dom/_Translate.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyGHDL/dom/_Translate.py')
-rw-r--r--pyGHDL/dom/_Translate.py33
1 files changed, 20 insertions, 13 deletions
diff --git a/pyGHDL/dom/_Translate.py b/pyGHDL/dom/_Translate.py
index ef8656e52..d39b14765 100644
--- a/pyGHDL/dom/_Translate.py
+++ b/pyGHDL/dom/_Translate.py
@@ -464,21 +464,20 @@ def GetGenericsFromChainedNodes(
GenericFunctionInterfaceItem,
)
+ furtherIdentifiers = []
generic = nodeChain
while generic != nodes.Null_Iir:
kind = GetIirKindOfNode(generic)
if kind == nodes.Iir_Kind.Interface_Constant_Declaration:
from pyGHDL.dom.InterfaceItem import GenericConstantInterfaceItem
- genericConstant = GenericConstantInterfaceItem.parse(generic)
-
# Lookahead for generics with multiple identifiers at once
if nodes.Get_Has_Identifier_List(generic):
nextNode = nodes.Get_Chain(generic)
for nextGeneric in utils.chain_iter(nextNode):
# Consecutive identifiers are found, if the subtype indication is Null
if nodes.Get_Subtype_Indication(nextGeneric) == nodes.Null_Iir:
- genericConstant.Identifiers.append(GetNameOfNode(nextGeneric))
+ furtherIdentifiers.append(GetNameOfNode(nextGeneric))
else:
generic = nextGeneric
break
@@ -492,7 +491,8 @@ def GetGenericsFromChainedNodes(
else:
generic = nodes.Get_Chain(generic)
- yield genericConstant
+ yield GenericConstantInterfaceItem.parse(generic, furtherIdentifiers)
+ furtherIdentifiers.clear()
continue
else:
if kind == nodes.Iir_Kind.Interface_Type_Declaration:
@@ -517,13 +517,14 @@ def GetPortsFromChainedNodes(
nodeChain: Iir,
) -> Generator[PortInterfaceItem, None, None]:
+ furtherIdentifiers = []
port = nodeChain
while port != nodes.Null_Iir:
kind = GetIirKindOfNode(port)
if kind == nodes.Iir_Kind.Interface_Signal_Declaration:
from pyGHDL.dom.InterfaceItem import PortSignalInterfaceItem
- portSignal = PortSignalInterfaceItem.parse(port)
+ portToParse = port
# Lookahead for ports with multiple identifiers at once
if nodes.Get_Has_Identifier_List(port):
@@ -531,7 +532,7 @@ def GetPortsFromChainedNodes(
for nextPort in utils.chain_iter(nextNode):
# Consecutive identifiers are found, if the subtype indication is Null
if nodes.Get_Subtype_Indication(nextPort) == nodes.Null_Iir:
- portSignal.Identifiers.append(GetNameOfNode(nextPort))
+ furtherIdentifiers.append(GetNameOfNode(nextPort))
else:
port = nextPort
break
@@ -545,7 +546,8 @@ def GetPortsFromChainedNodes(
else:
port = nodes.Get_Chain(port)
- yield portSignal
+ yield PortSignalInterfaceItem.parse(portToParse, furtherIdentifiers)
+ furtherIdentifiers.clear()
continue
else:
position = Position.parse(port)
@@ -559,25 +561,30 @@ def GetParameterFromChainedNodes(
nodeChain: Iir,
) -> Generator[ParameterInterfaceItem, None, None]:
+ identifiers = []
parameter = nodeChain
while parameter != nodes.Null_Iir:
kind = GetIirKindOfNode(parameter)
if kind == nodes.Iir_Kind.Interface_Constant_Declaration:
from pyGHDL.dom.InterfaceItem import ParameterConstantInterfaceItem
- param = ParameterConstantInterfaceItem.parse(parameter)
+ parseMethod = ParameterConstantInterfaceItem.parse
+ parseNode = parameter
elif kind == nodes.Iir_Kind.Interface_Variable_Declaration:
from pyGHDL.dom.InterfaceItem import ParameterVariableInterfaceItem
- param = ParameterVariableInterfaceItem.parse(parameter)
+ parseMethod = ParameterVariableInterfaceItem.parse
+ parseNode = parameter
elif kind == nodes.Iir_Kind.Interface_Signal_Declaration:
from pyGHDL.dom.InterfaceItem import ParameterSignalInterfaceItem
- param = ParameterSignalInterfaceItem.parse(parameter)
+ parseMethod = ParameterSignalInterfaceItem.parse
+ parseNode = parameter
elif kind == nodes.Iir_Kind.Interface_File_Declaration:
from pyGHDL.dom.InterfaceItem import ParameterFileInterfaceItem
- param = ParameterFileInterfaceItem.parse(parameter)
+ parseMethod = ParameterFileInterfaceItem.parse
+ parseNode = parameter
else:
position = Position.parse(parameter)
raise DOMException(
@@ -590,7 +597,7 @@ def GetParameterFromChainedNodes(
for nextParameter in utils.chain_iter(nextNode):
# Consecutive identifiers are found, if the subtype indication is Null
if nodes.Get_Subtype_Indication(nextParameter) == nodes.Null_Iir:
- param.Identifiers.append(GetNameOfNode(nextParameter))
+ identifiers.append(GetNameOfNode(nextParameter))
else:
parameter = nextParameter
break
@@ -604,7 +611,7 @@ def GetParameterFromChainedNodes(
else:
parameter = nodes.Get_Chain(parameter)
- yield param
+ yield parseMethod(parseNode, identifiers)
def GetMapAspect(mapAspect: Iir, cls: Type, entity: str) -> Generator[AssociationItem, None, None]: