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主管角色负责 ...
随机推荐
- bzoj1598
K短路 和超级钢琴之类的差不多 先反图跑最短路,从原点向外拓展,每个点最多拓展k次,否则不可能是k短路 #include<bits/stdc++.h> using namespace st ...
- error: declaration of 'cv::Mat R ' shadows a parameter
变量被覆盖. 例: void pose_estimation_2d2d::_pose_estimation_2d2d(const vector<KeyPoint> &v_keypo ...
- UVaLive 3695 City Game (扫描线)
题意:给定m*n的矩阵,有的是空地有的是墙,找出一个面积最大的子矩阵. 析:如果暴力,一定会超时的.我们可以使用扫描线,up[i][j] 表示从(i, j)向上可以到达的最高高度,left[i][j] ...
- HTML学习笔记(二)HTML格式化
很多标签都可以用来改变文本的外观,并为文本关联其隐藏的含义.总地来说,这些标签可以分成两类:基于内容的样式(content-based style)和物理样式(physical style). 一.基 ...
- Git 移除某些文件
一.前言 在使用 Git 版本控制中,有些文件是不需要加入到版本控制中的.如 日志( log ).编译的文件.这些随时都在变的文件,使用用一个代码库的用户.只要稍稍修改一点,或者启动一下,就会变.容易 ...
- Unity5.0 EventSystem事件系统的详细说明
http://www.manew.com/blog-56596-2917.html?_dsign=53b25d5d unity5.0开发了新的UI系统UGUI,附带的事件系统EventSystem不仅 ...
- 根运动 (Root Motion) – 工作原理
http://blog.csdn.net/myarrow/article/details/45505085 1. 基本概念 在Unity3D动画中,模型的位置.角度经常会发生变化,我们需要决定是否将模 ...
- Unity中HideInInspector和SerializeField
http://blog.sina.com.cn/s/blog_697b1b8c0102uxvn.html Unity会自动为Public变量做序列化,序列化的意思是说再次读取Unity时序列化的变量是 ...
- 51nodcontest#24 A(xjb)
題目鏈接:http://www.51nod.com/contest/problem.html#!problemId=1804 題意:中文題誒~ 思路: 三角形個數爲n-1, a, b數組元素個數也爲n ...
- ajax请求过程
1.什么是ajax AJAX=Asynchronous JavaScript and XML =====>异步的javascript和xml AJAX是在不重新加载整个页面的情况下与服务器交换 ...