詹姆斯·邦德作为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(特工)的更多相关文章

  1. 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数007, match,图像匹配

    <zw版·Halcon-delphi系列原创教程> Halcon分类函数007, match,图像匹配 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换 ...

  2. 2016动作短片《全境封锁:特工起源》HD720P.英语中字

    导演: 德文·格雷厄姆主演: Matt Lynch / Sasha Andreev / Amanda Day类型: 动作 / 短片制片国家/地区: 美国语言: 英语上映日期: 2016-01-19片长 ...

  3. php大力力 [007节]php静态表量

    2015-08-23 php大力力007. php静态表量 这里看一下高老师的视频讲解: 转帖: php中static静态类与static 静态变量用法区别 php中的静态变量的基本用法 转载 时间: ...

  4. [反汇编练习] 160个CrackMe之007

    [反汇编练习] 160个CrackMe之007. 本系列文章的目的是从一个没有任何经验的新手的角度(其实就是我自己),一步步尝试将160个CrackMe全部破解,如果可以,通过任何方式写出一个类似于注 ...

  5. 极客技术专题【007期】:jQuery初学者入门 - jQuery Event

    日期:2013-8-19  来源:GBin1.com 技术专题介绍 专题:jQuery初学者入门[第三讲:jQuery Event] 分享人:极客标签技术编辑 -Lana (请站内关注分享人) 授课时 ...

  6. [jQuery编程挑战]007 切换数据表格的行列

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8&quo ...

  7. 【图文】雪佛兰Suburban 美国特工标准座驾_新闻中心_易车网

    [图文]雪佛兰Suburban 美国特工标准座驾_新闻中心_易车网 雪佛兰Suburban 美国特工标准座驾

  8. STM8S003/005/007芯片解密单片机解密程序提取复制经验分享!

    STM8S003/005/007芯片解密单片机解密程序提取复制 芯片解密型号: STM8S003K3T6,STM8S005K6T6,STM8S007C8T6,STM8S003F3P6 STM8S005 ...

  9. 宇宙探索特工队&scrum

    对scrum的一些理解 Scrum是一种迭代式增量软件开发过程,通常用于敏捷软件开发.Scrum包括了一系列实践和预定义角色的过程骨架.Scrum中的主要角色包括同项目经理类似的Scrum主管角色负责 ...

随机推荐

  1. bzoj2257瓶子与燃料——最大公约数

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2257 可以知道最终能够导出的燃料一定是瓶子容量的gcd的倍数,所以此题转化为求n个数中k个数 ...

  2. es6 import 报错

    现在绝大多数的浏览器都不支持ES6,所以使用es6时需要使用bebal把es6转化为es5, 项目目录: demo1:单个js文件的转化 src文件下的 test1.js const aa=" ...

  3. CSS3 Object-fit和Object-position

    在响应式设计(RWD)中,令大家最头痛的问题的是图片的自适应处理问题.往往我采取的处理方式是给图片的容器设置一个尺寸,然后给图片设置下面的代码: img { max-width: 100%; heig ...

  4. Visual Studio 2013 Update 1

    Visual Studio 2013 Update 1 VS2013.1.iso 共 245 MB http://download.microsoft.com/download/8/2/6/826E2 ...

  5. Flutter实战视频-移动电商-62.购物车_首页Provide化 让跳转随心所欲

    62.购物车_首页Provide化 让跳转随心所欲 新建provide/currentIndex.dart 内容比较简单,定义一个变量当前页面的索引currentIndex,再定义一个方法改变它的值 ...

  6. UVaLive 6853 Concert Tour (DP)

    题意:给定 n 个城市,m 个月,表示要在这 n 个城市连续 m 个月开演唱会,然后给定每个月在每个城市开演唱会能获得的利润,然后就是演唱会在不同城市之间调动所要的费用, 问你,怎么安排这 n 个演唱 ...

  7. 洛谷1087 FBI树 解题报告

    洛谷1087 FBI树 本题地址:http://www.luogu.org/problem/show?pid=1087 题目描述 我们可以把由“0”和“1”组成的字符串分为三类:全“0”串称为B串,全 ...

  8. 51nod 1067【简单博弈】

    卧槽,第一次自己推推推做出来的... 对于1,那么就是A取完就好 --A 对于2,只能是A拿一个 --B 对于3和4,都是A拿完 --A 对于5,靠向2,A取3,B只能1 --A 对于6,A取一个的话 ...

  9. WINDOWS编程基础-最简单的windows程序

    流程 1 建立并注册windows类 2 使用windows类创建窗口 3 实现事件处理,主循环 PeekMessage与GetMessage的对比 相同点: PeekMessage函数与GetMes ...

  10. Aufree/trip-to-iOS

    https://github.com/Aufree/trip-to-iOS?utm_source=next.36kr.com