uvm_dpi——DPI在UVM中的实现(一)
uvm_dpi.svh源代码如下:
`ifndef UVM_DPI_SVH
`define UVM_DPI_SVH //
// Top-level file for DPI subroutines used by UVM.
//
// Tool-specific distribution overlays may be required.
//
// To use UVM without any tool-specific overlay, use +defin+UVM_NO_DPI
// `ifdef UVM_NO_DPI
`define UVM_HDL_NO_DPI
`define UVM_REGEX_NO_DPI
`define UVM_CMDLINE_NO_DPI
`endif `include "dpi/uvm_hdl.svh"
`include "dpi/uvm_svcmd_dpi.svh"
`include "dpi/uvm_regex.svh" `endif // UVM_DPI_SVH
uvm_dpi.cc 的源代码如下:
//
// Top-level file that includes all of the C/C++ files required
// by UVM
//
// The C code may be compiled by compiling this top file only,
// or by compiling individual files then linking them together.
// #ifdef __cplusplus
extern "C" {
#endif #include <stdlib.h>
#include "uvm_dpi.h"
#include "uvm_common.c"
#include "uvm_regex.cc"
#include "uvm_hdl.c"
#include "uvm_svcmd_dpi.c" #ifdef __cplusplus
}
#endif
uvm_dpi.cc 和uvm_dpi.svh相比多了<stdlib.h>标准库,"uvm_dpi.h"头文件和"uvm_common.c"源文件。
让我们看看uvm_dpi.h头文件(C语言的代码风格每个*.c文件配置一个*.h 文件),在该文件中声明了m_uvm_report_dpi和int_str_max()函数。这两个函数的定义在uvm_common.c中。
//
// Top level header filke that wraps all requirements which
// are common to the various C/C++ files in UVM.
// #ifndef UVM_DPI__H
#define UVM_DPI__H #include <stdlib.h>
#include "vpi_user.h"
#include "veriuser.h"
#include "svdpi.h"
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <regex.h>
#include <limits.h> // The following consts and method call are for
// internal usage by the UVM DPI implementation,
// and are not intended for public use.
static const int M_UVM_INFO = ;
static const int M_UVM_WARNING = ;
static const int M_UVM_ERROR = ;
static const int M_UVM_FATAL = ; static const int M_UVM_NONE = ;
static const int M_UVM_LOW = ;
static const int M_UVM_MEDIUM = ;
static const int M_UVM_HIGH = ;
static const int M_UVM_FULL = ;
static const int M_UVM_DEBUG = ; void m_uvm_report_dpi(int severity,
char* id,
char* message,
int verbosity,
char* file,
int linenum); int int_str_max( int ); #endif
让我们来看看uvm_common.c 的内容,这个文件就是实现了m_uvm_report_dpi()和int_str_max()函数.
// Implementation of common methods for DPI extern void m__uvm_report_dpi(int,const char*,const char*,int,const char*, int); #if defined(INCA) || defined(NCSC)
const static char* uvm_package_scope_name = "uvm_pkg::";
#else
const static char* uvm_package_scope_name = "uvm_pkg";
#endif void m_uvm_report_dpi( int severity,
char* id,
char* message,
int verbosity,
char* file,
int linenum) {
svScope old_scope = svSetScope(svGetScopeFromName(uvm_package_scope_name));
m__uvm_report_dpi(severity, id, message, verbosity, file, linenum);
svSetScope(old_scope);
} int int_str_max ( int radix_bits ) {
int val = INT_MAX;
int ret = ;
while ((val = (val /radix_bits)))
ret++;
return ret;
}
参考文献:
1 PLI, DPI, DiectC, TLi-1. http://www.cnblogs.com/chenrui/archive/2012/09/18/2689956.html
2 PLI, DPI, DirectC,TLI - 2. http://www.cnblogs.com/chenrui/archive/2012/09/18/2689957.html
uvm_dpi——DPI在UVM中的实现(一)的更多相关文章
- uvm_hdl——DPI在UVM中的实现(四)
我们可以在uvm中实现HDL的后门访问,具体包括的function有uvm_hdl_check_path,uvm_hdl_deposit, uvm_hdl_force,uvm_hdl_release, ...
- uvm_regex——DPI在UVM中的实现(三)
UVM的正则表达是在uvm_regex.cc 和uvm_regex.svh 中实现的,uvm_regex.svh实现UVM的正则表达式的源代码如下: `ifndef UVM_REGEX_NO_DPI ...
- uvm_svcmd_dpi——DPI在UVM中的实现(二)
UVM中有需要从cmmand line 输入参数的需求,所有uvm_svcmd_dpi.svh和uvm_svcmd_dpi.cc 文件就是实现功能. uvm_svcmd_dpi.svh的源代码如下,我 ...
- UVM中的class
UVM中的类包括:基类(base)------------uvm_void/uvm_object/uvm_transaction/uvm_root/uvm_phase/uvm_port_base 报告 ...
- UVM中的sequence使用(一)
UVM中Driver,transaction,sequence,sequencer之间的关系. UVM将原来在Driver中的数据定义部分,单独拿出来成为Transaction,主要完成数据的rand ...
- UVM中的regmodel建模(三)
总结一下UVM中的寄存器访问实现: 后门访问通过add_hdl_path命令来添加寄存器路径,并扩展uvm_reg_backdoor基类,定义read与write函数,最后在uvm_reg_block ...
- UVM中的regmodel建模(一)
UVM中的regmodel继承自VMM的RAL(Register Abstract Layer),现在可以先将寄存器模型进行XML建模,再通过Synopsys 家的工具ralgen来直接生成regmo ...
- UVM中factory机制的使用
UVM中的factory机制一般用在sequence的重载,尤其是virtual sequence.当Test_case变化时,通过virtual sequence的重载,可以很容易构建新的测试. 因 ...
- UVM中的factory机制实现
首先在Systemverilog中便有对于重载的最基本的支持. 1)定义task/function时,使用virtual关键字.那之后在test_case中调用时,便使用句柄指向的对象的类型而不是句柄 ...
随机推荐
- 8、泛型程序设计与c++标准模板库2.5容器适配器
容器适配器是用来扩展7中基本容器的,是修改和调整其他类接口的类.他们不提供存放数据的实际数据结构的实现方法,而且容器适配器也不支持迭代器. 1.标准栈容器 使用STL中的标准栈为程序员提供了一层附加的 ...
- es6基础系列四--字符串的拓展
1 for...of 字符串的遍历接口 for(let i of "abc"){ console.log(i); } // a // b // c 2 includes 是否包含某 ...
- Java异常处理的10个最佳实践
本文作者: ImportNew - 挖坑的张师傅 未经许可,禁止转载! 异常处理在编写健壮的 Java 应用中扮演着非常重要的角色.异常处理并不是功能性需求,它需要优雅地处理任何错误情况,比如资源不可 ...
- 学习笔记:首次进行JUnit+Ant构建自动的单元测试(二)
关键字:JUnit,Ant,单元测试 终于把JUnit+Ant构建单元测试的大概了解了,其实我实践的过程是对了,只是指导博客(看到这里不懂请看我上一篇博客)本身的错误“成功”把我带入“坑”,有时候网友 ...
- 2018杭电多校第六场1009(DFS,思维)
#include<bits/stdc++.h>using namespace std;int a[100010];char s[20];int zhiren[100010];vector& ...
- Java基础--常用API--集合类相关API
一.泛型 1.泛型的本质是将类型参数化,即将数据类型作为参数. 2.泛型可以在编译期进行检查,其所有的强制转换是隐式且自动的,提高了代码的安全性. 3.泛型可以用在类(泛型类).接口(泛型接口).方法 ...
- 【外部节点】json判断@表示正在处理的当前数组项或对象。过滤器还可用于$引用当前对象之外的属性
$.store.book[?(@.price < $.expensive)] { "category" : "reference", "auth ...
- Jmeter 添加CSV Data set config 文件的相对路径及编码在Windows和Linux下的兼容性(转)
简介: Jmeter实际上是不需要安装的,只需要有ApacheJMeter.jar.启动批处理文件(jmeter.bat或jmeter).配置文件(jmeter.properties.user.pro ...
- 查询时根据权限更改sql
import java.lang.reflect.Method; import org.apache.log4j.Logger; import org.springframework.aop.Meth ...
- IE8浏览器总是无响应或卡死崩溃怎么办
IE8浏览器总是无响应或卡死崩溃怎么办 2016-05-11 11:22:31 来源:百度经验 作者:qq675495787 编辑:Jimmy51 我要投稿 IE在打开某些网页的时候经常崩溃或无响应, ...