Fix covergroups without --coverage (#7848)
This commit is contained in:
parent
3853301367
commit
3f4c6d34f8
|
|
@ -146,6 +146,7 @@ Jose Loyola
|
||||||
Josep Sans
|
Josep Sans
|
||||||
Joseph Nwabueze
|
Joseph Nwabueze
|
||||||
Josh Redford
|
Josh Redford
|
||||||
|
Joshua Leahy
|
||||||
Julian Carrier
|
Julian Carrier
|
||||||
Julian Daube
|
Julian Daube
|
||||||
Julie Schwartz
|
Julie Schwartz
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief Verilated functional-coverage collection runtime implementation
|
/// \brief Verilated functional-coverage collection runtime implementation
|
||||||
///
|
///
|
||||||
/// Compiled and linked when "verilator --coverage" is used with covergroups.
|
/// Linked when covergroups are present. The coverage-database registration
|
||||||
|
/// is compiled only with "verilator --coverage".
|
||||||
///
|
///
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
|
|
@ -22,7 +23,9 @@
|
||||||
|
|
||||||
#include "verilated_covergroup.h"
|
#include "verilated_covergroup.h"
|
||||||
|
|
||||||
#include "verilated_cov.h"
|
#if VM_COVERAGE
|
||||||
|
# include "verilated_cov.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void VlCoverpoint::init(const char* hier, uint32_t atLeast, int nBins) {
|
void VlCoverpoint::init(const char* hier, uint32_t atLeast, int nBins) {
|
||||||
m_hier = hier;
|
m_hier = hier;
|
||||||
|
|
@ -54,6 +57,7 @@ std::string VlCoverpoint::binName(int i) const {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VM_COVERAGE
|
||||||
void VlCoverpoint::registerBins(VerilatedCovContext* covcontextp, const char* page) {
|
void VlCoverpoint::registerBins(VerilatedCovContext* covcontextp, const char* page) {
|
||||||
for (int i = 0; i < binCount(); ++i) {
|
for (int i = 0; i < binCount(); ++i) {
|
||||||
const VlCovNamer& nm = namerFor(i);
|
const VlCovNamer& nm = namerFor(i);
|
||||||
|
|
@ -76,3 +80,4 @@ void VlCoverpoint::registerBins(VerilatedCovContext* covcontextp, const char* pa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // VM_COVERAGE
|
||||||
|
|
|
||||||
|
|
@ -683,7 +683,8 @@ class EmitCHeader final : public EmitCConstInit {
|
||||||
if (v3Global.opt.mtasks()) puts("#include \"verilated_threads.h\"\n");
|
if (v3Global.opt.mtasks()) puts("#include \"verilated_threads.h\"\n");
|
||||||
if (v3Global.opt.savable()) puts("#include \"verilated_save.h\"\n");
|
if (v3Global.opt.savable()) puts("#include \"verilated_save.h\"\n");
|
||||||
if (v3Global.opt.coverage()) puts("#include \"verilated_cov.h\"\n");
|
if (v3Global.opt.coverage()) puts("#include \"verilated_cov.h\"\n");
|
||||||
if (v3Global.opt.coverage()) puts("#include \"verilated_covergroup.h\"\n");
|
if (v3Global.opt.coverage() || v3Global.useCovergroup())
|
||||||
|
puts("#include \"verilated_covergroup.h\"\n");
|
||||||
if (v3Global.usesTiming()) puts("#include \"verilated_timing.h\"\n");
|
if (v3Global.usesTiming()) puts("#include \"verilated_timing.h\"\n");
|
||||||
if (v3Global.useRandomizeMethods()) puts("#include \"verilated_random.h\"\n");
|
if (v3Global.useRandomizeMethods()) puts("#include \"verilated_random.h\"\n");
|
||||||
if (v3Global.usesForce()) puts("#include \"verilated_force.h\"\n");
|
if (v3Global.usesForce()) puts("#include \"verilated_force.h\"\n");
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ class EmitCModel final : public EmitCFunc {
|
||||||
if (v3Global.opt.mtasks()) puts("#include \"verilated_threads.h\"\n");
|
if (v3Global.opt.mtasks()) puts("#include \"verilated_threads.h\"\n");
|
||||||
if (v3Global.opt.savable()) puts("#include \"verilated_save.h\"\n");
|
if (v3Global.opt.savable()) puts("#include \"verilated_save.h\"\n");
|
||||||
if (v3Global.opt.coverage()) puts("#include \"verilated_cov.h\"\n");
|
if (v3Global.opt.coverage()) puts("#include \"verilated_cov.h\"\n");
|
||||||
if (v3Global.opt.coverage()) puts("#include \"verilated_covergroup.h\"\n");
|
if (v3Global.opt.coverage() || v3Global.useCovergroup())
|
||||||
|
puts("#include \"verilated_covergroup.h\"\n");
|
||||||
if (v3Global.dpi()) puts("#include \"svdpi.h\"\n");
|
if (v3Global.dpi()) puts("#include \"svdpi.h\"\n");
|
||||||
|
|
||||||
// Declare foreign instances up front to make C++ happy
|
// Declare foreign instances up front to make C++ happy
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,8 @@ std::vector<std::string> V3Global::verilatedCppFiles() {
|
||||||
if (v3Global.opt.vpi()) result.emplace_back("verilated_vpi.cpp");
|
if (v3Global.opt.vpi()) result.emplace_back("verilated_vpi.cpp");
|
||||||
if (v3Global.opt.savable()) result.emplace_back("verilated_save.cpp");
|
if (v3Global.opt.savable()) result.emplace_back("verilated_save.cpp");
|
||||||
if (v3Global.opt.coverage()) result.emplace_back("verilated_cov.cpp");
|
if (v3Global.opt.coverage()) result.emplace_back("verilated_cov.cpp");
|
||||||
if (v3Global.opt.coverage()) result.emplace_back("verilated_covergroup.cpp");
|
if (v3Global.opt.coverage() || v3Global.useCovergroup())
|
||||||
|
result.emplace_back("verilated_covergroup.cpp");
|
||||||
for (const string& base : v3Global.opt.traceSourceBases())
|
for (const string& base : v3Global.opt.traceSourceBases())
|
||||||
result.emplace_back(base + "_c.cpp");
|
result.emplace_back(base + "_c.cpp");
|
||||||
if (v3Global.usesProbDist()) result.emplace_back("verilated_probdist.cpp");
|
if (v3Global.usesProbDist()) result.emplace_back("verilated_probdist.cpp");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# 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-FileCopyrightText: 2026 Wilson Snyder
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||||
|
|
||||||
|
import vltest_bootstrap
|
||||||
|
|
||||||
|
test.scenarios('vlt_all')
|
||||||
|
test.top_filename = 't/t_covergroup_cross.v'
|
||||||
|
|
||||||
|
# runs without --coverage
|
||||||
|
test.compile(verilator_flags2=['--Wno-COVERIGN'])
|
||||||
|
|
||||||
|
test.execute()
|
||||||
|
|
||||||
|
test.passes()
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# 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-FileCopyrightText: 2026 Wilson Snyder
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||||
|
|
||||||
|
import vltest_bootstrap
|
||||||
|
|
||||||
|
test.scenarios('vlt')
|
||||||
|
test.top_filename = 't/t_covergroup_option.v'
|
||||||
|
|
||||||
|
# runs without --coverage
|
||||||
|
test.compile(verilator_flags2=['--Wno-COVERIGN'])
|
||||||
|
|
||||||
|
test.execute()
|
||||||
|
|
||||||
|
test.passes()
|
||||||
Loading…
Reference in New Issue