covergroup mesh_cmd_cg (string inst_name, int min, int max) with function sample(mesh_ior_cmd_transaction cmd_txn);
cp_cmd_mt : coverpoint cmd_txn.tx_type {
bins WRITE = {WRITE};
bins READ = {READ};
}
cp_cl_addr : coverpoint cmd_txn.cl_addr {
bins MIN = {min};
bins MID[4] = {[(min+'h1):(max-'h1)]};
bins MAX = {max};
}
cp_trans_write_read_write : coverpoint cmd_txn.tx_type iff(cmd_txn.cl_addr == 'h100 ) {
bins w_r_w = (WRITE=>READ=>WRITE);
}
endgroup
currently I’m checking trasnition bin by manually putting an address but is there any way to make it generic like for any value between min to max if it detects the sequence of write->read->write with same address it should hit. Is there any way to call whatever value that is sampled in cp_cl_addr in cp_trans_write_read_write
This is difficult to do using a covergroup. The way you have written it for a fixed address does not require consecutive operations. You need to clarify if that is what you wanted.
If you need consecutive operations to the same address, you would need to create another signal that represents stability in the address between operations.
If you don’t need consecutive operations (i.e WRITE:'h100=>WRITE:'h200=>READ:'h100=> WRITE:'h100), that would be much more difficult to do with a covergroup, but easier with a cover property directive.
for now this is hitting everytime a write->read->write sequence is detected regardless of address but I want it to hit only if it detects same address so I need to establish some relation between cl_addr and tx_type which I’m facing problem with
More precise not array size, but width of array element equal to cl_addr.
//prev_addr is used to keep 3 conductive address. (Address width will upto you)
//When all 3 index of array has same address, stable_address become 1.
//And same address set in array due to WRITE -> READ -> WRITE, cross will be covered
bit [42:0] cl_addr;. //43 bit
bit [42:0] prev_addr [3];. //43 bit, 43 bit, 43 bit