uvm_agent——007(特工)
詹姆斯·邦德作为007的代言人,很好地诠释了agent的含义。但是在计算机系统中agent(代理)指能自主活动的软件或者硬件实体。在UVC中agent作为容器,实例化VIP的所有模块包括driver, monitor, sequencer等等。现在然我们揭开它的神秘面目。
//------------------------------------------------------------------------------
//
// CLASS: uvm_agent
//
// The uvm_agent virtual class should be used as the base class for the user-
// defined agents. Deriving from uvm_agent will allow you to distinguish agents
// from other component types also using its inheritance. Such agents will
// automatically inherit features that may be added to uvm_agent in the future.
//
// While an agent's build function, inherited from <uvm_component>, can be
// implemented to define any agent topology, an agent typically contains three
// subcomponents: a driver, sequencer, and monitor. If the agent is active,
// subtypes should contain all three subcomponents. If the agent is passive,
// subtypes should contain only the monitor.
//------------------------------------------------------------------------------ virtual class uvm_agent extends uvm_component;
uvm_active_passive_enum is_active = UVM_ACTIVE; // Function: new
//
// Creates and initializes an instance of this class using the normal
// constructor arguments for <uvm_component>: ~name~ is the name of the
// instance, and ~parent~ is the handle to the hierarchical parent, if any.
//
// The int configuration parameter is_active is used to identify whether this
// agent should be acting in active or passive mode. This parameter can
// be set by doing:
//
//| uvm_config_int::set(this, "<relative_path_to_agent>, "is_active", UVM_ACTIVE); function new (string name, uvm_component parent);
super.new(name, parent);
endfunction function void build_phase(uvm_phase phase);
int active;
uvm_resource_pool rp;
uvm_resource_types::rsrc_q_t rq; super.build_phase(phase);
// is_active is treated as if it were declared via `uvm_field_enum,
// which means it matches against uvm_active_passive_enum, int,
// int unsigned, uvm_integral_t, uvm_bitstream_t, and string.
rp = uvm_resource_pool::get();
rq = rp.lookup_name(get_full_name(), "is_active", null, );
uvm_resource_pool::sort_by_precedence(rq);
for (int i = ; i < rq.size(); i++) begin
uvm_resource_base rsrc = rq.get(i);
uvm_resource#(uvm_active_passive_enum) rap; if ($cast(rap, rsrc)) begin
is_active = rap.read(this);
break;
end
else begin
uvm_resource#(uvm_integral_t) rit;
if ($cast(rit, rsrc)) begin
is_active = uvm_active_passive_enum'(rit.read(this));
break;
end
else begin
uvm_resource#(uvm_bitstream_t) rbs;
if ($cast(rbs, rsrc)) begin
is_active = uvm_active_passive_enum'(rbs.read(this));
break;
end
else begin
uvm_resource#(int) ri;
if ($cast(ri, rsrc)) begin
is_active = uvm_active_passive_enum'(ri.read(this));
break;
end
else begin
uvm_resource#(int unsigned) riu;
if ($cast(riu, rsrc)) begin
is_active = uvm_active_passive_enum'(riu.read(this));
break;
end
else begin
uvm_resource#(string) rs;
if ($cast(rs, rsrc)) begin
void'(uvm_enum_wrapper#(uvm_active_passive_enum)::from_name(rs.read(this), is_active));
break;
end
end // else: !if($cast(riu, rsrc))
end // else: !if($cast(ri, rsrc))
end // else: !if($cast(rbs, rsrc))
end // else: !if($cast(rit, rsrc))
end // else: !if($cast(rap, rsrc))
end // for (int i = 0; found == 0 && i < rq.size(); i++) endfunction const static string type_name = "uvm_agent"; virtual function string get_type_name ();
return type_name;
endfunction // Function: get_is_active
//
// Returns UVM_ACTIVE is the agent is acting as an active agent and
// UVM_PASSIVE if it is acting as a passive agent. The default implementation
// is to just return the is_active flag, but the component developer may
// override this behavior if a more complex algorithm is needed to determine
// the active/passive nature of the agent. virtual function uvm_active_passive_enum get_is_active();
return is_active;
endfunction
endclass
这里面最重要的变量是is_active, 用来定义user_agent 中是否实例化driver. build_phase 中关于is_active 的值是在UVM1.2中新加的在uvm-1.1d中实现特别简单
if(get_config_int("is_active", active)) is_active = uvm_active_passive_enum'(active);
uvm_agent——007(特工)的更多相关文章
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数007, match,图像匹配
<zw版·Halcon-delphi系列原创教程> Halcon分类函数007, match,图像匹配 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换 ...
- 2016动作短片《全境封锁:特工起源》HD720P.英语中字
导演: 德文·格雷厄姆主演: Matt Lynch / Sasha Andreev / Amanda Day类型: 动作 / 短片制片国家/地区: 美国语言: 英语上映日期: 2016-01-19片长 ...
- php大力力 [007节]php静态表量
2015-08-23 php大力力007. php静态表量 这里看一下高老师的视频讲解: 转帖: php中static静态类与static 静态变量用法区别 php中的静态变量的基本用法 转载 时间: ...
- [反汇编练习] 160个CrackMe之007
[反汇编练习] 160个CrackMe之007. 本系列文章的目的是从一个没有任何经验的新手的角度(其实就是我自己),一步步尝试将160个CrackMe全部破解,如果可以,通过任何方式写出一个类似于注 ...
- 极客技术专题【007期】:jQuery初学者入门 - jQuery Event
日期:2013-8-19 来源:GBin1.com 技术专题介绍 专题:jQuery初学者入门[第三讲:jQuery Event] 分享人:极客标签技术编辑 -Lana (请站内关注分享人) 授课时 ...
- [jQuery编程挑战]007 切换数据表格的行列
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8&quo ...
- 【图文】雪佛兰Suburban 美国特工标准座驾_新闻中心_易车网
[图文]雪佛兰Suburban 美国特工标准座驾_新闻中心_易车网 雪佛兰Suburban 美国特工标准座驾
- STM8S003/005/007芯片解密单片机解密程序提取复制经验分享!
STM8S003/005/007芯片解密单片机解密程序提取复制 芯片解密型号: STM8S003K3T6,STM8S005K6T6,STM8S007C8T6,STM8S003F3P6 STM8S005 ...
- 宇宙探索特工队&scrum
对scrum的一些理解 Scrum是一种迭代式增量软件开发过程,通常用于敏捷软件开发.Scrum包括了一系列实践和预定义角色的过程骨架.Scrum中的主要角色包括同项目经理类似的Scrum主管角色负责 ...
随机推荐
- Azure Key Vault (3) 在Azure Windows VM里使用Key Vaule
<Windows Azure Platform 系列文章目录> 本章我们介绍如何在Azure Windows VM里面,使用.NET使用Azure Key Vault 我们需要对Key V ...
- HDU2896(AC自动机入门题)
病毒侵袭 Time Limit:1000MS Memory Limit:32768KB Description 当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻....在这 ...
- android系统的源代码获取(亲测可用)
1.在线阅读各版本源代码: http://androidxref.com/ 2.下载到本地: http://blog.csdn.net/yin1031468524/article/details/55 ...
- QDUOJ LC的课后辅导 单调递增栈
LC的课后辅导 发布时间: 2015年9月19日 21:42 时间限制: 1000ms 内存限制: 256M 描述 有一天,LC给我们出了一道题,如图: 这个图形从左到右由若干个 宽为1 高不 ...
- C++多态性:虚函数的调用原理
多态性给我们带来了好处:多态使得我们可以通过基类的引用或指针来指明一个对象(包含其派生类的对象),当调用函数时可以自动判断调用的是哪个对象的函数. 一个函数说明为虚函数,表明在继承的类中重载这个函数时 ...
- 前端之CSS2
CSS盒子模型 CSS盒子模型介绍 盒子模型解释 元素在页面中显示成一个方块,类似一个盒子,CSS盒子模型就是使用现实中盒子来做比喻,帮助我们设置元素对应的样式. 盒子模型示意图如下: 把元素叫做盒子 ...
- E20180603-hm
breadth n. 宽度; 宽容; (知识.兴趣等的) 广泛; depth n. 深度; 深处,深海; 深奥,奥妙; 进深; deep adj. 深的; 深远的,深奥; 重大的,深刻的; 强烈的 ...
- html页面选择图片上传时实现图片预览功能
实现效果如下图所示 只需要将下面的html部分的代码放入你的代码即可 (注意引入jQuery文件和html头部的css样式,使用的是ajax提交) <!-- 需引入jQuery 引入样式文件 引 ...
- bootstrap添加多个模态对话框支持
bootstrap添加多个模态对话框支持 (2015-03-04 21:05:35) 转载▼ 标签: 房产 因为项目需要,在页面交互上要弹出多个dialog窗口,而bootstrap的modal支 ...
- [Xcode 实际操作]三、视图控制器-(2)UITabBarController选项卡(标签)视图控制器
目录:[Swift]Xcode实际操作 本文将为你演示,选项卡视图控制器的创建和使用. 在项目文件夹[DemoApp]上点击鼠标右键,弹出右键菜单. [New File]->[Cocoa Tou ...