diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-08-17 10:44:34 +0200 |
---|---|---|
committer | umarcor <unai.martinezcorral@ehu.eus> | 2021-08-23 16:35:36 +0200 |
commit | 2488e55caba1c369785a93ab2578c4a1e0c40c65 (patch) | |
tree | eb6ec11eb8f67e264644e13aec3bcbda4b55bd22 | |
parent | c34b020a8c1b6aa5083a637e3e9062c7a71b309a (diff) | |
download | ghdl-2488e55caba1c369785a93ab2578c4a1e0c40c65.tar.gz ghdl-2488e55caba1c369785a93ab2578c4a1e0c40c65.tar.bz2 ghdl-2488e55caba1c369785a93ab2578c4a1e0c40c65.zip |
Read condition, message and severity from asserts and reports.
-rw-r--r-- | pyGHDL/dom/Sequential.py | 34 | ||||
-rw-r--r-- | testsuite/pyunit/Current.vhdl | 5 |
2 files changed, 22 insertions, 17 deletions
diff --git a/pyGHDL/dom/Sequential.py b/pyGHDL/dom/Sequential.py index cb6fa5a8f..b0f1d2e97 100644 --- a/pyGHDL/dom/Sequential.py +++ b/pyGHDL/dom/Sequential.py @@ -466,19 +466,19 @@ class SequentialAssertStatement(VHDLModel_SequentialAssertStatement, DOMMixin): severity: Expression = None, label: str = None, ): - super().__init__(label, condition, message, severity, label) + super().__init__(condition, message, severity, label) DOMMixin.__init__(self, assertNode) - @classmethod - def parse(cls, assertNode: Iir, label: str) -> "SequentialAssertStatement": - from pyGHDL.dom._Utils import GetIirKindOfNode - from pyGHDL.dom._Translate import GetExpressionFromNode + @classmethod + def parse(cls, assertNode: Iir, label: str) -> "SequentialAssertStatement": + from pyGHDL.dom._Translate import GetExpressionFromNode - condition = "" - message = "" - severity = "" + condition = GetExpressionFromNode(nodes.Get_Assertion_Condition(assertNode)) + message = GetExpressionFromNode(nodes.Get_Report_Expression(assertNode)) + severityNode = nodes.Get_Severity_Expression(assertNode) + severity = None if severityNode is nodes.Null_Iir else GetExpressionFromNode(severityNode) - return cls(assertNode, condition, message, severity, label) + return cls(assertNode, condition, message, severity, label) @export @@ -490,15 +490,15 @@ class SequentialReportStatement(VHDLModel_SequentialReportStatement, DOMMixin): severity: Expression = None, label: str = None, ): - super().__init__(label, message, severity, label) + super().__init__(message, severity, label) DOMMixin.__init__(self, reportNode) - @classmethod - def parse(cls, reportNode: Iir, label: str) -> "SequentialReportStatement": - from pyGHDL.dom._Utils import GetIirKindOfNode - from pyGHDL.dom._Translate import GetExpressionFromNode + @classmethod + def parse(cls, reportNode: Iir, label: str) -> "SequentialReportStatement": + from pyGHDL.dom._Translate import GetExpressionFromNode - message = "" - severity = "" + message = GetExpressionFromNode(nodes.Get_Report_Expression(reportNode)) + severityNode = nodes.Get_Severity_Expression(reportNode) + severity = None if severityNode is nodes.Null_Iir else GetExpressionFromNode(severityNode) - return cls(reportNode, message, severity, label) + return cls(reportNode, message, severity, label) diff --git a/testsuite/pyunit/Current.vhdl b/testsuite/pyunit/Current.vhdl index a397e8700..69f324f37 100644 --- a/testsuite/pyunit/Current.vhdl +++ b/testsuite/pyunit/Current.vhdl @@ -120,6 +120,11 @@ begin assert true nor false report "nothing" severity warning or error; when others => end case; + + report "hello" & " " & "world"; + report "vhdl" severity note; + assert true nor false report "nothing"; + assert true nor false report "nothing" severity warning; end process; a <= b; |