cocotb verilator code coverage support
See original GitHub issueCould you add verilator coverage support in the following file:
cocotb/share/lib/verilator/verilator.cpp
diff --git a/cocotb/share/lib/verilator/verilator.cpp b/cocotb/share/lib/verilator/verilator.cpp
index aff06d9..fc43374 100644
--- a/cocotb/share/lib/verilator/verilator.cpp
+++ b/cocotb/share/lib/verilator/verilator.cpp
@@ -84,5 +84,9 @@ int main(int argc, char** argv) {
tfp->close();
#endif
+#if VM_COVERAGE
+ VerilatedCov::write("coverage.dat");
+#endif
+
return 0;
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Simulator Support — cocotb 1.7.2 documentation
In general, cocotb can be used with any simulator supporting the ... To enable HDL code coverage, add Verilator's coverage option(s) to the...
Read more >cocotb/Lobby - Gitter
Hi all, what's the current status of Verilator support now that v5 is out? Are any of the blockers for using Cocotb with...
Read more >Tutorials — cocotb_coverage 1.0 documentation
coverage_section is a concept introduced in cocotb-coverage, that allows for separating the coverage code from the testbench code. It allows for packing the ......
Read more >Frameworks and Methodologies — Open Source Verification ...
The most notable difference is that cocotb supports iverilog and verilator, while the only open source simulator supported by VUnit is GHDL.
Read more >Recently Active 'cocotb' Questions - Stack Overflow
Code : @cocotb.test() async def test(dut) for i in . ... I am trying to modify the default python and run with the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I noticed that even when I enable verilator code coverage with
EXTRA_ARGS= --coverage
, coverage.dat file is not getting generated even with the above fix (as mentioned in https://github.com/cocotb/cocotb/issues/2573#issuecomment-865454544).After a quick debug I noticed that anything after
vl_finish(__FILE__, __LINE__, "");
incocotb/share/lib/verilator/verilator.cpp
is not getting executed. SoVerilatedCov::write("coverage.dat");
that was added for this issue never got executed andcoverage.dat
file was not dumped.I was able to get the coverage file to be dumped by moving the
VerilatedCov::write
call right beforevl_finish
as below.https://github.com/cocotb/cocotb/pull/1479
Hope this is sufficient. Thanks