Hi,
I got to do the coverage analysis in the Monitor of my UVC.
Following is the piece of code
class es_monitor extends uvm_monitor;
bit[7:0] seq_num; // 256 values
bit[15:0] dest_addrs; // Out of 65536 values, only 256 are valid
bit[15:0] valid_dest_addr[256]; // This array determines the valid 256 destination addresses
covergroup cov1;
des_addr: coverpoint dest_addrs // Is it valid to have this kind of coverpint ??
{
addrs_bins[] = { valid_dest_addr[0], valid_dest_addr[1] ............ valid_dest_addr[255] } // VALID ??
}
cp_seq_num: coverpoint seq_num;
cross des_addr, cp_seq_num; // For every valid destination, all seq num are generated or not
endgroup : cov1
// code....
endclass
I have embedded covergroup.
My goal is to cover that for every valid destination (256 valid destinations) all the sequence numbers are generated or not? (cross coverage)
How can I create only 256 valid coverage bins for ‘dest_addrs’ based on ‘valid_dest_addr’ array field
FYI: valid_dest_addr[256] array will be populated using the ‘config’ in the run_phase
Can any one help me in writing the covergroup and coverpoints for my scenario ?
You can do something like the following to create bins for values inside the valid_dest_addr
bins addrs_bins[] = des_addr with (item inside {valid_dest_addr} );
However the glitch here is that the Covergroup has to be constructed (via new()) after the valid_dest_addr array is populated, otherwise it will be meaningless.
In reply to ayehia:
And another glitch is if a covergroup is embedded in a class, it must be constructed inside the constructor of the class. So if you are unable to get the config while construing the class, you will have to define the covergroup outside this class (either a standalone covergroup, or defined in another class that gets constructed when you are able to construct the covergroup.