qwerty Posted April 11, 2012 Report Share Posted April 11, 2012 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 Quote Link to comment Share on other sites More sharing options...
arno Posted April 11, 2012 Report Share Posted April 11, 2012 "function void connect();" should be "virtual function void connect_phase(uvm_phase);" Quote Link to comment Share on other sites More sharing options...
qwerty Posted April 16, 2012 Author Report Share Posted April 16, 2012 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? Quote Link to comment Share on other sites More sharing options...
SeanChou Posted April 16, 2012 Report Share Posted April 16, 2012 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(); Quote Link to comment Share on other sites More sharing options...
arno Posted April 16, 2012 Report Share Posted April 16, 2012 The code you gave looks all right. there must be something wrong somewhere else. Difficult to say just with what you sent. Quote Link to comment Share on other sites More sharing options...
aji.cvc Posted April 17, 2012 Report Share Posted April 17, 2012 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.