Cross Coverage

Hi,

I am facing an issue in cross coverage.I am crossing three signals namely valid,data and startofpacket(SOP).

Conditions:
Valid should be 1 for data and SOP.
Data comes only when valid is 1.
SOP comes at the first cycle of Data.

//coverpoint - 1
// coverpoint for valid
 VALID:coverpoint av_vi.valid 
    {
      bins VALID_ENABLE  = {1'b1};
      bins VALID_DISABLE = {1'b0};
    }
  
//coverpoint - 2
// coverpoint for data
  DATA : coverpoint av_vi.data iff(av_vi.valid == 1'b1)
    {
      bins  DATA_RANGE [8]    = {[32'h0 : 32'hFFFFFFFF]};
    }
 
//coverpoint - 3
// coverpoint for SOP
  SOP : coverpoint av_vi.sop iff(av_vi.valid == 1'b1)
    {   
       bins SOP_ENABLE = {1'b1};
       bins SOP_DISABLE = {1'b0};
    }

//Coverpoint - 4
//Cross coverage for VALID X DATA x SOP
CROSS_1 : cross VALID,DATA,SOP
    {
       ignore_bins c1 = binsof(VALID) intersect {0} ;
    }

I am facing issue in SOP that it should be enable for only first cycle of data and disable for rest of the cycles.I don’t know how to write ignore/illegal bins SOP enable for some cycle and disable for remaining cycles.

Please help me to solve this issue

I think you are putting too much complexity into your covergroup. Covergroups are designed for data collection, not protocol coverage and checking. I would just write a single coverpoint that samples DATA when valid (I’m not sure what the point of covering DATA into 8 bins is, but I assume you have a reason).

There is no need for the CROSS, you just can create another coverpoint

  SOP_DATA : coverpoint av_vi.data iff(av_vi.valid == 1'b1 && av_vi.sop == 1'b1)
    {
      bins  DATA_RANGE [8]    = {[32'h0 : 32'hFFFFFFFF]};
    }

(Again, I’m not sure what the point of covering the first DATA item different from the rest of the data items in the packet, but I assume you have a reason)

You should always collect coverage assuming that all protocols are correctly checked elsewhere. If the checking fails, then you throw away the all coverage collected for the entire test. There are some situations that deal with error recovery where this is not the case.

Ideally you put protocol checking in an assertion, except that assertions are not allowed inside classes. So you would have to build a state machine to do your checking inside a class.

I would need to see more information about what requirements you are trying to cover and check before spending more time coming up with examples. For example, how do you decide when another SOP is allowed to be enabled?

In reply to dave_59:

Thanks Dave.I got solution…SOP can not be crossed with data(as per protocol).Because SOP signal is toggle one…