Skip to content

Commit

Permalink
Account node purity when checking if dynamic trigger is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
kiryk committed Oct 18, 2023
1 parent a0220ed commit 86012ec
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/V3Timing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 varp->varp()->isFuncLocal();
}
return !nodep->isPure();
});
}
// Returns true if the given trigger expression needs a destructive post update after trigger
Expand Down

0 comments on commit 86012ec

Please sign in to comment.