Add --coverage-max-width (#2853).

This commit is contained in:
Wilson Snyder 2021-03-29 18:54:51 -04:00
parent 6d3ec160e1
commit c62546c761
8 changed files with 43 additions and 3 deletions

View File

@ -17,6 +17,7 @@ Verilator 4.201 devel
* Changed TIMESCALEMOD from error into a warning.
* Verilated signals now use VlWide and VlPacked in place of C arrays.
* Mark --no-relative-cfuncs as scheduled for deprecation.
* Add --coverage-max-width (#2853). [xuejiazidi]
* Add VerilatedCovContext::forcePerInstance (#2793). [Kevin Laeufer]
* Fix class unpacked-array compile error (#2774). [Iru Cai]
* Fix exceeding command-line ar limit (#2834). [Yinan Xu]

View File

@ -313,6 +313,7 @@ arguments.
--converge-limit <loops> Tune convergence settle time
--coverage Enable all coverage
--coverage-line Enable line coverage
--coverage-max-width <width> Maximum array depth for coverage
--coverage-toggle Enable toggle coverage
--coverage-user Enable SVL user coverage
--coverage-underscore Enable coverage of _signals
@ -697,6 +698,12 @@ Note Verilator may over-count combinatorial (non-clocked) blocks when those
blocks receive signals which have had the UNOPTFLAT warning disabled; for
most accurate results do not disable this warning when using coverage.
=item --trace-max-width I<width>
Rarely needed. Specify the maximum bit width of a signal that is subject
to toggle coverage. Defaults to 256, as covering large vectors may greatly
slow coverage simulations.
=item --coverage-toggle
Specifies signal toggle coverage analysis code should be inserted.

View File

@ -96,8 +96,9 @@ private:
if (prettyName[0] == '_') return "Leading underscore";
if (prettyName.find("._") != string::npos) return "Inlined leading underscore";
}
if ((nodep->width() * nodep->dtypep()->arrayUnpackedElements()) > 256) {
return "Wide bus/array > 256 bits";
if ((nodep->width() * nodep->dtypep()->arrayUnpackedElements())
> static_cast<uint32_t>(v3Global.opt.coverageMaxWidth())) {
return "Wide bus/array > --coverage-max-width setting's bits";
}
// We allow this, though tracing doesn't
// if (nodep->arrayp(1)) return "Unsupported: Multi-dimensional array";

View File

@ -1237,6 +1237,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
DECL_OPTION("-coverage", CbOnOff, [this](bool flag) { coverage(flag); });
DECL_OPTION("-converge-limit", Set, &m_convergeLimit);
DECL_OPTION("-coverage-line", OnOff, &m_coverageLine);
DECL_OPTION("-coverage-max-width", Set, &m_coverageMaxWidth);
DECL_OPTION("-coverage-toggle", OnOff, &m_coverageToggle);
DECL_OPTION("-coverage-underscore", OnOff, &m_coverageUnderscore);
DECL_OPTION("-coverage-user", OnOff, &m_coverageUser);

View File

@ -283,6 +283,7 @@ private:
int m_buildJobs = 1; // main switch: -j
int m_convergeLimit = 100; // main switch: --converge-limit
int m_coverageMaxWidth = 256; // main switch: --coverage-max-width
int m_dumpTree = 0; // main switch: --dump-tree
int m_gateStmts = 100; // main switch: --gate-stmts
int m_ifDepth = 0; // main switch: --if-depth
@ -477,6 +478,7 @@ public:
int buildJobs() const { return m_buildJobs; }
int convergeLimit() const { return m_convergeLimit; }
int coverageMaxWidth() const { return m_coverageMaxWidth; }
int dumpTree() const { return m_dumpTree; }
bool dumpTreeAddrids() const { return m_dumpTreeAddrids; }
int gateStmts() const { return m_gateStmts; }

View File

@ -21,6 +21,8 @@ execute(
# Read the input .v file and do any CHECK_COVER requests
inline_checks();
file_grep_not("$Self->{obj_dir}/coverage.dat", "largeish");
file_grep($Self->{stats}, qr/Coverage, Toggle points joined\s+(\d+)/i, 25)
if $Self->{vlt_all};

View File

@ -62,7 +62,7 @@ module t (/*AUTOARG*/
reg [1:0] memory[121:110];
reg [1023:0] largeish;
wire [1023:0] largeish = {992'h0, cyc};
// CHECK_COVER_MISSING(-1)
always @ (posedge clk) begin

View File

@ -0,0 +1,26 @@
#!/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(vlt => 1);
top_filename("t/t_cover_toggle.v");
compile(
verilator_flags2 => ['--cc --coverage-toggle --coverage-max-width 1025'],
);
execute(
check_finished => 1,
);
file_grep("$Self->{obj_dir}/coverage.dat", "largeish");
ok(1);
1;