詹姆斯·邦德作为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. 洛谷 1082 同余方程——exgcd(水题)

    题目:https://www.luogu.org/problemnew/show/P1082 大水题. #include<iostream> #include<cstdio> ...

  2. android jni java类型与c语言类型互换

    1.java String转换 C str char* Jstring2CStr(JNIEnv* env, jstring jstr) { char* rtn = NULL; jclass clsst ...

  3. Qt5.7不能加载MySql驱动问题.(需要重新编译驱动)

    转自:http://blog.csdn.net/qq_28851503/article/details/52422302 首先贴上我遇到的问题,如下: QSqlDatabase: QMYSQL dri ...

  4. 4月超棒的JavaScript游戏开发框架推荐(1) – 51CTO.COM

    基于JavaScript开发的游戏是唯一一个能够跨桌面,Web和移动三种平台的.… 查阅全文 ›

  5. fullpage中高度错误的解决方法

    今天我再用fullpage写全屏页面的时候,发现在ie中,一整屏的页面总是不能铺满,高度总是少一截儿,各种搜索,找到了个合适的方法,这里记录下,也希望给之后遇到这个问题的人提供一种方式,当然不一定能解 ...

  6. git远程提交到github或者gitee

    一.git安装 git官网下载 https://git-scm.com/downloads ,既有Windows的.Linux的以及Macos的. windowds下载安装git的可执行文件,就会有两 ...

  7. HTML5资料整理 [From luics]

    来自http://www.cnblogs.com/luics/,新浪微博@徐凯-鬼道 HTML5资料整理   项目组要做html5这块,花了一周左右时间收集的,快有一年时间了,部分内容需要更新,仅供参 ...

  8. HDU1083 【匹配问题】

    题意: 有P门课,N个学生,给出每门课上的人. 然后问你能不能使得每门课有一个课代表 思路: 课和学生是两类,且同类之间没有关系,构成二分图:直接就是一个最大匹配问题: 注意点: 1.是给课进行匹配不 ...

  9. hdu5861【线段树】

    题意: 有n个点,每个两两之间有一条路,给出每条路开放的花费,每条路只能打开关闭一次,然后m天里给出一个区间代表这条路必须在该天开放,求每天需要的花费. 思路: 这是一题纯粹用线段树搞的题. 我们可以 ...

  10. typescript语法入门

    一.字符串 1.多行字符串: (支持换行) ` <div></div> <p></p> ` 2.表达式:${} --> 变量 var a = 'd ...