I defined a covergroup to collect a 32 bit my_value. It’s defined in an independent file outside of any classes so I used with function sample.
covergroup my_cg with function sample(logic [31:0] my_value);
coverpoint my_value{
bins my_bin0 = my_value with (item & 32'h00FF == 32'h00AC);
bins my_bin1 = my_value with (item & 32'h00FF == 32'h00BD);
bins default_bin[ ] = default;
}
endgroup
It seems that the item in with condition statement cannot get my_value which is from the function sample. All my_values drop into the default bin. Does anybody know how to solve this problem?
Thanks for the reply.
The code I post is a small demo to illustrate how i defined my covergroup. I researched some documents and found out that the conflict between with or iff clause in covergroup and the function sample does exist. The sampled my_value cannot be used in condition statements. So for complicated bins defs, using with function sample might not be a wise choice.
Your reply inspired me that in my case I can use wildcard bins: