-
Notifications
You must be signed in to change notification settings - Fork 669
Use separate coverage counters for changes 0 -> 1 and 1 -> 0 #6086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for Git 8000 Hub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Do other simulators likewise capture 0->1 and 1->0 separately? At my site we just look for e.g. 10 transitions, and then know both 0->1 and 1->0 are well covered. This change also increases runtime, but I'm guessing other simulators do it.
I don't understand how this can be faster then the old code, as there's an additional operation, so probably some unintentional artifact, but point is it's small. For multibit signals I think we'd be better off making a function, this will likely help performance a lot. Where you had:
I suggest we do for multibits:
This may be slightly slower if only one bit changes in a bus, but faster if many bits change. Anyhow proof will be in the benchmarking. |
I noticed that candidate for improvement. The same situation is currently on master. Values of |
I know that at least one popular simulator captures 0 -> 1 and 1 -> 0 separately. I also found an article for Aldec Active-HDL which shows separate coverage for 0->1 and 1->0: https://www.aldec.com/en/support/resources/documentation/articles/1511. Also, 10 transitions don't necessary mean that transitions in both directions took place. It isn't true if we have 10 instances of a module which contains only 0->1 transitions. |
Fair points. Note Verilator captures numbers separately for the instances, it's the annotation that might combine them. |
Anyhow I'm ok taking the change but would like the refactoring mentioned to reclaim performance, it can be part of this patch or a separate pre-pull (which has the advantage the tests shouldn't need to change). |
It creates separate toggle coverage counters for changes from 0 to 1 and from 1 to 0.
The counter which should be incremented is chosen by the current value of the bit to which it corresponds. I decided to add the expression which evaluates to the value of that bit to
AstCoverInc
and then emit it as part of index expression ofvlSymsp->__Vcoverage
.We can store the expression in
AstCoverInc
at the beginning, but it is the same expression which is stored inAstCoverToggle
, so I decided to store it only in the latter. WhenAstCoverToggle
is removed, I copy it toAstCoverInc
.