Cross coverage exclude duplication

hi
i’m writing coverage and i need to cross 3 coverpoints as following:


a_idx: coverpoint a {
    bins a_idx[] = {[0:15]};
}
b_idx: coverpoint b {
    bins b_idx[] = {[0:15]};
} 
c_idx: coverpoint c {
    bins c_idx[] = {[0:123]};
}

cross_a_b_c: cross a_idx , b_idx , c_idx;
  

I want to create a single bin for duplicate a/b indexes e.g:
this should be 1 bin:

c    b    a
0    1    0
0    0    1

how is this done?

thanks

In reply to gidon:

I think this would be difficult to create as a single cross. I assume you are looking to have 124*256 individual bins. I would create an array of covergroup instances

covergroup cg(int idx1,idx2)

ab_idx: coverpoint (a == idx1 && b == idx2 || a == idx2 && b == idx1) {
   bins match = {1};
}
c_idx: coverpoint c {
    bins c_idx[] = {[0:123]};
}
cross_ab_c: cross ab_idx, c_idx;
endgroup


cg cg_h[256];
int dup= 0;

for(int i1=0;i1<16;i1++)
  for(int i2=0;i2<16;i2++)
     cg_h[dup++] = new(i1,i2);

In reply to dave_59:

thanks Dave.

in your code I will still have duplicate elements (e.g. idx1=0 idx2=1 & idx1=1 idx2=0) in the array?

In reply to gidon:
Yes, but those coverpoints will have identical bin counts, list like c_idx. I think the following would work:

for(int i1=0;i1<16;i1++)
  for(int i2=i1;i2<16;i2++)
     cg_h[dup++] = new(i1,i2);