How to :set a virtual interface defined in a VIP

Hi,

I have a doubt regarding an interface “X” being defined as :

Driver code of the VIP:


protected virtual X ChipIf;
function void connect phase(uvm_phase phase);

Y vif_container;
super.connect_phase(phase);

// Assigning virtual interface
assert(uvm_config_object::get(this, “”,“V_IF_CHIP”, temp));
$cast(vif_container, temp);
ChipIf = vif_container.get_v_if();

endfunction : connect_phase

From the tb_top of the SoC , where the above VIP pkg is imported along with uvm pkg:*,please let me know how can I “set” the virtual ChipIf?

In reply to prashanth.billava:

In the top_tb you have to make an instance of the VIP interface like this:

X xif(); // don’t miss the brackets!

Furthermore you have tp pass this interface to the uvm_config_db in the initial block of the top_tb:

initial begin

uvm_config_db #(X)::set(null, “*”, V_IF_CHIP, xif);

end

In reply to chr_sue:

In reply to prashanth.billava:
In the top_tb you have to make an instance of the VIP interface like this:
X xif(); // don’t miss the brackets!
Furthermore you have tp pass this interface to the uvm_config_db in the initial block of the top_tb:
initial begin

uvm_config_db #(X)::set(null, “*”, V_IF_CHIP, xif);

end

Hi Sue,

I tried to use the same, but I get error during run_time pointing to the position where the interface is “get” in the VIP .
Error-[NOA] Null object access
The object at dereference depth 0 is being used before it was
constructed/allocated.
Please make sure that the object is allocated before using it.

Is it because there a container being used, which is uvm_object type?

In reply to prashanth.billava:

I don’t see what the interface container is and why you are using this. And I do not see waht the data type of temp is.
The problem might be in the container.
Could you show some more code, please?