Error-[XMRE] Cross-module reference resolution error

Hi,I was trying to verify read-write functionality in a memory.

unable to understand what this error is:

Error-[XMRE] Cross-module reference resolution error
testbench.sv, 194
Error found while trying to resolve cross-module reference.
token ‘cgf’. Originating package ‘$unit’.
Source info: if (cgf.is_active == 1) begin
this.driver = sfr_driver::type_id::create(“driver” …

code:


class sfr_agent extends uvm_agent;

`uvm_component_utils(sfr_agent)
	
	function new(string name = "sfr_agent", uvm_component parent = null);
	super.new(name,parent);
	endfunction
	
uvm_analysis_port #(sfr_seq_item) ap;

sfr_seqr sequencer;
sfr_driver driver;
sfr_monitor monitor;
sfr_config_object cfg;


function void build_phase(uvm_phase phase);
if(cfg == null) begin
	if(!uvm_config_db #(sfr_config_object)::get(this,"","SFR_CFG",cfg))
	begin
	
		`uvm_error("BUILD_PHASE", "Unable to find sfr agent config object in uvm_config_db");
	end
	end
	
	ap = new("ap",this);
	monitor = sfr_monitor::type_id::create("monitor",this);
	
// error in this line
**if (cgf.is_active == 1) begin
driver = sfr_driver::type_id::create("driver",this);
sequencer = sfr_seqr::type_id::create("sequencer",this);
end**

endfunction



function void connect_phase(uvm_phase phase);
monitor.SFR = cfg.SFR;
monitor.ap.connect(ap);

if(cfg.is_active == 1) begin
driver.SFR = cfg.SFR;
driver.seq_item_port.connect(sequencer.seq_item_export);
end
endfunction


endclass 

In reply to GradStudent:

If you take the time to read and understand the error message, you will notice that your variable is ‘cgf’ instead of ‘cfg’. Since there is no variable with the name ‘cgf’, the compiler assumes that you are attempting to reference a module, hence the cross-module resolution error.