1 iff 如过满足条件则采样,iff可以理解为if
covergroup iff_cov;
coverpoint tr.data iff(!vif.reset) ; //复位时不采样
endgroup
2 coverpoint和bin
covergroup name_bin ;
coverpoint tr.kind {
bins zero = {0}; //1个bin 代表kind = 0
bins low = {[1:3],7}; // 1个bin 代表1:3 或者7
bins high[] = {[8:$]}; // (tr.kind最大值-8) 个bin
bins rem = default; // 剩余数值属于1个bin
}
endgroup
忽略某些bin
bit[2:0] low_ports_0_5; //只使用数值0-5
covergroup CoverPort;
coverpoint low_ports_0_5 {
ignore_bins hi = {[6,7]}; //忽略掉6,7两个仓
}
endgroup
交叉覆盖率
covergroup Covport;
port: coverpoint tr.port
{bins port[] = {[0:$]}; //8
}
kind: coverpoint tr.kind {
bins zero = {0}; //1
bins lo = {[1:3]}; //1
bins hi [] = {[8:$]}; //8
bins misc = default; //1
}
cross kind, port {
ignore bins hi = binsof(port) intersect {7};
ignore bins md = binsof(port) intersect {0} &&
binsof (kind) intersect {[9:11]}; //排除port的0、7、[9:11]
ignore bins lo = binsof (kind.lo); //排除kind的[1:3]
}
endgroup
如果只想关注交叉覆盖率,而不想关注单个coverpoint,可以通过设置权重option.weight = 0来将coverpoint的覆盖率忽略
covergroup cross_type_kind;
type : coverpoint tr.type {option.weight = 0}
kind : coverpoint tr.kind {option.weight = 0}
cross type,kind{
ignore_bins t1 =binsof(type)intersect{5};
}
endgroup