hi,
i have the following reqirement

int A,B;
coverpoint A { a ={[0:27]};}
coverpoint B { b = {[0:27]};}
cross_A_B cross a,b;

here cross_A_B gives all combinations but i need selected range cross between A,B

like i need cross between a[2]…a[5] & b[3]…b[6] ==> a[2],b[3];a[2],b[4];a[2],b[5];a[2],b[6];
a[3],b[3]…
can please tell me the procedure to do this

thank you,
murali

You can ignore the ranges you do not want to cross

```
cross_A_B : cross A,B
{
ignore_bins of_a = binsof(a) intersect { [$:1],[6:$] } ;
ignore_bins of_b = binsof(b) intersect { [$:2],[7:$] } ;
}
```

Dave

In reply to murali_yalamanchi :

thank you dave,
i need some more, i forgot to mention

coverpoint A { a ={[0:27]};}
coverpoint B { b = {[0:27]};}
cross_A_B cross a,b;

here cross_A_B gives all combinations but i need selected range cross between A,B

like i need cross between a[2]…a[5] & b[3]…b[6],
a[6]…a[8] & b[7]…b[10],
a[9]…a[15] & b[11]…b[15],
a[16]…a[27] & b[16]…b[27];

like this i want to create cross coverage can u please help me.

thank you
Murali

In reply to murali_yalamanchi :

You can either do

```
cross A_B a,b {
bins r1 = binsof(a) intersect {[2:5]} && binsof(b) intersect {[3:6]};
bins r2 = binsof(a) intersect {[6:8]} && binsof(b) intersect {[7:10]};
bins r3 = binsof(a) intersect {[9:15]} && binsof(b) intersect {[11:15]};
bins r4 = binsof(a) intersect {[16:27]} && binsof(b) intersect {[16:27]};
}
```

or change the bins for the coverpoints A and B

```
coverpoint A {
bins a1 = {[2:5]};
bins a2 = {[2:8]};
bins a3 = {[9:15]};
bins a4 = {[16:27]};
}
coverpoint B {
bins b1 = {[3:6]};
bins b2 = {[7:10]};
bins b3 = {[11:15]};
bins b4 = {[16:27]};
}
```

and cross the specific bins you want.

In reply to dave_59 :

i have tried first method ,

but what i observed from the results, for r1 it is creating single bin instead of 16 bins.
same for r2,r3,r4 and i am getting remaining combinations which are not covered in r1,r2,r3,r4 but i dont want those…

when i am trying second method , iam getting compilation error

i gave like this
cross_A_B : cross A.a1,B.b1;

its giving hierarchical name not found, please correct me.

thnak you,
murali

In reply to dave_59 :

OK, this is the most compact way to get the exact bins you are looking for with the information you have provided.

```
covergroup cg;
a: coverpoint v_a { bins a[] = {[2:27]}; }
b: coverpoint v_a { bins b[] = {[2:27]}; }
c1: cross a,b
{ignore_bins ib = ! binsof(a) intersect {[2:5]} || ! binsof(b) intersect {[3:6]};}
c2: cross a,b
{ignore_bins ib = ! binsof(a) intersect {[6:8]} || ! binsof(b) intersect {[7:10]};}
c3: cross a,b
{ignore_bins ib = ! binsof(a) intersect {[9:15]} || ! binsof(b) intersect {[11:15]};}
c4: cross a,b
{ignore_bins ib = ! binsof(a) intersect {[16:27]} || ! binsof(b) intersect {[16:27]};}
endgroup // cg
```

In reply to dave_59 :

thank you for response dave.

In reply to murali_yalamanchi :

Hi Dave,
What if I want to ignore all the bins of coverpoint a(except a1),the following code is not working. a2,a3…ax bins are not ignored,but scalar bins aa and aaa are ignored. Any reason.

```
covergroup cg;
a: coverpoint v_a { bins aa = {[1:10]}; bins aaa = {[12:20]};
bins a1[] = {[2:27]}; bins a2[] = {[28:37]}; bins a3[] = {[38:47]}; .... bins ax[] = {[1:20]};}
b: coverpoint v_a { bins b1[] = {[2:27]}; bins b2[] = {[28:37]};}
c1: cross a,b
{ignore_bins ib = ! binsof(a.a1) || ! binsof(b) intersect {[3:6]};}
endgroup // cg
```

rtawade
February 10, 2017, 6:13pm
9
In reply to muralikrishna.makkena :

how can i cross coverpoints that belongs to diffrent covergroups ??

dave_59
February 10, 2017, 9:15pm
10
In reply to rtawade :
SystemVerilog does not allow this. you have to replicate the coverpoints you want to cross in a single covergroup.

BTW, please use a new topic to ask a new question.

In reply to dave_59 :

Hello Dave,

Could you please let me know the difference between these two lines?

```
c1: cross a,b
{ignore_bins ib = ! binsof(a) intersect {[2:5]} || ! binsof(b) intersect {[3:6]}; //1
ignore_bins ib = binsof(a) intersect {[2:5]} && binsof(b) intersect {[3:6]};} //2
```

I am a bit confused about the !binsof and binsof in ignore bins . Thanks

In reply to the_ceylonese :
By De Morgan’s law , the two lines are complements of each other.

Assuming the cross refers to the coverpoints in the first post with bins a = {[0:27]}, then the first ignore_bins says
Remove all the crosses where the A has one of the values: 0,1,6-27, or B has one of the values 0-2,7-27

and the second ignore_bins says
Remove all the crosses where the A has one of the values 2-7 and B has the value 3-6

In reply to dave_59 :

Cheers Dave, appreciate it.