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.