Hello,
I have a covergroup that I want to sample when a specific state of the FSM ends.
For example, when state_1 ends (and the next state is different) then the group should be sampled.
One way I thought of doing it, is to have 2 variable of cur_state and next_state in my coverage file, and in the main_phase task compare them and if they are different then sample.
Is there a more elegant way? I have inspiration from transition sampling in bins (STATE_1 => STATE_2) or iff of some kind.
Thank you very much.
About the second solution, is it possible/correct to write it as:
bins end_state_1 = (STATE_1 => (~STATE_1));
So basically, transition from STATE_1 to anything else?
Also, I need to sample a value when STATE_1 ends, so if I’ll do a cross between a value and a transition, will it give the value at the time the state ends?
That will not work because Kit just inverts the bits of the encoding for STATE_1, which may or may not be another valid state encoding.
I think we are getting into sn XY problem. You should call sample() on the variable you want covered the the code in your task detects that it has exited STATE_1