While using with clause I am having following error :
The ‘with’ clause specified on the coverpoint bin does not have any impact and is invalid; it should contain at least one occurence of the ‘item’ keyword.
Please give a example to use with clause in functional coverage.
In reply to saumya thacker:
The LRM section 19.5.1.1 Coverpoint bin with covergroup expressions has some examples you can have a look at:
a: coverpoint x
{
bins mod3[] = {[0:255]} with (item % 3 == 0);
}
Maybe if you show some code, your expected output someone may be able to help you
HTH,
-R
In reply to rgarcia07:
Hi,
I have 3 memories and I just want to create a single cover-group for all of them. I am using option.per_instance = 1;.
All memories have different address number of bits due to difference in size. I want to create transition bins for all of them how can I create bins run time.
cp_mem_addr_toggle : coverpoint cov_item.mem_addr{
wildcard bins b1=(32’b???0=>32’b???1);
wildcard bins b2=(32’b???0?=>32’b???1?);
wildcard bins b3=(32’b???0??=>32’b???1??);
wildcard bins b4=(32’b???0???=>32’b???1???);
wildcard bins b5=(32’b???0???=>32’b???1???);
wildcard bins b6=(32’b???0???=>32’b???1???);
wildcard bins b7=(32’b???0???=>32’b???1???);
wildcard bins b8=(32’b???0???=>32’b???1???);
wildcard bins b9=(32’b???0???=>32’b???1???);
wildcard bins b10=(32’b???0???=>32’b???1???);
wildcard bins b11=(32’b???0???=>32’b???1???);
wildcard bins b12=(32’b???0???=>32’b???1???);
wildcard bins b13=(32’b???0???=>32’b???1???);
wildcard bins b14=(32’b???0???=>32’b???1???);
wildcard bins b15=(32’b???0???=>32’b???1???);
wildcard bins b16=(32’b???0???=>32’b???1???) with (item inside {[MEM_A_START:
MEM_A_END],[MEM_B_START:
MEM_B_END]});
wildcard bins b17=(32’b???0???=>32’b???1???) with (item inside {[MEM_A_START:
MEM_A_END],[MEM_B_START:
MEM_B_END]});
}
This is giving me compile error: Transition Bin ‘b16’ has a ‘with’ clause written on it; ‘with’ clause is not supported on transition bins.
In reply to saumya thacker:
I think your problem is that the with clause is for range_lists not for transition lists, for example if your range is [0:10] then you can use item to select the values of interest i.e (item % 2) == 0
If you are defining transition bins bins x[] = ([0:1] => [0:1]); the list is a list of transitions (0=>1), (0=>0), etc. So the with clause is not legal in this context (I could be wrong)
Regarding your code I suggest to have a second thought on the implementation and what do you want to achieve, for example
wildcard bins b13=(32'b???????????????????0????????????=>32'b???????????????????1????????????);
Will hit when you see a transition from 0=>1 on the 13th bit so this could be written differently just cover the bit of interest.
Please look this example (toggle coverage)
Now if you still want to go with your initial approach you could change a bit the code in order to cover the transitions while the address is in the valid range something similar to this
class mem_addr_item;
rand bit[3:0] addr;
bit [3:0] max;
bit [3:0] min;
//Note that the return type is one bit bigger than addr
function bit [4:0] range();
bit valid_range;
valid_range = (addr inside {[min : max]});
return ({valid_range, addr});
endfunction
covergroup cg_mem_addr;
option.per_instance = 1;
//cover the concatenation of instead of addr
cp_trans: coverpoint range() {
//Note the MSB is 1 as you are interested of addresses in valid range
//Also note the [] as in this case I want all transitions
wildcard bins trans[] = (5'b1??0? => 5'b1??1?);
}
endgroup
function new ();
cg_mem_addr = new;
endfunction
endclass
HTH,
-R
PS: Use code tags in the future.
1 Like