# Use of intersection in cross coverpoints

## Recommended Posts

I was under the assumption that once bins are created, the coverage would be collected only for those bins and the remaining combinations would be ignored. However, I noticed this was not the case when using intersect.

Intention: Assuming there are 3 banks (0,1,2) and 3 requestors(a,b,c). I wanted to write a coverpoint that covers the case where all 3 banks are active at the same time.

Example 1: No bins for coverpoints and use intersect for cross coverpoint

cp_bank_0_hit: coverpoint req_a_bank_id == 0 || req_b_bank_id == 0 || req_c_bank_id == 0;
cp_bank_1_hit: coverpoint req_a_bank_id == 1 || req_b_bank_id == 1 || req_c_bank_id == 1;
cp_bank_2_hit: coverpoint req_a_bank_id == 2 || req_b_bank_id == 2 || req_c_bank_id == 2;

//cross coverpoint when all the banks (0,1,2) are being accessed at the same time.
ccp_all_banks_active: cross cp_bank_0_hit, cp_bank_1_hit, cp_bank_2_hit
{ bins all_hit = binsof(cp_bank_0_hit) intersect {1} &&
binsof(cp_bank_1_hit) intersect {1} &&
binsof(cp_bank_2_hit) intersect {1};
}

Here I was expecting just one bin to be created for the cross coverpoint. However, I noticed other combinations(2^3=8) were generated.

Example 2: Creating bins for coverpoints
cp_bank_0_hit: coverpoint req_a_bank_id == 0 || req_b_bank_id == 0 || req_c_bank_id == 0 { bins hit = {1}; }
cp_bank_1_hit: coverpoint req_a_bank_id == 1 || req_b_bank_id == 1 || req_c_bank_id == 1 { bins hit = {1}; }
cp_bank_2_hit: coverpoint req_a_bank_id == 2 || req_b_bank_id == 2 || req_c_bank_id == 2 { bins hit = {1}; }
//cross coverpoint when all the banks (0,1,2) are being accessed at the same time.
ccp_all_banks_active: cross cp_bank_0_hit, cp_bank_1_hit, cp_bank_2_hit
{ bins all_hit = binsof(cp_bank_0_hit.hit) &&
binsof(cp_bank_1_hit.hit) &&
binsof(cp_bank_2_hit.hit) ;
}

The above code accomplishes the goal and only one bin was created, with other combinations not covered, as desired.

Not sure why this change behavior, found it interesting nevertheless. I thought both should accomplish the same, maybe I was wrong.

Feel free to comment.

##### Share on other sites

I think this is covered by the example coverpoint x2 in the 1800-2012 standard at the bottom of page 536. At the top of page 537 it says

The automatically generated cross bins (which are the same as the set given above for cross x1) are retained for those bins that do not overlap the explicitly declared cross bins. In this particular case, since the explicitly declared bin covers all cases for which i == 0, the cross will have the explicitly declared bin (i_zero) plus automatically generated bins for cases where i != 0

(my emphasis).

Interesting...

regards

Alan

## Create an account

Register a new account

×