Coverpoints in System Verilog

痞子三分冷 提交于 2021-02-08 08:15:59

问题


Is it possible to exclude some coverpoints from a particular group based on a parameter?

covergroup NEW (string for_exclusion) @ (clk);
option.per_instance = 1;
option.comment = for_exclusion;

apples: coverpoint (available) { bins hit1 = {1'b1};}
bananas: coverpoint ({not_available, less}) {bins hit1 = {1'b1};}
oranges: coverpoint ({available, less}) {bins hit1 = {1'b1};}
rose: coverpoint ({available, flower}) {bins hit1 = {1'b1};}

This is small part of the original file. I want to exclude 'rose' from this covergroup based on parameter parameter IDENTITY = 2'b00 which I have already passed in the module. Is there a way to do this? (Please ignore syntax errors, if any. I am not worried about them at the moment)

I tried using this but it did nt work.

covergroup NEW (string for_exclusion) @ (clk);
option.per_instance = 1;
option.comment = for_exclusion;

apples: coverpoint (available) { bins hit1 = {1'b1};}
bananas: coverpoint ({not_available, less}) {bins hit1 = {1'b1};}
oranges: coverpoint ({available, less}) {bins hit1 = {1'b1};}

generate
if (IDENTITY = 2'b01) begin
rose: coverpoint ({available, flower}) {bins hit1 = {1'b1};}
end
endgenerate`

回答1:


You cannot use generate in the middle of declaring another construct. Can you separate that coverpoint out into another covergroup and not construct/sample it based on the other parameter?

Another choice is to set the weight of the coverpoint to 0 based on the parameter. You can do this in procedural code before or after constructing the covergroup.

if (IDENTITY != 2'b01)
  NEW::rose::type_option.weight = 0;

or inside the coverpoint

rose: coverpoint ({available, flower}) {
  bins hit1 = {1'b1};
  option.weight = (IDENTITY == 2'b01};
}


来源:https://stackoverflow.com/questions/53612383/coverpoints-in-system-verilog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!