-
Notifications
You must be signed in to change notification settings - Fork 670
Fix toggle coverage of unitialized 4-state signals #6072
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 GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
8000 Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix toggle coverage of unitialized 4-state signals #6072
Conversation
Signed-off-by: Bartłomiej Chmiel <bchmiel@antmicro.com>
Signed-off-by: Bartłomiej Chmiel <bchmiel@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>
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>
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>
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>
…erToggle 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>
I'm worried about the runtime cost here. Usually the practice is to wait for reset, which should clear all user signals, then clear all toggle counters. Does that solve most your concern? |
I don't think it solves our problem. |
Usually there is still some init-done point, and even if not, I dont understand how this change prevents false coverage during first reset. |
This change only prevents from incrementing the coverage counter on the 1st assignment to the variable which has the default value |
My point is from the verification engineer's standpoint, proving something has toggled is related to reset - you can only ensure functionality of a toggle outside reset, so they should zero coverage for all time before reset/init is complete. I also assume that reset clears out critical X's. With both those methodologies I think this change isn't needed. |
Cocotb tests do many resets. They run a single Verilator binary and run multiple tests on it. Each test typically starts with a reset. So if we zero the counters, we'll loose coverage metrics. What do you think about making this feature optional and disabled by default to not slow down simulation for users who don't need it? |
Sorry I was not clear it is only the first init that is not part of any test resets does the clear. Later resets are covered intentionally, so that you can see toggles on resets. Note this means that to see reset in toggle coverage, the test must be out of reset, then do a reset, which is intentional as otherwise resets have not been well proven. |
I am not sure if I understand. Do you mean adding an option to zero counters once |
A methodology should, for tests using any sort of coverage (not just toggle) ,in pseudo-code, do roughly:
|
We want to implement a solution that will not require the user to modify the code, so that they can switch easily from another simulator to Verilator. Manually inserting |
That's fair, implement the standard |
Uninitialized 4-state signals have value
x
. Currently, if the first value assigned to such a signal is 0, the coverage counter is not increment. However, it is incremented if the change is fromx
to 1. I think the incrementation should be skipped in both cases.This draft PR contains WIP implementation of the following approach:
Each bit of a 4-state variable has 2-bit variable associated. It may have the values 0, 1, 2, which have the following meaning:
We change the value from 0 to 1 after the first assignment to the original variable. That assignment takes place before the coverage counter is incremented so that's why we need the value 2. If the value is 1 when the condition of incrementation of the counter is tested, we change the value to 2 instead, to make it incremented after the next change.
The current implementation is not completed yet. I created the PR to discuss the approach.
TODO:
logic
I also had a problem with optimizations. The assignments to
initp
variables were removed in V3Gate, because the reading of their values is added in V3Clock.