cross a,b {
ignore_bins ignore = binsof(a) intersect{5,[1:3]};

Do this above code and the following one have any similarities?

cross a,b {
bins ignore = ! binsof(a) intersect{5,[1:3]};

Another doubt is related to the usage of with inside cross coverpoint.

cross a,b {
ignore_bins ignore = binsof(a) with (item inside {5,[1:3]});

Is it valid way of writing the code ?

In reply to Shubhabrata:

It always helps to show the declarations of all identifiers. Assuming:

bit [2:0] a,b;
covergroup cg;
  cross a,b;

This cross automatically generates 64 bins: <0,0>, <0,1>, …, <7,6>, <7,7>

Then each explicit bin either ignores or merges bins from the 64 automatically generated cross nins.

The first code ignores 32 bins: <5,0>…<5,7>, <1,0>…<3,7>. That leaves 32 remaining bins

The second code merges the same bins from the first code into a single bin. That leaves 33 remaining bins.

The third code does the same thing as the first code. Both the with clause and inside operator are later additions to the language and overlaps the functionality of intersecs.

In reply to dave_59:

I am sorry, couldn’t understand one thing.

You said that 2nd one merges the same bins from the first code into a single bin. In that case,
32 bins should have been left remaining. But you said 33 bins.Could you explain it more, please?

In reply to Shubhabrata:

There are 64 automatically bins. 32 are merged into 1 bin, the other 32 are not merged. 1 + 32 = 33.