verilator_coverage and ChiselTest

65 views
Skip to first unread message

Warren Savage

unread,
Aug 27, 2023, 10:07:27 PM8/27/23
to chisel-users
Does anyone know whether the verilator_coverage feature works with ChiselTest?

After simulation I get a coverage.dat file with a single line:
# SystemC::Coverage-3

I'm assuming it doesn't work, because I've never seen any mention of embedding Verilator pragmas into Chisel.  But then I see the flags for it in  FIRRTL, which seems odd.

I thought I'd ask this esteemed group here in case I missed something.

Second, somewhat related question.  Is it possible to run a Verilator simulation outside of sbt?  When I run a previously generated verilated binary from the bash shell, I get a segmentation fault.

Warren

Kevin Laeufer

unread,
Aug 28, 2023, 9:27:54 AM8/28/23
to chisel...@googlegroups.com
Hi Warren,

chiseltest enables "user" coverage by default to collect count for any
`cover` statements in the Chisel source code.

An example can be found here:
https://scastie.scala-lang.org/6lCoSG9PR5iHT1LlBKtJTw
This uses the default treadle backend, since Verilator is not supported
on Scastie. However, you should be able to run the same example locally
and switch the backend to use Verilator, and it should work exactly the
same.

Addressing your second question: The C++ test harness generated by
chiseltest is meant to be a JNA library that can be loaded into the JVM
to allow your Scala testbench to interact with the native simulator with
minimal overhead. Thus, you cannot execute it. You could write your own
C++ testbench. However, since all the inputs and expected outputs are
still encoded as a Scala program, you would also have to port those
manually.
There used to be an option that allowed users to export test stimuli as
a Verilog testbench. We could bring that back if there is demand or even
implementation help from the community.

Best,
Kevin
> --
> You received this message because you are subscribed to the Google
> Groups "chisel-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to chisel-users...@googlegroups.com
> <mailto:chisel-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chisel-users/398eed63-c481-4be3-8afd-d8aef60dfe48n%40googlegroups.com <https://groups.google.com/d/msgid/chisel-users/398eed63-c481-4be3-8afd-d8aef60dfe48n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Warren Savage

unread,
Sep 1, 2023, 1:23:32 PM9/1/23
to chisel...@googlegroups.com
Thanks Kevin,

It works perfectly.

Warren

You received this message because you are subscribed to a topic in the Google Groups "chisel-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/chisel-users/9t2DRNT_9h0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to chisel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chisel-users/716ce610-31d2-739f-d62d-f390109c2e1e%40berkeley.edu.
Reply all
Reply to author
Forward
0 new messages