詹姆斯·邦德作为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. bzoj 2655 calc —— 拉格朗日插值

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2655 先设 f[i][j] 表示长度为 i 的序列,范围是 1~j 的答案: 则 f[i][ ...

  2. windows兼容dirent.h

    尝试在windows下跑KCF算法,创建工程编译后出现: Error 4 error C1083: Cannot open include file: 'dirent.h': No such file ...

  3. TP5之页面跳转样式

    1.效果图 2.上干货 为了增加对移动设备的支持,在  /application/common.php加入以下函数: function isMobile() { if (isset ($_SERVER ...

  4. TP5实现签到功能

    基于tp5 模型的一个签到功能: 由于存储所有的签到日期数据库会非常庞大,所以签到日期只存储近三个月的. 具体功能: 1.记录最近一次的签到时间 2.每次签到都会添加15积分 3.有连续签到的记录 C ...

  5. 51nod 1102 【单调栈】

    思路: 对于这个高度往左能延伸最远x,往右能延伸最远y,(x+1+y)*w; 利用单调栈就行了: #include <cstdio> #include <stack> #inc ...

  6. 3DMAX 7 角色建模1 人头建模

    说明: mesh与poly 可编辑多边形是一个多边形网格:即与可编辑网格不同,其使用超过三面的多边形.可编辑多边形非常有用,因为它们可以避免看不到边缘.例如,如果您对可编辑多边形执行切割和切片操作,程 ...

  7. 新手安装 hadoop、hive和hbase 笔记

    系统是ubuntu 12.04 , hadoop版本是1.2.1 , hive版本是0.12 , hbase版本我忘记了,不好意思首先是配置好hostnamevi /etc/hosts写入你要配置的i ...

  8. (转)linux du命令

    转自 http://www.cnblogs.com/peida/archive/2012/12/10/2810755.html Linux du命令也是查看使用空间的,但是与df命令不同的是Linux ...

  9. P3809【模板】后缀排序

    传送门 深入理解了一波后缀数组,这东西真的很妙诶,自己推感觉完全不现实,看来只能靠背代码了 这段时间就多敲敲,把板子记熟吧 代码: #include<cstdio> #include< ...

  10. jar工具的使用