summaryrefslogtreecommitdiff
path: root/tb/top/conspiracion.cpp
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2023-09-25 23:46:34 -0600
committerAlejandro Soto <alejandro@34project.org>2023-09-25 23:46:34 -0600
commit1db38c7cccd74af09109a5161edc95233e75fc74 (patch)
tree8c2e776635286974a630fee28eebc2afcbcc1627 /tb/top/conspiracion.cpp
parent9fa82e6621df63335199b7abc0b4ca8acd2f3e03 (diff)
tb: implement coverage reports
Diffstat (limited to '')
-rw-r--r--tb/top/conspiracion.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/tb/top/conspiracion.cpp b/tb/top/conspiracion.cpp
index 4f0fb3d..49c05bf 100644
--- a/tb/top/conspiracion.cpp
+++ b/tb/top/conspiracion.cpp
@@ -261,6 +261,11 @@ int main(int argc, char **argv)
parser, "image", "Executable image to run", args::Options::Required
);
+ args::Positional<std::string> coverage_out
+ (
+ parser, "coverage-out", "Coverage output file"
+ );
+
try
{
parser.ParseCLI(argc, argv);
@@ -757,32 +762,25 @@ int main(int argc, char **argv)
core.fetch->explicit_branch__VforceEn = 0;
}
- if(!no_tty)
- {
+ if (!no_tty)
ttyJ0.release();
- }
- if(enable_trace)
- {
+ if (enable_trace)
trace.close();
- }
- if(dump_regs)
- {
+ if (dump_regs)
do_reg_dump();
- }
const auto &dumps = *dump_mem;
- if(!dumps.empty())
- {
+ if (!dumps.empty())
do_mem_dump(dumps.data(), dumps.size());
- }
top.final();
- if(ctrl != stdout)
- {
+ if (ctrl != stdout)
std::fclose(ctrl);
- }
+
+ if (coverage_out)
+ Verilated::threadContextp()->coveragep()->write(coverage_out->c_str());
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
}