diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-08-11 15:49:39 +0200 |
---|---|---|
committer | umarcor <unai.martinezcorral@ehu.eus> | 2021-08-23 16:35:35 +0200 |
commit | bc09bbf10599436e1efdb0432886b2bb8b4bf890 (patch) | |
tree | ecfd7abe20a1b2773ef187bb3de302b1db05b0c5 /pyGHDL/dom | |
parent | b34f3e885407693a2839771fd469af4ce2b40978 (diff) | |
download | ghdl-bc09bbf10599436e1efdb0432886b2bb8b4bf890.tar.gz ghdl-bc09bbf10599436e1efdb0432886b2bb8b4bf890.tar.bz2 ghdl-bc09bbf10599436e1efdb0432886b2bb8b4bf890.zip |
Support for concurrent procedure call.
Diffstat (limited to 'pyGHDL/dom')
-rw-r--r-- | pyGHDL/dom/Concurrent.py | 28 | ||||
-rw-r--r-- | pyGHDL/dom/_Translate.py | 7 | ||||
-rw-r--r-- | pyGHDL/dom/formatting/prettyprint.py | 7 |
3 files changed, 37 insertions, 5 deletions
diff --git a/pyGHDL/dom/Concurrent.py b/pyGHDL/dom/Concurrent.py index f493a4c69..afff56747 100644 --- a/pyGHDL/dom/Concurrent.py +++ b/pyGHDL/dom/Concurrent.py @@ -53,6 +53,7 @@ from pyVHDLModel.SyntaxModel import ( ForGenerateStatement as VHDLModel_ForGenerateStatement, WaveformElement as VHDLModel_WaveformElement, ConcurrentSimpleSignalAssignment as VHDLModel_ConcurrentSimpleSignalAssignment, + ConcurrentProcedureCall as VHDLModel_ConcurrentProcedureCall, Name, ConcurrentStatement, SequentialStatement, @@ -564,3 +565,30 @@ class ConcurrentSimpleSignalAssignment( expression = [None] return cls(assignmentNode, label, targetName, expression) + + +@export +class ConcurrentProcedureCall(VHDLModel_ConcurrentProcedureCall, DOMMixin): + def __init__( + self, + callNode: Iir, + label: str, + procedureName: Name, + parameterMappings: Iterable, + ): + super().__init__(label, procedureName, parameterMappings) + DOMMixin.__init__(self, callNode) + + @classmethod + def parse(cls, callNode: Iir, label: str) -> "ConcurrentProcedureCall": + from pyGHDL.dom._Translate import GetNameFromNode, GetIirKindOfNode + + call = nodes.Get_Procedure_Call(callNode) + prefix = nodes.Get_Prefix(call) + + procedureName = GetNameFromNode(prefix) + + # TODO: parameter mappings + parameterMappings = [] + + return cls(callNode, label, procedureName, parameterMappings) diff --git a/pyGHDL/dom/_Translate.py b/pyGHDL/dom/_Translate.py index b53b7976e..c8b34ba8c 100644 --- a/pyGHDL/dom/_Translate.py +++ b/pyGHDL/dom/_Translate.py @@ -148,6 +148,7 @@ from pyGHDL.dom.Concurrent import ( ForGenerateStatement, CaseGenerateStatement, ConcurrentSimpleSignalAssignment, + ConcurrentProcedureCall, ) from pyGHDL.dom.Subprogram import Function, Procedure from pyGHDL.dom.Misc import Alias @@ -815,11 +816,7 @@ def GetStatementsFromChainedNodes( ) ) elif kind == nodes.Iir_Kind.Concurrent_Procedure_Call_Statement: - print( - "[NOT IMPLEMENTED] Concurrent procedure call (label: '{label}') at line {line}".format( - label=label, line=pos.Line - ) - ) + yield ConcurrentProcedureCall.parse(statement, label) elif kind == nodes.Iir_Kind.Component_Instantiation_Statement: instantiatedUnit = nodes.Get_Instantiated_Unit(statement) instantiatedUnitKind = GetIirKindOfNode(instantiatedUnit) diff --git a/pyGHDL/dom/formatting/prettyprint.py b/pyGHDL/dom/formatting/prettyprint.py index bc6744fe8..7fa49389d 100644 --- a/pyGHDL/dom/formatting/prettyprint.py +++ b/pyGHDL/dom/formatting/prettyprint.py @@ -44,6 +44,7 @@ from pyGHDL.dom.Concurrent import ( ConfigurationInstantiation, EntityInstantiation, OthersGenerateCase, + ConcurrentProcedureCall, ) from pyVHDLModel.SyntaxModel import ( GenericInterfaceItem, @@ -741,5 +742,11 @@ class PrettyPrint: for stmt in statement.Statements: for line in self.formatHierarchy(stmt, level + 2): buffer.append(line) + elif isinstance(statement, ConcurrentProcedureCall): + buffer.append( + "{prefix}- {label}: {name!s}(...)".format( + prefix=prefix, label=statement.Label, name=statement.Procedure + ) + ) return buffer |