diff options
-rw-r--r-- | pyGHDL/dom/Concurrent.py | 27 | ||||
-rw-r--r-- | pyGHDL/dom/Sequential.py | 9 | ||||
-rw-r--r-- | pyGHDL/dom/_Translate.py | 7 |
3 files changed, 26 insertions, 17 deletions
diff --git a/pyGHDL/dom/Concurrent.py b/pyGHDL/dom/Concurrent.py index f4ded4e80..f4681dbf9 100644 --- a/pyGHDL/dom/Concurrent.py +++ b/pyGHDL/dom/Concurrent.py @@ -616,9 +616,23 @@ class ForGenerateStatement(VHDLModel_ForGenerateStatement, DOMMixin): @export class WaveformElement(VHDLModel_WaveformElement, DOMMixin): - def __init__(self, waveformNode: Iir, expression: Expression, after: Expression): + def __init__(self, waveNode: Iir, expression: Expression, after: Expression): super().__init__(expression, after) - DOMMixin.__init__(self, waveformNode) + DOMMixin.__init__(self, waveNode) + + @classmethod + def parse(cls, waveNode: Iir): + from pyGHDL.dom._Translate import GetExpressionFromNode + + value = GetExpressionFromNode(nodes.Get_We_Value(waveNode)) + + timeNode = nodes.Get_Time(waveNode) + if timeNode is nodes.Null_Iir: + time = None + else: + time = GetExpressionFromNode(timeNode) + + return cls(waveNode, value, time) @export @@ -644,12 +658,11 @@ class ConcurrentSimpleSignalAssignment( target = nodes.Get_Target(assignmentNode) targetName = GetNameFromNode(target) - waveform = nodes.Get_Waveform_Chain(assignmentNode) - - # TODO: translate waveforms to series of "expressions". - expression = [None] + waveform = [] + for wave in utils.chain_iter(nodes.Get_Waveform_Chain(assignmentNode)): + waveform.append(WaveformElement.parse(wave)) - return cls(assignmentNode, label, targetName, expression) + return cls(assignmentNode, label, targetName, waveform) @export diff --git a/pyGHDL/dom/Sequential.py b/pyGHDL/dom/Sequential.py index d2efef8eb..28b6f2b98 100644 --- a/pyGHDL/dom/Sequential.py +++ b/pyGHDL/dom/Sequential.py @@ -421,12 +421,11 @@ class SequentialSimpleSignalAssignment( target = nodes.Get_Target(assignmentNode) targetName = GetNameFromNode(target) - waveform = nodes.Get_Waveform_Chain(assignmentNode) + waveform = [] + for wave in utils.chain_iter(nodes.Get_Waveform_Chain(assignmentNode)): + waveform.append(WaveformElement.parse(wave)) - # TODO: translate waveforms to series of "expressions". - expression = [None] - - return cls(assignmentNode, targetName, expression, label) + return cls(assignmentNode, targetName, waveform, label) @export diff --git a/pyGHDL/dom/_Translate.py b/pyGHDL/dom/_Translate.py index dfc919504..133d9386f 100644 --- a/pyGHDL/dom/_Translate.py +++ b/pyGHDL/dom/_Translate.py @@ -41,6 +41,7 @@ from pyGHDL.dom.Sequential import ( SequentialReportStatement, SequentialAssertStatement, WaitStatement, + SequentialSimpleSignalAssignment, ) from pyVHDLModel.SyntaxModel import ( Constraint, @@ -886,11 +887,7 @@ def GetSequentialStatementsFromChainedNodes( elif kind == nodes.Iir_Kind.Case_Statement: yield CaseStatement.parse(statement, label) elif kind == nodes.Iir_Kind.Simple_Signal_Assignment_Statement: - print( - "[NOT IMPLEMENTED] (Simple) signal assignment (label: '{label}') at line {line}".format( - label=label, line=pos.Line - ) - ) + yield SequentialSimpleSignalAssignment.parse(statement, label) elif kind in ( nodes.Iir_Kind.Variable_Assignment_Statement, nodes.Iir_Kind.Conditional_Variable_Assignment_Statement, |