跳转至

输入查询内容

    本页内容

    uvm_report_object 的 report handler 改为懒创建

    内部实现:文件组织、内部数据结构与实现钩子的变化。直接依赖内部接口时查阅,普通 API 的使用不需要重审这些源码。

    影响范围

    首次 reporting 调用前直接读写 m_rh。

    具体差异

    2.0 构造函数不再创建 m_rh,首次使用任一 reporting 方法时才创建。直接读写 m_rh 成员(非标但大环境中存在)在首次 API 调用前会拿到 null。

    修改方案

    直接引用 .m_rh 的代码改走 get_report_handler()

    兼容措施与范围:本条是新增能力或实现说明,无需恢复旧接口;按使用条件核对行为。

    迁移后验证

    通过 get_report_handler 获取句柄并断言非空;设置 severity/action 后发出消息,确认新 handler 配置生效。

    记录核销:在无规则及补充检查中记录实际依赖与证据。

    已有实测与复现

    补充查阅

    扫描定位与记录结果

    有扫描规则,覆盖部分可识别写法。脚本检查名称、参数和部分 FLAG 表达式,并对少数直接声明关联使用点;未做完整类型解析或预处理,行为结果仍需验证。

    • D17 · 启发式:直接依赖 UVM 内部表、执行入口或状态字段。
    uv run tools/uvm_migration_scan.py <SoC代码目录> --rules D17
    

    核对命中对象及生效分支后,在条目清单记录修改与验证证据;扫描规则记录用于整理命中位置。

    扫描器下载、输入范围与报告说明

    源码与标准依据

    核查方式:源码与实测核对。实测仅覆盖本条所列场景。

    VCS 内置 UVM-1.2uvm_report_object.svh:93(构造函数内创建 m_rh

    VCS 内置 uvm-ieee-2020-2.0uvm_report_object.svh:92m_rh_set)、uvm_report_object.svh:93m_rh_init)、uvm_report_object.svh:275 起各方法首行调用 m_rh_init()

    引用代码(高亮为引用行);上方行号链接可直接定位。

    src/vcs-uvm-1.2/base/uvm_report_object.svh
      function new(string name = "");
        super.new(name);
        m_rh = uvm_report_handler::type_id::create(name);
      endfunction
    
    
      //----------------------------------------------------------------------------
      // Group: Reporting
      //----------------------------------------------------------------------------
    
      // Function: uvm_get_report_object
      //
      // Returns the nearest uvm_report_object when called.  From inside a
      // uvm_component, the method simply returns ~this~.
      // 
      // See also the global version of <uvm_get_report_object>.
    
      function uvm_report_object uvm_get_report_object();
    

    完整源码 · SHA256:f1747ee064c286b2c0f18d6e71b096890360ed9cb71ce494c1e07d007ec35f6a

    src/vcs-uvm-ieee-2020-2.0/base/uvm_report_object.svh
      uvm_report_handler m_rh;
    
      local bit m_rh_set;
      local function void m_rh_init();
        if (!m_rh_set)
          set_report_handler(uvm_report_handler::type_id::create(get_name()));
      endfunction : m_rh_init
    
      // Function -- NODOCS -- new
      //
      // Creates a new report object with the given name. This method also creates
      // a new <uvm_report_handler> object to which most tasks are delegated.
    
      // @uvm-ieee 1800.2-2020 auto 6.3.2
      function new(string name = "");
        super.new(name);
      endfunction
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_report_object.svh
      // @uvm-ieee 1800.2-2020 auto 6.3.3.4
      virtual function void uvm_process_report_message(uvm_report_message report_message);
        m_rh_init();
        report_message.set_report_object(this);
        m_rh.process_report_message(report_message);
      endfunction
    
    
      //----------------------------------------------------------------------------
      // Group -- NODOCS -- Verbosity Configuration
      //----------------------------------------------------------------------------
    
    
      // Function -- NODOCS -- get_report_verbosity_level
      //
      // Gets the verbosity level in effect for this object. Reports issued
      // with verbosity greater than this will be filtered out. The severity
      // and tag arguments check if the verbosity level has been modified for
    

    完整源码 · SHA256:f0e97820abcfcc86b64800110f8059734479f0c1a259ad04414c9af6708d98fa

    术语解释 · 兼容配置

    返回Reporting / 命令行 · 迁移清单

    版本适用范围