Jump to content

Interface not visible in env class


Recommended Posts

Hi,

I have a small UVM test cases. I have defined the interface and instantiated it in my top.sv as:

inf vif();

My env class is as under. I tried to connect the interface in the two differnt ways using connect and assign_vi but non of them is working.

class simple_env extends uvm_env;

`uvm_component_utils(simple_env)

simple_agent agent;

//virtual interface inf vif;

function new (string name = "simple_env", uvm_component parent);

super.new();

endfunction: new

function void build();

super.build();

agent= simple_agent::type_id::create("Simple_agent", this);

endfunction

//function void assign_vi(virtual interface inf vif);

// this.vif = vif;

// agent.assign_vi(vif);

//endfunction

function void connect();

agent.assign_vi(top.vif);

endfunction

endclass

Link to post
Share on other sites

Thanks Arno, but my design is with 1.0.

The problem is when i define a virtual interface in the env class and try to pass it using assign_vi(),

and call the assign_vi function in the test, i get a NULL pointer error. The interface is not visible from top in the env.

If i make a wrapper around the env class and then do the same it works.

Can anyone explain me this?

Link to post
Share on other sites

I am not sure what wrong either, just remind you that UVM1.0 suggests us to leverage uvm_config_db to set interface and get virtual interface in driver, monitors. I think its better since it means user could get rid of the hierarchy path name of the interface by just uvm_config_db::set before run_test();

Link to post
Share on other sites

Hi,

Thanks Arno, but my design is with 1.0.

If i make a wrapper around the env class and then do the same it works.

That is the preferred approach, glad that works for you.

The problem is when i define a virtual interface in the env class and try to pass it using assign_vi(),

and call the assign_vi function in the test, i get a NULL pointer error. The interface is not visible from top in the env.

Can anyone explain me this?

In top, are you sure your instance name is "vif"? Just for the demo skae you may want to use full hier-path in driver and see if the following works for you:

in driver.sv file:

task run();

@(posedge top.vif.clk);

endtask : run

Let us know what you find.

Good Luck

Ajeetha, CVC

www.cvcblr.com/blog

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...