首页 > 其他分享 >sv宏展开+参数化类+uvm_coreservice_t+m_sequencer的出现

sv宏展开+参数化类+uvm_coreservice_t+m_sequencer的出现

时间:2023-09-09 12:12:40浏览次数:38  
标签:set get factory server coreservice uvm sv

sv的宏展开

https://www.systemverilog.io/verification/macros/

`"

包括双引号,双引号内的参数应替换,并且任何嵌入的宏都应该展开。
image

`\`"

在宏拓展结果中使用双引号。
image

参数化类

如果是要传入一种类型,使用关键字type

class packet #(int size = 1); //定义参数化类
	bit [size-1 : 0] a;
endclass:packet
packet #(.size(16)) p2;

class packet # (type T = int);
    T t;
endclass
packet #(real) p1;

uvm_coreservice_t

https://blog.csdn.net/weixin_40634003/article/details/121981228
这个单例对象是获取uvm核心服务的一个API。最重要的机制(也是必须做统一例化处理的组件)都放置在了uvm_coreservice_t类中。而该类独立于UVM环境之外。用户可以获取核心服务类中的任何一个对象,例如uvm_default_factory对象,继而直接利用factory来实现创建和覆盖,当然,创建和覆盖也可以由其他方式完成。
使用方法:
https://blog.csdn.net/weixin_40357487/article/details/110621315

// 虽然返回的是子类对象,但是调用的却是父类中的静态方法,
// 因此返回的是提供uvm_coreservice_t接口的实例。
 // 返回uvm_default_coreservice_t
uvm_coreservice_t cs = uvm_coreservice_t::get();类的对象;
// 返回uvm_factory的实例对象;
uvm_factory factory = cs.get_factory();
//----------------------------------------------------------------------
// Class: uvm_coreservice_t
//
// The singleton instance of uvm_coreservice_t provides a common point for all central 
// uvm services such as uvm_factory, uvm_report_server, ...
// The service class provides a static <::get> which returns an instance adhering to uvm_coreservice_t
// the rest of the set_<facility> get_<facility> pairs provide access to the internal uvm services
//
// Custom implementations of uvm_coreservice_t can be included in uvm_pkg::*
// and can selected via the define UVM_CORESERVICE_TYPE. They cannot reside in another package.
//----------------------------------------------------------------------

virtual class uvm_coreservice_t;
	// Function: get_factory
	//
	// intended to return the currently enabled uvm factory, 
	pure virtual function uvm_factory get_factory();

	// Function: set_factory
	//
	// intended to set the current uvm factory
	pure virtual function void set_factory(uvm_factory f);

	// Function: get_report_server
	// intended to return the current global report_server
	pure virtual function uvm_report_server get_report_server();

	// Function: set_report_server
	// intended to set the central report server to ~server~
	pure virtual function void set_report_server(uvm_report_server server);

        // Function: get_default_tr_database
        // intended to return the current default record database
        pure virtual function uvm_tr_database get_default_tr_database();

        // Function: set_default_tr_database
        // intended to set the current default record database to ~db~
        //
        pure virtual function void set_default_tr_database(uvm_tr_database db);
   
	// Function: set_component_visitor
	// intended to set the component visitor to ~v~
	// (this visitor is being used for the traversal at end_of_elaboration_phase
	// for instance for name checking)
	pure virtual function void set_component_visitor(uvm_visitor#(uvm_component) v);
	
	// Function: get_component_visitor
	// intended to retrieve the current component visitor 
	// see <set_component_visitor>
	pure virtual function uvm_visitor#(uvm_component) get_component_visitor();

	// Function: get_root
	//
	// returns the uvm_root instance
	pure virtual function uvm_root get_root();

	local static `UVM_CORESERVICE_TYPE inst;
	// Function: get
	//
	// Returns an instance providing the uvm_coreservice_t interface.
	// The actual type of the instance is determined by the define `UVM_CORESERVICE_TYPE.
	//
	//| `define UVM_CORESERVICE_TYPE uvm_blocking_coreservice
	//| class uvm_blocking_coreservice extends uvm_default_coreservice_t;
	//|    virtual function void set_factory(uvm_factory f);
	//|       `uvm_error("FACTORY","you are not allowed to override the factory")
	//|    endfunction
	//| endclass
	//|
	static function uvm_coreservice_t get();
		if(inst==null)
			inst=new;

		return inst;
	endfunction // get

endclass

m_sequencer的出现

m_sequencer是在body中才出现的,因此使用uvm_declare_p_sequencer(m_sequencer),
并不能获得p_sequencer,而是一个语法错误。

标签:set,get,factory,server,coreservice,uvm,sv
From: https://www.cnblogs.com/bai2022/p/17689214.html

相关文章

  • sv timescale
    timescale1timescale作用`timescale是Verilog中的预编译指令,指定位于它后边的module的时间单位和时间精度,直到遇到新的`timescale指令或者`resetall指令。它的语法如下:`timescaletime_unit/time_precision假如我们延时x个时间单位,那延时的总时间time=x*time_unit,但最后......
  • TortoiseSVN安装后右键没有TortoiseSVN选项的解决方法
    TortoiseSVN正确安装后右键没有TortoiseSVN选项的解决方法1、在开始菜单->所有程序->TortoiseSVN->Settings; 2、在General选项中选择ContextMenu,如下图所示: 3.、点击应用确定,返回桌面右键查看是否显示TortoiseSVN的选项,如果还是没有,请先将ContextMenu中的选项去掉点击应......
  • 直播商城源码,d3.js svg中的text字体大小设置
    直播商城源码,d3.jssvg中的text字体大小设置svg的text有一个font-size属性 <textx="5"y="25"fill="red"font-size="30">A</text>  ​用d3.v4.js设置  svg.append("text")   .attr("y",25)   .attr(&quo......
  • JS Blob 下载时导出csv,通过excel软件打开中文乱码的问题:
    proxy.$http.post(url,commitObject.value,{headers:{responseType:'blob'}}).then((p)=>{if(p.data.code==200||p.status==200){ElMessage.success('预测成功,等待结果展示!')if(commitObject.value.returnTyp......
  • postgis数据库导出csv表再导入postgis
    1、导出csv表fromsettings_Addressimport*fromsqlalchemyimportcreate_engine,MetaDataimportpandasaspddefcreate_conn(Postgis_user,Postgis_password,Postgis_host,Postgis_port,dbname_PG):#returncreate_engine('Postgis+pyPostgis://{}:{}@{}:{}/......
  • QGraphicsScene和QGraphicsView坐标系统
     GraphicsView中有三个坐标系统,即场景坐标、视图坐标、图形项坐标。场景坐标场景坐标等价于QPainter的逻辑坐标,一般以场景中心为原点;视图坐标与设备坐标相同,是物理坐标,默认为左上角为原点;图形项的坐标是局部逻辑坐标,一般以图形项的中心为原点。一个图形项的位置是其中心点在......
  • QGraphicsView父类中MouseMove和MouseButtonRelease事件获取办法
    QGraphicsView是QT支持的一套图元显示框架。最近在开发过程中发现一个问题,在QGraphicsView父类(QWidget)中重载mousePressEvent和mouseMoveEvent事件,只能获取到mousePress事件,mouseMove事件不论如何都获取不到,测试代码如下,为了方便测试将布局的Margin设置成了20。发现在Margin区域......
  • svn客户端重置密码
    svn客户端重置密码`Windows:C:\Users\YourUsername\AppData\Roaming\Subversion\auth\svn.simple``macOS:/Users/YourUsername/.subversion/auth/svn.simple``Linux:/home/YourUsername/.subversion/auth/svn.simple`这里输入引用文本打开里面的文件,找到对应的svn链接的......
  • 【图像格式】YUV,RGB与HSV图像格式简述
    主流图像存储格式参考文章:一文读懂YUV的采样与格式-知乎(zhihu.com)RGB颜色编码,每个像素点都有红,绿,蓝三个原色,其中每种原色都占用8bit,即1个字节,那么一个像素点也就占用24bit,也就是三个字节。那么一张1280x720大小的图片就占用1280x720x3/1024/1024=2.63MB存储空间。YUV颜......
  • [转]如何在 MySQL / MariaDB 中导入导出数据,导入导出数据库文件、Excel、CSV
    原文地址:如何在MySQL/MariaDB中导入导出数据,导入导出数据库文件、Excel、CSV-掘金在日常的数据库维护工作中,经常需要对数据库进行导入导出操作,备份、分析、迁移数据都需要用到导入导出功能,在本教程中将详细讲解所有常见的MySQL和MariaDB中导入导出数据的方法(注意:MyS......