I am having below mentioned problem where I looking for only single element of array “type” and don’t care about other values in array and then want to cross it with other variables.
its getting complied and simulated but its generating extra auto bins like for cover point ele1 auto[0]& auto[1]
and similarly for cross ele1Xy its generating 4 auto bins.
[auto[0]] [auto[0]]
.
.
[auto[1] [auto[1]]
Could you please suggest whats is problem with below and why its generating more auto bins and also if there is any better solution to approach this.
I was also thinking to use foreach to have a single cover point(by instantiating the covergroup for 32 times) for whole array but I think then I would not able to cross the particular cover point to particular variable.
logic [31:0] type;
logic x;
logic y;
logic z;
cover group abc with function sample();
ele1 :coverpoint type[0];
ele2 :coverpoint type[1];
ele3 :coverpoint type[2];
.
.
.
ele31 :coverpoint type[31];
When you are creating a coverpoint for a single bit, you will get two bins, one for the value of 0 and one for the value of 1. These bins are created automatically, hence the auto[0] and auto[1] names.
What do you really want to cover? That each individual bit is set? Isn’t set? Transitions?
You can check individual bit values using wildcard bins:
// The count of bin g12_15 is incremented when the sampled variable is between 12 and 15
wildcard bins g12_15 = { 4'b11?? };
Yup,Is there any other way by which I can ignore the bins for “0” values.As it would make my job easy otherwise I also need to ignore the 0 values for other variable like x,y,z … while crossing them with type_* bins .I have almost 400 cross bins.
If you only want to cross a particular value of a variable, then define a coverpoint that only has a bin for that value, and use that in the cross instead of the variable
y1: coverpoint y { bins set = {1}; }
ele1 : coverpoint type[1] { bins set = {1}; } /BTW type is a keyword
yXele1: cross y1, ele1;
You many not want to use a cross at all in this situation, a simple covergroup expression would work
Thanks for reply.It was very useful.
As you suggested I can use coverpoint like ele1 : coverpoint Type[1] { bins set = {1}; } to select single element.
My next query is, can I make a cover-point like “scenarioValidofTypeXYZ_Only” if yes then how can I select “set” values for given range of array.As given below I am interested in set values between 16:6 of Array Type.
I thought to use wild card bins, is there any better way for this.