From 721e5401e99962d2dfd1ca5fe768db15dd24b20a Mon Sep 17 00:00:00 2001 From: Aleksander Kiryk Date: Wed, 18 Oct 2023 15:55:53 +0200 Subject: [PATCH] Account node purity when checking if dynamic trigger is needed --- src/V3Timing.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/V3Timing.cpp b/src/V3Timing.cpp index 93c5538ac4c..bb05b1a31a0 100644 --- a/src/V3Timing.cpp +++ b/src/V3Timing.cpp @@ -578,8 +578,11 @@ class TimingControlVisitor final : public VNVisitor { // Returns true if we are under a class or the given tree has any references to locals. These // are cases where static, globally-evaluated triggers are not suitable. bool needDynamicTrigger(AstNode* const nodep) const { - return m_classp || nodep->exists([](const AstNodeVarRef* const refp) { - return refp->varp()->isFuncLocal(); + return m_classp || nodep->exists([](AstNode* const nodep) { + if (AstNodeVarRef *varp = VN_CAST(nodep, NodeVarRef)) { + return refp->varp()->isFuncLocal(); + } + return !nodep->isPure(); }); } // Returns true if the given trigger expression needs a destructive post update after trigger