Add LATCH and NOLATCH warnings (#1609) (#2740).

This commit is contained in:
Julien Margetts
2021-01-05 14:26:01 -05:00
committed by GitHub
parent 6d80e8f856
commit a11700271f
41 changed files with 605 additions and 24 deletions
+7 -1
View File
@@ -127,6 +127,7 @@ private:
// STATE
VDouble0 m_statCaseFast; // Statistic tracking
VDouble0 m_statCaseSlow; // Statistic tracking
AstNode* m_alwaysp = nullptr; // Always in which case is located
// Per-CASE
int m_caseWidth = 0; // Width of valueItems
@@ -475,12 +476,17 @@ private:
++m_statCaseFast;
VL_DO_DANGLING(replaceCaseFast(nodep), nodep);
} else {
// If a case statement is whole, presume signals involved aren't forming a latch
if (m_alwaysp) m_alwaysp->fileline()->warnOff(V3ErrorCode::LATCH, true);
++m_statCaseSlow;
VL_DO_DANGLING(replaceCaseComplicated(nodep), nodep);
}
}
//--------------------
virtual void visit(AstNode* nodep) override { iterateChildren(nodep); }
virtual void visit(AstNode* nodep) override {
if (VN_IS(nodep, Always)) { m_alwaysp = nodep; }
iterateChildren(nodep);
}
public:
// CONSTRUCTORS