xiangben Posted October 22, 2012 Report Posted October 22, 2012 (edited) Hi, I met some problem when I use parameterized interface in UVM 1.1. I don't know where I made the mistake. It reported that "UVM_FATAL @ 0.00ns:uvm_test_top.env.ig_il.drv [NOIVF] virtual interface must be set for: uvm_test_top.env.eg_il.drv.if" If I changed .EBB_SIZE(5),.DATA_SIZE(32) to the default .EBB_SIZE(4),.DATA_SIZE(16), eveything is OK. Could any help to point out where's wrong? Thanks a lot! Following is my code: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Interface definition in il_if.sv interface il_if #(EBB_SIZE=4, DATA_SIZE=16) (input logic clock); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //interface instantiation in il_tb.sv il_if #(.EBB_SIZE(5),.DATA_SIZE(32)) drv_if(core_clk); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Virtual interface assignment in il_top.sv initial begin uvm_config_db#(virtual il_if #(.EBB_SIZE(5),.DATA_SIZE(32)))::set(uvm_root::get(),"*drv","vif",il_tb.drv_if); ...... end ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Interface get in il_driver.sv class il_driver extends uvm_driver #(il_pkt); protected virtual il_if #(.EBB_SIZE(5),.DATA_SIZE(32)) vif; ...... function void build phase(uvm_phase phase); super.build_phase(phase); if(!uvm_config_db #(virtual il_if #(.EBB_SIZE(5), .DATA_SIZE(32)))::get(this,"","vif",vif)) `uvm_fatal("NOVIF",{"virtual interface must be set for:",get_full_name(),".vif"}) endfunction: build_phase endclass : il_driver ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Create driver in il_agent.sv class il_agent extends uvm_agent; il_driver drv; ..... function void build_phase(uvm_phase phase); super.build_phase(phase); drv = il_driver::type_id::create("drv",this); ... endfunction endclass: il_agent Best Regards Benben Edited October 23, 2012 by xiangben Quote
uwes Posted October 22, 2012 Report Posted October 22, 2012 how do you create create your driver? Quote
enchanter Posted October 22, 2012 Report Posted October 22, 2012 This is also the question I keep asking and not find good answer yet. But I found an article from here: http://www.vip-central.org/2012/09/parameterized-interfaces-and-reusable-vip-part-3/ I thin it is good. But still a little bit complicated for me. Hope better solution for this. Quote
xiangben Posted October 23, 2012 Author Report Posted October 23, 2012 how do you create create your driver? Hi uwes, class il_agent extends uvm_agent; il_driver drv; ..... function void build_phase(uvm_phase phase); super.build_phase(phase); drv = il_driver::type_id::create("drv",this); ... endfunction endclass: il_agent class il_driver extends uvm_driver #(il_pkt); protected virtual il_if#(.EBB_SIZE(5),.DATA_SIZE(32)) vif; ...... function build_phase(uvm_phase phase); super.build_phase(phase); if(!uvm_config_db #(virtual il_if #(.EBB_SIZE(5),.DATA_SIZE(32)))::get(this,"","vif",vif)) ...... endfunction: build_phase ... endclass:il_driver Quote
xiangben Posted October 23, 2012 Author Report Posted October 23, 2012 This is also the question I keep asking and not find good answer yet. But I found an article from here: http://www.vip-central.org/2012/09/parameterized-interfaces-and-reusable-vip-part-3/ I thin it is good. But still a little bit complicated for me. Hope better solution for this. Hi enchanter, Thanks for providing such a good article. I will try it. Quote
xiangben Posted October 23, 2012 Author Report Posted October 23, 2012 (edited) how do you create create your driver? Hi uwes, Do we have any suggested example of parameterized interface with UVM? If there's one, we can follow it. Edited October 23, 2012 by xiangben Quote
janick Posted October 23, 2012 Report Posted October 23, 2012 Parameters used for sizing interfaces are like viruses! They propagate to every variable and environment that must use them. Much better to rely on Verilog's automatic resizing and be done with it. That way, you can write width-generic code. http://www.vmmcentral.org/vmartialarts/2008/07/size-does-matter/ Quote
xiangben Posted October 23, 2012 Author Report Posted October 23, 2012 Parameters used for sizing interfaces are like viruses! They propagate to every variable and environment that must use them. Much better to rely on Verilog's automatic resizing and be done with it. That way, you can write width-generic code. http://www.vmmcentral.org/vmartialarts/2008/07/size-does-matter/ Hi janick, Does the "resizing" you mentioned is to declare a maximum size of interface we may use and then assign the interface varibles to a smaller size of interface? Quote
Gunther Posted October 23, 2012 Report Posted October 23, 2012 (edited) Hi Benben, you could try making your interface polymorphic. I found that a very elegant way for the parameterized interface to not behave like a virus, as Janick said. (And he is right.) Cheers Gunther Edited October 24, 2012 by Gunther Quote
pratta Posted October 23, 2012 Report Posted October 23, 2012 I have just uploaded a package to the contributions section that demonstrate the problems that parameterized interfaces introduce, along with a few solutions that overcome those problems: http://www.uvmworld.org/contribution_download.php?id=208 Hopefully you'll find this useful. Quote
Gunther Posted October 24, 2012 Report Posted October 24, 2012 Hi Benben, you could try making your interface polymorphic. I found that a very elegant way for the parameterized interface to not behave like a virus, as Janick said. (And he is right.) Cheers Gunther You can find the recipe here: http://verificationhorizons.verificationacademy.com/volume-7_issue-3/articles/stream/polymorphic-interfaces-an-alternative-for-systemverilog-interfaces_vh-v7-i3.pdf Quote
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.