In reply to dave_59:
Thanks DAVE,
I liked this way, but I'm a bit confused by it
Quote:
In reply to faigenboim:
accessed_block_cp : coverpoint map_range(address) {
bins maps[N] = {[0:N-1]};
}
I tried to make code like this:
virtual function void start_of_simulation_phase(uvm_phase phase);
super.start_of_simulation_phase(phase);
fxp_reg_access_cg = new(cfg.maps_name);
foreach (cfg.maps_name[i])
maps_cg[i] = new(cfg.maps_name[i], cfg.maps_base_addr[i], cfg.maps_end_addr[i], cfg.maps_num_of_bins[i]);
endfunction : start_of_simulation_phase
virtual function int get_block(uvm_reg_addr_t addr);
foreach (cfg.maps_name[i]) begin
if(addr>= cfg.maps_base_addr[i] && addr<= cfg.maps_end_addr[i])
return i;
end
return -1;
endfunction
covergroup fxp_reg_access_cg(string maps_name[$]) with
function sample(svt_apb_transaction apb_transaction, ipu_uvm_reg accessed_reg, bit access_is_valid,
bit[4:0] accessed_reg_type, bit[2:0] dfd_fusees, bit func_rst_raw, bit rst_pre);
accesse_blocks_cp : coverpoint get_block(apb_transaction.address) {
bins maps[] = {[0:maps_name.size()-1]};
bins out_of_blocks = default;
}
.....
endgroup
but I got compilation error:
Error-[PCECGNNA] Improper new call to embedded covergroup
/nfs/site/disks/mmg.fxp.integ.2/USERS/smilgrom/fxp_19_04/src/val/common/ip_lib/fxp_cs
Procedural call to 'new' of embedded covergroup
fxp_csr_apb_coverage::fxp_reg_access_cg not allowed outside new function of
encompassing class fxp_csr_apb_coverage or its derived classes.
I cannot call to 'new' in the new function off class because then the array has not yet been initialized (and its size is unknown)
And if I define the covergroup as external to the class then it will not have access to the get_block function.
Is there a way to overcome the problem?