Quantcast
Channel: Cadence Functional Verification Forum
Viewing all articles
Browse latest Browse all 1069

Why it must have virtual interface initialized for an embedded covergroup before connect_phase()?

$
0
0

Refer to the code as below, assignment of vif in build_phase() or connet() will result in different behavior. Anyone can explain a bit for this?

Thanks.

class apb_cov extends uvm_component;
virtual apb_master_if vif;

covergroup cg @ (vif.monitor_cb)
option.per_instance = 1;

endgroup // cg

function new(string name="");
super.new();
cg = new();
endfunction // new

function void build_phase(uvm_phase phase);
super.build_phase();
/*
* If assign vif here, it is ok.
* vif = g_if;
*/

endfunction // build_phase

function void connect();
/*
* If assign vif here, it will give runtime error as
* NULL pointer dereference of vif.
* vif = g_if;
*/
endfunction // connect

endclass // apb_cov


Viewing all articles
Browse latest Browse all 1069

Trending Articles