HSEL suggests an AMBA AHB select line bundle.
Lets assume that your variable HSEL is a 4 bit logic type:
logic [3:0] HSEL;
Lets assume that each bit of HSEL is an active high select line from a bus address decoder to a peripheral.
Lets assume that you sample HSEL when a bus cycle is complete in order that you can check that your stimulus has accessed the devices that you are interested in:
covergroup hsel_cg;
coverpoint HSEL {
bins HSEL_1 = {4’b0001};
bins HSEL_2 = {4’b0010};
bins HSEL_3 = {4’b0100};
bins HSEL_4 = {4’b1000};
illegal_bins HSEL_X = default; // Any other condition is illegal
}
endgroup: hsel_cg
This covergroup would then collect coverage based on the values of HSEL. If, for instance you get the following values for HSEL 1, 2, 1, 4, then bins HSEL_1, HSEL_2 and HSEL_3 would have coverage, but HSEL_4 would not. That’s because you never generated a bus cycle that caused HSEL_4 to happen. If you then add an iff() statement to the bin or the covergroup, then that doesn’t change the fact that HSEL_4 was never activated.
If you have a mode of operation where multiple select lines were activated, but you didn’t want to collect coverage in this mode (lets call it test) then the covergroup code could be changed to:
covergroup hsel_cg;
coverpoint HSEL iff(!TEST) { // Ignore sample during test
bins HSEL_1 = {4’b0001};
bins HSEL_2 = {4’b0010};
bins HSEL_3 = {4’b0100};
bins HSEL_4 = {4’b1000};
illegal_bins HSEL_X = default; // Any other condition is illegal
}
endgroup: hsel_cg
If you want to explicitly ignore a condition - lets say HSEL_4 then you use an ignore_bins declaration:
covergroup hsel_cg;
coverpoint HSEL iff(!TEST) { // Ignore sample during test
bins HSEL_1 = {4’b0001};
bins HSEL_2 = {4’b0010};
bins HSEL_3 = {4’b0100};
ignore_bins HSEL_4 = {4’b1000}; // This value is ignored and not counted
illegal_bins HSEL_X = default; // Any other condition is illegal
}
endgroup: hsel_cg