当前位置: 首页 > news >正文

网站服务器的搭建广州天河区建设网站公司

网站服务器的搭建,广州天河区建设网站公司,郴州网络营销,外企外贸是做什么的在验证平台中加入monitor时,看到driver和monitor之间的联系:两者之间的代码高度相似。其本质是因为二者 处理的是同一种协议,在同样一套既定的规则下做着不同的事情。由于二者的这种相似性,UVM中通常将二者封装在一起,…

        在验证平台中加入monitor时,看到driver和monitor之间的联系:两者之间的代码高度相似。其本质是因为二者 处理的是同一种协议,在同样一套既定的规则下做着不同的事情。由于二者的这种相似性,UVM中通常将二者封装在一起,成为 一个agent。因此,不同的agent就代表了不同的协议

class my_agent extends uvm_agent ;my_driver     drv;my_monitor    mon;function new(string name, uvm_component parent);super.new(name, parent);endfunction extern virtual function void build_phase(uvm_phase phase);extern virtual function void connect_phase(uvm_phase phase);`uvm_component_utils(my_agent)
endclass function void my_agent::build_phase(uvm_phase phase);super.build_phase(phase);if (is_active == UVM_ACTIVE) begindrv = my_driver::type_id::create("drv", this);endmon = my_monitor::type_id::create("mon", this);
endfunction function void my_agent::connect_phase(uvm_phase phase);super.connect_phase(phase);
endfunction

        所有的agent都要派生自uvm_agent类,且其本身是一个component,应该使用uvm_component_utils宏来实现factory注册
        这里最令人困惑的可能是build_phase中为何根据is_active这个变量的值来决定是否创建driver的实例。is_active是uvm_agent的一 个成员变量,从UVM的源代码中可以找到它的原型如下:

uvm_active_passive_enum is_active = UVM_ACTIVE;

        而uvm_active_passive_enum是一个枚举类型变量,其定义为:

typedef enum bit { UVM_PASSIVE=0, UVM_ACTIVE=1 } uvm_active_passive_enum;

        这个枚举变量仅有两个值:UVM_PASSIVE和UVM_ACTIVE在uvm_agent中,is_active的值默认为UVM_ACTIVE,在这种模 式下,是需要实例化driver的。那么什么是UVM_PASSIVE模式呢?以本章的DUT为例,如图2-5所示,在输出端口上不需要驱动任 何信号,只需要监测信号。在这种情况下,端口上是只需要monitor的,所以driver可以不用实例化。

        在把driver和monitor封装成agent后,在env中需要实例化agent,而不需要直接实例化driver和monitor了:

class my_env extends uvm_env;my_agent  i_agt;my_agent  o_agt;function new(string name = "my_env", uvm_component parent);super.new(name, parent);endfunctionvirtual function void build_phase(uvm_phase phase);super.build_phase(phase);i_agt = my_agent::type_id::create("i_agt", this);o_agt = my_agent::type_id::create("o_agt", this);i_agt.is_active = UVM_ACTIVE;o_agt.is_active = UVM_PASSIVE;endfunction`uvm_component_utils(my_env)
endclass

        完成i_agt和o_agt的声明后,在my_env的build_phase中对它们进行实例化后,需要指定各自的工作模式是active模式还是passive 模式。现在,整棵UVM树变为了如图2-6所示形式。

        由于agent的加入,driver和monitor的层次结构改变了,在top_tb中使用config_db设置virtual my_if时要注意改变路径:

initial beginuvm_config_db#(virtual my_if)::set(null, "uvm_test_top.i_agt.drv", "vif", input_if);uvm_config_db#(virtual my_if)::set(null, "uvm_test_top.i_agt.mon", "vif", input_if);uvm_config_db#(virtual my_if)::set(null, "uvm_test_top.o_agt.mon", "vif", output_if);
end

        在加入了my_agent后,UVM的树形结构越来越清晰。首先,只有uvm_component才能作为树的结点,像my_transaction这种使 用uvm_object_utils宏实现的类是不能作为UVM树的结点的。其次,在my_env的build_phase中,创建i_agt和o_agt的实例是在 build_phase中;在agent中,创建driver和monitor的实例也是在build_phase中。按照前文所述的build_phase的从树根到树叶的执行顺 序,可以建立一棵完整的UVM树。UVM要求UVM树最晚在build_phase时段完成,如果在build_phase后的某个phase实例化一个 component:

class my_env extends uvm_env;…virtual function void build_phase(uvm_phase phase);super.build_phase(phase);endfunctionvirtual task main_phase(uvm_phase phase);i_agt = my_agent::type_id::create("i_agt", this);o_agt = my_agent::type_id::create("o_agt", this);i_agt.is_active = UVM_ACTIVE;o_agt.is_active = UVM_PASSIVE;endtask
endclass

        如上所示,将在my_env的build_phase中的实例化工作移动到main_phase中,UVM会给出如下错误提示:

UVM_FATAL @ 0: i_agt [ILLCRT] It is illegal to create a component ('i_agt' under 'uvm_test_top') after

        那么是不是只能在build_phase中执行实例化的动作呢?答案是否定的。其实还可以在new函数中执行实例化的动作。如可以在 my_agent的new函数中实例化driver和monitor:

function new(string name, uvm_component parent);super.new(name, parent);if (is_active == UVM_ACTIVE) begindrv = my_driver::type_id::create("drv", this);endmon = my_monitor::type_id::create("mon", this);
endfunction

        这样引起的一个问题是无法通过直接赋值的方式向uvm_agent传递is_active的值。在my_env的build_phase(或者new函数)中,向i_agt和o_agt的is_active赋值,根本不会产生效果。因此i_agt和o_agt都工作在active模式(is_active的默认值是UVM_ACTIVE), 这与预想差距甚远。要解决这个问题,可以在my_agent实例化之前使用config_db语句传递is_active的值:

class my_env extends uvm_env;virtual function void build_phase(uvm_phase phase);super.build_phase(phase);uvm_config_db#(uvm_active_passive_enum)::set(this, "i_agt", "is_active", UVM_ACTIVE);uvm_config_db#(uvm_active_passive_enum)::set(this, "o_agt", "is_active", UVM_PASSIVE);i_agt = my_agent::type_id::create("i_agt", this);o_agt = my_agent::type_id::create("o_agt", this);endfunction
endclassclass my_agent extends uvm_agent ;function new(string name, uvm_component parent);super.new(name, parent);uvm_config_db#(uvm_active_passive_enum)::get(this, "", "is_active", is_active);if (is_active == UVM_ACTIVE) begindrv = my_driver::type_id::create("drv", this);endmon = my_monitor::type_id::create("mon", this);endfunction
endclass

        只是UVM中约定俗成的还是在build_phase中完成实例化工作。因此,强烈建议仅在build_phase中完成实例化。

http://www.15wanjia.com/news/166044.html

相关文章:

  • 3模网站建设常用的oa系统办公软件
  • 网站目录架构江门外贸集团有限公司英文网站
  • 阿里云服务器做电影网站吗无锡百姓网推广
  • 营销型网站建设的小技巧网站域名注册时间查询
  • 宁波市建设局网站wordpress 升级 xampp 无法定义根目录
  • 北京做网站的价格素材网站设计模板下载
  • 电话销售做网站推销自己创建一个公司
  • 惠州做网站优化h5页面制作工具app
  • 设计前沿的网站企业推广策划
  • 网站建设论文总结网站是用什么语言写的
  • 备案网站主办者承诺书中国网站开发公司排名
  • 杭州pc网站开发公司有哪些wordpress外贸主题
  • 网站界面设计ps网站建设开题报告书
  • 推荐佛山伦教网站设计网站建设提案怎么写
  • 泰安市违法建设网站wordpress登录地址修改
  • 政务建设网站得必要性电商平台的搭建
  • 深圳坪山站免费网站收录网站推广
  • 英德建设网站网站建设的整体框架
  • 网页设计专业级南宁7天优化网络科技公司
  • 百度账号找回上海百度seo网站优化
  • 找工作一般上什么网站比较好推广文案范例
  • 东阳厂家高端网站设计wordpress微博主题
  • 易旅游网站建设合肥做网站优化
  • 怎样免费建立网站百度上广告怎么搞上去的
  • 贵阳住房和城乡建设部网站龙岩属于哪里
  • 免费发布租房信息网站怎么做整人网站
  • 0基础怎么做网站模版降龙网络专业做网站
  • 北京网站设计确保代码符合w3c仿中国化妆品网站模板
  • 做网站一直不知道做什么网站中国建设银行青浦支行网站
  • 谁有手机网站发几个吧重庆哪里做网站