Hi all, can someone suggest a better way to write the field “ignore_bins” in this case?
Otherwise does someone know if there is a way to do a cross coverage with automatic cross bins that respects also the constraints? I mean without defining the ignore_bins.
Thanks in advance.
class pl_txn;
typedef struct packed {
reg[7:0] ttag; // tag to be triggered
reg[3:0] ttype; // type to be triggered
reg[3:0] op_type;
} rnd_var_struct;
randc rnd_var_struct rnd_var;
constraint rnd_constr { (rnd_var.op_type inside {[4'h2:4'h4]}) -> (rnd_var.ttag inside {8'h1,8'h4,8'h7});
(rnd_var.op_type inside {[4'h0:4'h1]}) -> (rnd_var.ttag == 8'h1);
rnd_var.op_type inside {[4'h0:4'h4]};
rnd_var.ttag inside {[8'h1:8'h7]};
rnd_var.ttype inside {[4'h1:4'h6]}; }
covergroup pl_cg;
// option.cross_auto_bin_max = 0;
TAG: coverpoint rnd_var.ttag {
bins one = {8'h1};
bins four = {8'h4};
bins seven = {8'h7};
bins others = default;
}
TYPE: coverpoint rnd_var.ttype {
bins cp_cmd = {4'b0001};
bins cp_dataout = {4'b0010};
bins cp_rtt = {4'b0011};
bins cp_datain = {4'b0100};
bins cp_rsp = {4'b0101};
bins cp_tgpio = {4'b0110};
}
OP_TYPE: coverpoint rnd_var.op_type {
bins cp_gpio_l = {4'h0}; //lower 4 clock cycles
bins cp_gpio_u = {4'h1}; //upper 4 clock cycles
bins cp_write = {4'h2};
bins cp_read = {4'h3};
bins cp_query = {4'h4};
}
CROSS: cross OP_TYPE, TYPE, TAG {
ignore_bins i1 = (binsof(OP_TYPE.cp_gpio_l) || binsof(OP_TYPE.cp_gpio_u)) && (binsof (TAG.four)
|| binsof (TAG.seven)) && (binsof (TYPE.cp_cmd) || binsof (TYPE.cp_dataout)
|| binsof (TYPE.cp_rtt) || binsof (TYPE.cp_datain)
|| binsof (TYPE.cp_rsp) || binsof (TYPE.cp_tgpio));
}
endgroup
function new();
pl_cg = new();
endfunction
endclass: pl_txn