Fix toggle coverage dataDeclp error on multi-edge driven signals.

This commit is contained in:
Wilson Snyder 2024-02-08 19:21:44 -05:00
parent be471e9ccc
commit a23cf1ceea
7 changed files with 56 additions and 3 deletions

View File

@ -46,6 +46,7 @@ Verilator 5.021 devel
* Fix $fwrite of null (#4862). [Jose Tejada]
* Fix GCC tautological-compare warnings.
* Fix compile error on structs with queues (and ignore toggle coverage on queues).
* Fix toggle coverage dataDeclp error on multi-edge driven signals.
Verilator 5.020 2024-01-01

View File

@ -2653,7 +2653,7 @@ public:
const char* broken() const override {
if (m_dataDeclp
&& (m_dataDeclp == this || m_dataDeclp->m_dataDeclp)) { // Avoid O(n^2) accessing
v3fatalSrc("dataDeclp should point to real data, not be a list");
v3fatalSrc("dataDeclp should point to real data, not be a list: " << cvtToHex(this));
}
return nullptr;
}

View File

@ -48,6 +48,8 @@ class CoverageJoinVisitor final : public VNVisitor {
V3DupFinder dupFinder; // Duplicate code detection
// Hash all of the original signals we toggle cover
for (AstCoverToggle* nodep : m_toggleps) dupFinder.insert(nodep->origp());
if (dumpLevel() || debug() >= 9)
dupFinder.dumpFile(v3Global.debugFilename("coveragejoin") + ".hash", false);
// Find if there are any duplicates
for (AstCoverToggle* nodep : m_toggleps) {
// nodep->backp() is null if we already detected it's a duplicate and unlinked earlier
@ -85,7 +87,8 @@ class CoverageJoinVisitor final : public VNVisitor {
}
// VISITORS
void visit(AstNetlist* nodep) override {
void visit(AstActive* nodep) override {
m_toggleps.clear();
// Find all Coverage's
iterateChildren(nodep);
// Simplify

View File

@ -53,6 +53,7 @@ V3DupFinder::iterator V3DupFinder::findDuplicate(AstNode* nodep, V3DupFinderUser
}
void V3DupFinder::dumpFile(const string& filename, bool tree) {
UINFO(2, "Dumping " << filename << endl);
const std::unique_ptr<std::ofstream> logp{V3File::new_ofstream(filename)};
if (logp->fail()) v3fatal("Can't write " << filename);

View File

@ -23,7 +23,7 @@ inline_checks();
file_grep_not("$Self->{obj_dir}/coverage.dat", "largeish");
file_grep($Self->{stats}, qr/Coverage, Toggle points joined\s+(\d+)/i, 25)
file_grep($Self->{stats}, qr/Coverage, Toggle points joined\s+(\d+)/i, 23)
if $Self->{vlt_all};
run(cmd => ["../bin/verilator_coverage",

View File

@ -0,0 +1,24 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
top_filename("t/t_interface_array2.v");
compile(
v_flags2 => ["--coverage"],
);
execute(
check_finished => 1,
);
ok(1);
1;

View File

@ -0,0 +1,24 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003-2009 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
top_filename("t/t_interface_modport.v");
compile(
verilator_flags2 => ["-fno-inline --coverage"],
);
execute(
check_finished => 1,
);
ok(1);
1;