Specman coverage: How to cover range of values in a list?

911 Views Asked by At

I have list of structs my_list:

struct my_struct {
    comparator[2] : list of uint;
};
my_list[10] : list of my_struct;

The values of all comparators are configured once in a while. I would like to collect the range of all configured comparators, i.e., it does not matter which of comparators, something like this:

cover comparators_were_cofigured_event is {  
    item configured_comparators : uint = my_list??? using //How to define the item so the range will relate to all comparators values?
            ranges = {
               range([0..50], "Small values");
               range([51..100], "Big values");
            };
};

How the coverage item can be defined so the ranges will deal with every value in the list? Thank you for your help

1

There are 1 best solutions below

0
On

This isn't possible. You can only define items on scalar values. What you want to do is define an item for each element in the list:

item configured_comparator0_0 : uint = my_list[0][0] using
  ranges = {
    range([0..50], "Small values");
    range([51..100], "Big values");
  };

// ... so on for each item

You can make your life easier by using a macro to expand the code.