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

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. 百万级 TCP 长连接即时通讯框架 t-io

    原文:http://www.t-io.org:9292/ https://www.oschina.net/p/t-io

  2. Installation error: INSTALL_FAILED_VERSION_DOWNGRADE Android

    我们在安装新的 APk 的时候.会出现 Installation error: INSTALL_FAILED_VERSION_DOWNGRADE 原因:  是由于 androidversionCode ...

  3. HTTP请求方式之GET和POST比较

    什么是HTTP协议 超文本传输协议(HyperText Transfer Protocol -- HTTP)是一个设计来使客户端和服务器顺利进行通讯的协议 HTTP在客户端和服务器之间以request ...

  4. Map-produce算法两个开源实现

    https://github.com/michaelfairley/mincemeatpy https://github.com/denghongcai/mincemeat-node

  5. 中文分词实践(基于R语言)

    背景:分析用户在世界杯期间讨论最多的话题. 思路:把用户关于世界杯的帖子拉下来.然后做中文分词+词频统计,最后将统计结果简单做个标签云.效果例如以下: 兴许:中文分词是中文信息处理的基础.分词之后.事 ...

  6. IOS-Storyboard控制器切换之TabBar(3)

    TabBar与Push相反,他以底部为导航 以头部为内容区域,如图: 打开storyboard文件,创建一个UITabBarController文件到画板中,默认带了2个 UIViewControll ...

  7. Codeforces Round #233 (Div. 2)D. Painting The Wall 概率DP

                                                                                   D. Painting The Wall ...

  8. uva 12265 贩卖土地

    题目大意: 有一个矩阵 有些点可以取有些不能 求以每个点为右下角的子矩阵(里面点都可以取)的周长最大值 最后统计出每个周长对应矩阵的个数 思路: 单调栈 先预处理出每个点向上最多能延伸多长记为h(i, ...

  9. luogu3605晋升者计数

    https://www.zybuluo.com/ysner/note/1282069 题面 给一颗带点权的树,求每个点的子树中比该点权值大的点的个数. \(n\leq10^5\) 解析 首先有个很无脑 ...

  10. HDU2138 素数判定

    HDU2138 给定N个32位大于等于2的正整数 输出其中素数的个数 用Miller Rabin 素数判定法 效率很高 数学证明比较复杂,略过, 会使用这个接口即可. #include<iost ...