mirror of
https://github.com/verilator/verilator.git
synced 2026-08-30 01:38:21 +02:00
Fix expression coverage of system calls (#6592)
This commit is contained in:
+7
-4
@@ -141,7 +141,7 @@ class CoverageVisitor final : public VNVisitor {
|
||||
const VNUser2InUse m_inuser2;
|
||||
V3UniqueNames m_exprTempNames; // For generating unique temporary variable names used by
|
||||
// expression coverage
|
||||
std::unordered_map<VNRef<AstFuncRef>, AstVar*> m_funcTemps;
|
||||
std::unordered_map<AstNodeExpr*, AstVar*> m_funcTemps;
|
||||
|
||||
// STATE - across all visitors
|
||||
int m_nextHandle = 0;
|
||||
@@ -277,6 +277,7 @@ class CoverageVisitor final : public VNVisitor {
|
||||
VL_RESTORER(m_modp);
|
||||
VL_RESTORER(m_state);
|
||||
VL_RESTORER(m_exprTempNames);
|
||||
VL_RESTORER(m_funcTemps);
|
||||
createHandle(nodep);
|
||||
m_modp = nodep;
|
||||
m_state.m_inModOff
|
||||
@@ -333,6 +334,7 @@ class CoverageVisitor final : public VNVisitor {
|
||||
void visit(AstNodeFTask* nodep) override {
|
||||
VL_RESTORER(m_ftaskp);
|
||||
VL_RESTORER(m_exprTempNames);
|
||||
VL_RESTORER(m_funcTemps);
|
||||
m_ftaskp = nodep;
|
||||
if (!nodep->dpiImport()) iterateProcedure(nodep);
|
||||
}
|
||||
@@ -784,9 +786,10 @@ class CoverageVisitor final : public VNVisitor {
|
||||
comment += (first ? "" : " && ") + term.m_emitV
|
||||
+ "==" + (term.m_objective ? "1" : "0");
|
||||
AstNodeExpr* covExprp = nullptr;
|
||||
if (AstFuncRef* const frefp = VN_CAST(term.m_exprp, FuncRef)) {
|
||||
AstNodeDType* const dtypep = frefp->taskp()->fvarp()->dtypep();
|
||||
const auto pair = m_funcTemps.emplace(*frefp, nullptr);
|
||||
if (VN_IS(term.m_exprp, FuncRef) || term.m_exprp->isSystemFunc()) {
|
||||
AstNodeExpr* const frefp = term.m_exprp;
|
||||
AstNodeDType* const dtypep = frefp->dtypep();
|
||||
const auto pair = m_funcTemps.emplace(frefp, nullptr);
|
||||
AstVar* varp = pair.first->second;
|
||||
if (pair.second) {
|
||||
varp = new AstVar{fl, VVarType::MODULETEMP, m_exprTempNames.get(frefp),
|
||||
|
||||
Reference in New Issue
Block a user