Coverage issue

Hi,
I want to know that ,can i control (able or disable) the bins on the basis of coverpoint value.

for example :
cg : coverpoint ( abc)
{
bins a = {1};
bins b = {2};
bins c = {3};
bins d = {4};
}

I want to hit only bins a in some condition & ignored all other bins. Can i do this ?
Please reply me as soon as possible.

Regards
Kuldeep Sharma

You can use the following syntax:

bins a = {1} iff(<condition_is_true>);
bins b = {2} iff(!<condition_is_true>);

In reply to mperyer:

Hi
I have tried your syntax but it does not work still bins are hitting .Please give me another suggestion.

Sorry, I used some less than, greater than brackets in my reply which filtered some text:

bins a = {1} iff(condition_is_true);
bins b = {2} iff(!condition_is_true);

In reply to mperyer:

Hi,
HSEL : coverpoint (address_pkt_h.HSEL )
{

  bins HSEL_1 ={1} iff(address_pkt_h.HSEL==1);
  bins HSEL_2 ={2} iff(address_pkt_h.HSEL==2);
  bins HSEL_3 ={4} iff(address_pkt_h.HSEL==4);

}
Always value of HSEL is 1. On the basis of your view bins HSEL_2 &&
bins HSEL_3 never hitted because i have putted condition on these bins
but this is not happening.
Advise me if i am wrong.

Given your code, the iff() syntax is redundant.

What’s the type of HSEL?

Depending on the type, then it is likely that, for instance (HSEL == 4), might not evaluate true or that the bin sample value is never seen.

It would help if you could share the code for your covergroup. Things that would be useful to know:

  1. How are you sampling the covergroup?
  2. How do you decide when to sample the covergroup?
  3. What are the types involved?
  4. Which conditions apply for the sampling of each of your bins to be valid?

Have you checked what values are being sampled by your covergroup? Maybe you’re getting the right answer - i.e. that HSEL is always 1

In reply to mperyer:

Hi,

Type of HSEL is logic.
we are sampling covergroup on the basis of signal collect from bus.
when all signal comes we sample the covergroup.

These point i did not understand ,please expand these points.
3) What are the types involved?
4) Which conditions apply for the sampling of each of your bins to be valid?

Ya, i am checking what values are sampling by covergroup.

If HSEL is of type logic, it can only have a value of 1, 0, x, or z which would explain your problem - i.e. that is why you only see a value of 1 sampled by the covergroup.

But, for instance, if HSEL is of type logic[3:0] then it could take the range of values you are trying to sample only if the bits are not in an unknown state (4’b0001, 4’b0010, 4’b0100, 4’b1000).

In reply to mperyer:

Hi
According to u we control on bins either it is hitted or not ,but according to goal of coverage it is not useful.
For example
HSEL : coverpoint (address_pkt_h.HSEL )
{
bins HSEL_1 ={1} iff(address_pkt_h.HSEL==1);
bins HSEL_2 ={2} iff(address_pkt_h.HSEL==3);
bins HSEL_3 ={4} iff(address_pkt_h.HSEL==4);

HSEL_3 is not hitted because false condition exit in iff so these bins is not hitted . But when we calculated coverage 2 bins is hitting out of 3 bins ,so coverage comes 66.66% .How i will achieve 100% coverage on the basis of my problem.

I want to disable bins on the basis of iff condition & when we calculated coverage ignore that bins.

HSEL suggests an AMBA AHB select line bundle.

Lets assume that your variable HSEL is a 4 bit logic type:

logic [3:0] HSEL;

Lets assume that each bit of HSEL is an active high select line from a bus address decoder to a peripheral.

Lets assume that you sample HSEL when a bus cycle is complete in order that you can check that your stimulus has accessed the devices that you are interested in:

covergroup hsel_cg;
coverpoint HSEL {
bins HSEL_1 = {4’b0001};
bins HSEL_2 = {4’b0010};
bins HSEL_3 = {4’b0100};
bins HSEL_4 = {4’b1000};
illegal_bins HSEL_X = default; // Any other condition is illegal
}
endgroup: hsel_cg

This covergroup would then collect coverage based on the values of HSEL. If, for instance you get the following values for HSEL 1, 2, 1, 4, then bins HSEL_1, HSEL_2 and HSEL_3 would have coverage, but HSEL_4 would not. That’s because you never generated a bus cycle that caused HSEL_4 to happen. If you then add an iff() statement to the bin or the covergroup, then that doesn’t change the fact that HSEL_4 was never activated.

If you have a mode of operation where multiple select lines were activated, but you didn’t want to collect coverage in this mode (lets call it test) then the covergroup code could be changed to:

covergroup hsel_cg;
coverpoint HSEL iff(!TEST) { // Ignore sample during test
bins HSEL_1 = {4’b0001};
bins HSEL_2 = {4’b0010};
bins HSEL_3 = {4’b0100};
bins HSEL_4 = {4’b1000};
illegal_bins HSEL_X = default; // Any other condition is illegal
}
endgroup: hsel_cg

If you want to explicitly ignore a condition - lets say HSEL_4 then you use an ignore_bins declaration:

covergroup hsel_cg;
coverpoint HSEL iff(!TEST) { // Ignore sample during test
bins HSEL_1 = {4’b0001};
bins HSEL_2 = {4’b0010};
bins HSEL_3 = {4’b0100};
ignore_bins HSEL_4 = {4’b1000}; // This value is ignored and not counted
illegal_bins HSEL_X = default; // Any other condition is illegal
}
endgroup: hsel_cg

In reply to mperyer:

Hi,

I have doubt in your answer ,Please help me i am describing below

  1. What is TEST? -----iff(!TEST)
  2. can i cover all bins in coverage with only 1 value of HSEL?