From a4a1c7a38419e20437811bc57b9fb454c1612c59 Mon Sep 17 00:00:00 2001 From: Tomasz Gorochowik Date: Fri, 29 May 2020 19:03:04 +0200 Subject: [PATCH] Fix swerv issues with Increment nodes (#2380) --- src/V3LinkInc.cpp | 8 ++++++++ test_regress/t/t_array_index_increment.v | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/V3LinkInc.cpp b/src/V3LinkInc.cpp index 381f81ff8..cf3599958 100644 --- a/src/V3LinkInc.cpp +++ b/src/V3LinkInc.cpp @@ -124,6 +124,14 @@ private: iterateChildren(nodep); m_insStmtp = NULL; // Next thing should be new statement } + virtual void visit(AstNodeBlock* nodep) VL_OVERRIDE { + AstNode* insStmtp_prev = m_insStmtp; + { + m_insStmtp = NULL; + iterateChildren(nodep); + } + m_insStmtp = insStmtp_prev; + } void unsupported_visit(AstNode* nodep) { m_unsupportedHere = true; UINFO(9, "Marking unsupported " << nodep << endl); diff --git a/test_regress/t/t_array_index_increment.v b/test_regress/t/t_array_index_increment.v index 122227d93..b306f2122 100644 --- a/test_regress/t/t_array_index_increment.v +++ b/test_regress/t/t_array_index_increment.v @@ -107,6 +107,14 @@ module t (/*AUTOARG*/ if (i !== 4) $stop; if (val !== 4) $stop; + + pos = 0; + if (1 == 1) begin + pos++; + end + + if (pos != 1) $stop; + $write("*-* All Finished *-*\n"); $finish;