后面的例子我会继续补充:

1. 因为uvm默认定义的message格式比较长,非常不利于debug过程中的分析使用,一般情况下,开始使用uvm,都要利用uvm_report_server重新定义message输出的格式。下面给出一个例子:用于将name和ID限定在同一个width。


class my_report_server extends uvm_report_server;
  int name_width = 20;
  int id_width   = 20;
 
  function string pad(string s, int width);
    if ( s.len() == width )
      return s;
 
    // s is short. Pad at the end.
    if ( s.len() < width )
      return {s, {(width - s.len()){" "}}};
    else                  
        // s is too long. truncate.
      return s.substr(s.len()-width, s.len()-1);
  endfunction
 
  function string compose_message(
    uvm_severity severity,
    string name,
    string id,
    string message,
    string filename,
    int    line
  );
  // Make the width be exactly name_width
  // and id_width.
 
name = pad(name, name_width);
    id   = pad(id,     id_width);
 
    return super.compose_message(
     severity, name, id, message, filename, line);
    endfunction
  endclass

前面文章中讲过,uvm_report_server类在整个环境中是一个单态类,所以在uvm_test层用set_server将继承的类替换原来的uvm_report_server类就可以了
class test extends uvm_test;
 
  // Make my report server.
  begin
    my_report_server my_report_server_inst;
    my_report_server_inst = new();
 
    // Configure.
    my_report_server_inst.name_width = 28;
    my_report_server_inst.id_width   = 20;
 
    // Set.
    uvm_report_server::set_server(
      my_report_server_inst);
  end


2. 使用catcher对一些message执行CATCH或者THROW的操作:
class my_report_catcher
  extends uvm_report_catcher;
 
  string            id;
  string            filename;
  string            name;
  string            message;
  int               line;
  int               verbosity;
  uvm_severity      severity;
  uvm_report_object client;
 
function new(string name = "my_report_catcher");
    super.new(name);
  endfunction
 
  function action_e catch();
    uvm_severity_type usv;
 
    id              = get_id();
    filename        = get_fname();
    line            = get_line();
    severity        = get_severity();
    verbosity       = get_verbosity();
    message         = get_message();
 
    client          = get_client();
    name            = client.get_full_name();
 
    usv = uvm_severity_type'(severity);
 
    // Process this message.
    // Decide THROW or CATCH.
    ...
    return THROW;
  endfunction
endclass

class test extends uvm_test;
  ...
  my_report_catcher my_report_catcher_inst;
  my_report_catcher_inst =
    new("my_report_catcher_inst");
  uvm_report_cb::add(null,
    my_report_catcher_inst, UVM_APPEND);

3. 通过ID实现对message的精细控制,这部分内容在前面代码中有介绍,这里不展开在说的还有另一方面原因,我们在debug的时候通常希望log尽量的完全,因此不推荐使用ID去过滤message,也不推荐将log根据ID打印到不同的file当中,因为这两种做法,一种限制的log的完整性,有可能缺失我们需要的关键的信息,而另一种则是因为message的打印一般是按照时间顺序进行,将log打印到不同的file,将破坏这种前后时间关系,不利于进行debug。因此比较推荐的方式是,尽量将所有的message打印到一个文件,然后通过脚本,从这个文件中根据ID提取你需要debug信息。

这里面有个原则,是别人跟我说的,我觉得非常有道理:当你在debug一个问题的时候,trace的很长世间才找到问题发生的点(TB 或者DUT的原因),你要在这个问题发生点加上一行打印,帮助你以后去debug。这就是message的意义所在。

4. 由于使用在环境中使用的uvc越来越多,不可避免的就是log的数量将打印的非常多,如何使用uvm控制和管理log的输出,这也是一个比较值得研究的问题。

UVM基础之-------uvm report机制的使用的更多相关文章

  1. UVM基础之---------uvm report 机制分析

    uvm 中的信息报告机制相对来说比较简单,功能上来说主要分为两部分: 第一通过ID对component的信息报告冗余级别进行控制,针对每个冗余级别进行不同的行为控制.这部分工作主要由uvm_repor ...

  2. UVM基础之------uvm phases机制

    代码的书写顺序会影响代码的实现,在不同的时间做不同的事情,这是UVM phase的设计哲学,UVM phase提供了一个通用的TB phase 解决方案.支持显示的隐式的同步方案,运行时刻的线程控制和 ...

  3. UVM基础之-------uvm factory机制override<博>

    override功能是UVM中一个比较重要的功能,这个功能也是在factory里面实现的,我们会在env或者具体的case中使用override功能. class case_x extends bas ...

  4. UVM基础之---------uvm factory机制register

    factory机制的一大特点就是根据类的名字来创建类的实例. factory 机制中根据类名来创建类的实例所用到的技术:一是参数化的类,二是静态变量和静态函数.这两者是factory机制实现的根本所在 ...

  5. UVM基础之---------uvm factory机制base

    从名字上面就知道,uvm_factory用来制造uvm_objects和component.在一个仿真过程中,只有一个factory的例化存在. 用户定义的object和component types ...

  6. UVM基础之---Command-line Processor

    提供一个厂商独立的通用接口命令行参数,支持分类:   1. 基本参数和值:get_args,get_args_matches   2. 工具信息:get_tool_name(),get_tool_ve ...

  7. UVM基础之---------Reporting Classes

    Reporting 类提供了一组工具用于格式化报告输出 report机制大概包括四个主要的类uvm_report_object,uvm_report_handler, uvm_report_serve ...

  8. UVM基础总结——基于《UVM实战》示例

    一.前言 工作一直在做SoC验证,更关注模块间的连接性和匹配性,所以相比于擅长随机约束激励的UVM来说,定向测试的概念更容易debug.当然前提是IP已经被充分验证.因此觉得接触UVM的机会较少.到现 ...

  9. ZIGBEE report机制分析

    ZIGBEE提供了report机制(现在只学习了send, receive还没学习) 主要目的是实现attribute属性的report功能,即提供了一种服务端和客户端数据同步的机制 以EMBER的H ...

随机推荐

  1. 【Akka】Actor模型探索

    Akka是什么 Akka就是为了改变编写高容错性和强可扩展性的并发程序而生的.通过使用Actor模型我们提升了抽象级别,为构建正确的可扩展并发应用提供了一个更好的平台.在容错性方面我们採取了" ...

  2. 2013:Audio Tag Classification - MIREX Wiki

    Contents [hide] 1 Description 1.1 Task specific mailing list 2 Data 2.1 MajorMiner Tag Dataset 2.2 M ...

  3. Cannot change version of project facet Dynamic Web Module to 3.1 (Eclipse Maven唯一解决方式)

    If you want to use version 3.1 you need to use the following schema: http://xmlns.jcp.org/xml/ns/jav ...

  4. 第一个GraphX程序

    程序功能:收集顶点指向的邻居中所在地 /* * 找出每一个顶点所指向的邻居中所在的地区 */ import org.apache.spark.SparkContext import org.apach ...

  5. C#项目的生成事件及批处理文件

    一个C#项目,如果为同一个解决方案的其他项目所引用,则其编译后,会将DLL拷贝到引用项目中:但如果它并不被其他项目引用,但又想编译后能够自动将生成的东西拷贝过去,可以在项目的生成事件中,写上一些批处理 ...

  6. [Codeforces 1037E] Trip

    [题目链接] http://codeforces.com/problemset/problem/1037/E [算法] 首先离线 , 将问题倒过来考虑 , 转化为 : 每次删除一条边 , 此时最多有多 ...

  7. vue watcher

    观察 Watchers 虽然计算属性在大多数情况下更合适,但有时也需要一个自定义的 watcher .这是为什么 Vue 提供一个更通用的方法通过watch 选项,来响应数据的变化.当你想要在数据变化 ...

  8. window系统 查看端口 被哪个进程占用了

    一.在windows命令行窗口下执行:运行--cmdC:\>netstat -aon|findstr "8080" TCP     127.0.0.1:80       0. ...

  9. ubuntu/linuxmint如何添加和删除PPA源

    [添加] 1.sudo add-apt-repository ppa:user/ppa-name 2.sudo apt-get update (然后再安装软件sudo apt-get install ...

  10. UVaLive 6832 Bit String Reordering (模拟)

    题意:给定一个01序列,然后让你你最少的操作数把这它变成目标. 析:由于01必须是交替出现的,那么我们就算两次,然后取最值. 代码如下: #pragma comment(linker, "/ ...