Is there a way we can dictate coverage to store transition bin cover info for all variables for which enable = 1 and ignore transition value for sample which is done with enable = 0.
I have added a code snippet below for illustration purpose . The actual covergroup has featurewise covergroup which comprises both transition and non transition coverpoints which intend to be sampled at different events. The intention is to bifurcate the sampling of transition and non-transition coverpoint based on enable. The transition shall be monitored for values when enable is true. e.g;
----------------------------------
a | en | xition_a_cp |
----------------------------------
1 | 1 | 1 => |
x | 0 | ignore |
2 | 1 | 1=>2 (covered) |
----------------------------------
The below code resets the transition sampling even for sample called with enable=0 and intention did not get fulfil.
module cov;
int a;
int b;
bit enable;
covergroup cg();
option.per_instance = 1;
option.name = "cg";
option.comment = "Covergroup";
xition_a_cp : coverpoint a iff ( enable == 1 )
{
bins one_two = (1 => 2);
}
a_cp : coverpoint a iff ( ( a > 1 ) && ( a < 4 ) )
{
bins one = {1};
bins two = {2};
bins three = {3};
}
endgroup
cg cg_;
initial begin
cg_ = new();
#10 b = 1;
#10 b = 2;
#10 b = 3;
#10 b = 4;
$finish;
end
always@(b) begin
cg_.sample(); //Multiple sample should not affect xition_a_cp when enable 0
a = b;
enable = 1;
cg_.sample();
enable = 0;
cg_.sample(); //Multiple sample should not affect xition_a_cp when enable 0
end
endmodule