-
Notifications
You must be signed in to change notification settings - Fork 177
[RFC] new cover-values
statement to efficiently count mutually-exclusive events
#2395
Comments
Just a thought... for the existing Boolean case, excluding 0 makes sense for obvious reasons. But it's not clear that excluding 0 for the generalized UInt case is the right thing to do. It's also not clear that including all values through 2^w-1 is always the right thing to do either. (Consider covering all states of a state machine, where the valid states are 0..5.) So, maybe the API would benefit from being generalized to accept a range or a set of integral values (or a description of the enum type, in the state-machine example). |
Thanks for your insightful feedback @aswaterman !
I agree. I think I was overzealous to make everything fit into the current
I was planning for this to be a low-level firrtl API, so the new One thing I think is worth considering is a |
cover
statement predicate to be wider than 1-bitcover-values
statement to efficiently count mutually-exclusive events
Derp. Not sure why I responded in the chisel context, given the repo we're on.
Yeah, makes sense.
Yeah, I appreciate the economy of keeping the new primitive zero-based and using additional nodes to map more general input ranges onto the new primitive. |
I'm not an expert on SVA either, but this sounds like a proposal for synthesizable covergroups/coverpoints in FIRRTL and is leading towards also adding support for coverpoint bins. I think the notion of "only caring about a subset of all possible values a signal can take" is equivalent to defining coverpoint bins for the states you care about and then binning everything else into an "invalid" bin (which is likely also useful to know about). I think both support for emitting SVA coverpoint/covergroup and synthesizing these into hardware is useful. The synthesis of these is pushing more towards FireSim type concepts which have not been previously explored? We should add whatever ops we need to FIRRTL IR to represent these concepts. I do admit that these concepts are likely far, far easier to implement/model/realize in CIRCT than in Scala FIRRTL and I'm not opposed to prototyping the support in CIRCT first. There's already support for the more SVA-flavored things in CIRCT's SystemVerilog Dialect (e.g., force/release and both concurrent and immediate flavors of assert/assume/cover). I have not needed to add coverpoint/covergroup, but that's clearly missing. It is likely also worth having @darthscsi weigh in here. |
Checklist
Feature Description
I would like to extend the firrtl spec to add a new
cover-values
(working name, could easily be changed) statement that excepts any ground type wire as input. This statement asks the simulation backend to count how often each possible value of the input is present on a rising clock edge.For a 2-bit signal like
val a = IO(Input(UInt(2.W)))
writingcover-values(a)
would now be equivalent to writing:The important difference is that with the
cover-values(a)
construct, we know by construction, that a has only one value per cycle. Thus the count can be implemented by indexing into an array (for software simulation) or into a memory (for FPGA accelerated simulation).This new feature would allow us to specify the state coverage metric used by the DiFuzz paper: https://github.com/compsec-snu/difuzz-rtl
I do not know yet what Verilog construct this would best map to. Maybe @seldridge or @jackkoenig have a good idea.
Type of Feature
The text was updated successfully, but these errors were encountered: