2020-05-05 00:42:15 +02:00
|
|
|
#!/usr/bin/env perl
|
2008-12-05 16:54:14 +01:00
|
|
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
|
|
|
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
|
|
|
|
#
|
2020-03-21 16:24:24 +01:00
|
|
|
# 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
|
2009-05-04 23:07:57 +02:00
|
|
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
|
# Version 2.0.
|
2020-03-21 16:24:24 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2008-12-05 16:54:14 +01:00
|
|
|
|
2018-05-08 02:42:28 +02:00
|
|
|
scenarios(simulator => 1);
|
|
|
|
|
|
2011-07-29 01:41:05 +02:00
|
|
|
top_filename("t/t_cover_line.v");
|
2021-01-13 00:09:56 +01:00
|
|
|
golden_filename("t/t_cover_line.out");
|
2011-07-29 01:41:05 +02:00
|
|
|
|
2018-05-07 04:39:18 +02:00
|
|
|
compile(
|
2020-01-12 10:03:17 +01:00
|
|
|
verilator_flags2 => ['--cc --coverage-line +define+ATTRIBUTE'],
|
2017-09-23 14:50:39 +02:00
|
|
|
);
|
2008-12-05 16:54:14 +01:00
|
|
|
|
2018-05-07 04:39:18 +02:00
|
|
|
execute(
|
|
|
|
|
check_finished => 1,
|
2017-09-23 14:50:39 +02:00
|
|
|
);
|
2008-12-05 16:54:14 +01:00
|
|
|
|
|
|
|
|
# Read the input .v file and do any CHECK_COVER requests
|
|
|
|
|
inline_checks();
|
|
|
|
|
|
2024-03-01 01:08:28 +01:00
|
|
|
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
|
2023-02-09 02:15:11 +01:00
|
|
|
"--annotate-points",
|
2018-05-08 02:42:28 +02:00
|
|
|
"--annotate", "$Self->{obj_dir}/annotated",
|
2020-05-16 12:15:25 +02:00
|
|
|
"$Self->{obj_dir}/coverage.dat"],
|
|
|
|
|
verilator_run => 1,
|
|
|
|
|
);
|
2014-11-24 03:06:10 +01:00
|
|
|
|
2021-01-13 00:09:56 +01:00
|
|
|
files_identical("$Self->{obj_dir}/annotated/t_cover_line.v", $Self->{golden_filename});
|
2014-11-24 03:06:10 +01:00
|
|
|
|
2020-05-16 15:18:35 +02:00
|
|
|
# Also try lcov
|
2024-03-01 01:08:28 +01:00
|
|
|
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
|
2020-05-16 15:18:35 +02:00
|
|
|
"--write-info", "$Self->{obj_dir}/coverage.info",
|
|
|
|
|
"$Self->{obj_dir}/coverage.dat"],
|
|
|
|
|
verilator_run => 1,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
# If installed
|
2020-05-19 14:24:11 +02:00
|
|
|
if (`lcov --version` !~ /version/i
|
|
|
|
|
|| `genhtml --version` !~ /version ([0-9.]+)/i) {
|
2020-05-16 15:18:35 +02:00
|
|
|
skip("lcov or genhtml not installed");
|
2020-05-19 14:24:11 +02:00
|
|
|
} elsif ($1 < 1.14) {
|
|
|
|
|
skip("lcov or genhtml too old (version $1), need version >= 1.14");
|
2020-05-16 15:18:35 +02:00
|
|
|
} else {
|
|
|
|
|
run(cmd => ["genhtml",
|
|
|
|
|
"$Self->{obj_dir}/coverage.info",
|
|
|
|
|
"--output-directory $Self->{obj_dir}/html",
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-11-02 02:40:55 +01:00
|
|
|
ok(1);
|
2008-12-05 16:54:14 +01:00
|
|
|
1;
|