Hello,
I’m trying to restrict the bins of a coverpoint given by a queue or dynamic array something like this
module tb();
bit [7:0] addr;
bit par;
bit en = 0;
// valid addresses to be covered
bit [7:0] valid_addr_q[$] = {1, 2, 12, 255};
covergroup mem_cg @ (posedge en);
address : coverpoint addr {
bins valid_addr[] = addr with {item inside {valid_addr_q};};
}
parity : coverpoint par {
bins even = {0};
bins odd = {1};
}
endgroup
initial begin
forever #10 en = ~en;
end
initial begin
mem_cg memory_cg = new();
repeat(10) begin
@(posedge en);
std::randomize(addr);
std::randomize(par);
$display("addr = %0h par = %0b", addr, par);
end
$finish;
end
endmodule
Although I’ve seen different errors depending on the simulator (actually I’m not able to compile the example from this ) , I wonder if this is syntactically correct or not, since probably a queue can grow and normally coverage is “static”, any help on this is really appreciated, or if there is a better approach of doing this, I know there something to exclude in crosses (CrossQueueType I believe) but I’m looking to achieve this for coverpoints.
Thanks,
-Ronald