跳转至

输入查询内容

    本页内容

    组件配置与 transaction database 改用访问器

    影响范围

    使用 m_get_tr_database、print_config_matches 或旧 component 配置接口。

    具体差异

    一批小口径调整。最需注意的是 get/set_config_* 的废弃告警消失(回归日志 diff 会变化)以及 lookup() 非法模式告警。

    修改方案

    将 obj.m_get_tr_database() 改为 obj.get_tr_database();派生类的 virtual function uvm_tr_database m_get_tr_database() 同步改名,方法体保留原数据库选择逻辑。通过 set_tr_database(db) 配置时检查读回对象身份。主库仍保留组件 set/get_config_*,无需因其不再报 deprecated warning 而重写调用;print_config_matches 可继续使用,或改用 get/set_print_config_matches。

    兼容措施与范围:主库保留组件 set/get_config_* 和 print_config_matches,无需开关;旧 m_get_tr_database 名称未保留,调用和 override 仍须改为 get_tr_database。

    迁移后验证

    编译访问器改写并读回设置;记录事务后检查数据库对象身份,配置匹配和 tracing 输出按实际需要验证。

    记录本条结果M01-015 · 状态与证据

    补充查阅

    扫描定位与记录结果

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

    uv run tools/uvm_migration_scan.py <SoC代码目录> --rules C17
    

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

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

    源码与标准依据

    核查方式:源码核对。未单独进行 VCS 行为实测。

    VCS 内置 UVM-1.2uvm_component.svh:1631(公开 virtual 内部接口 m_get_tr_database())、uvm_component.svh:1024static bit print_config_matches)、uvm_component.svh:3388 等(get/set_config_* 首用报 UVM/CFG/SET|GET/DPR 废弃 warning)、uvm_component.svh:3750(print_config_settings 报废弃 warning)

    VCS 内置 uvm-ieee-2020-2.0uvm_component.svh:1600/uvm_component.svh:1603(公开 get_tr_database() + 新增 set_tr_database(db))、uvm_component.svh:965get/set_print_config_matches(),原变量保留标 @uvm-compat for compatibility with 1800.2-2017)、uvm_component.svh:2655 起(set_config_ 实现保留但不再报废弃 warning*)、uvm_component.svh:936(print_config_settings 保留不再告警)、uvm_component.svh:1672–1688/uvm_component.svh:3652–3671(新增 get/set_recording_enabledset_recording_enabled_hier,底层仍是 recording_detail != UVM_NONE)、uvm_component.svh:2111lookup() 对含 ../*/? 的名字新增 warning 并返回 null)

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

    src/vcs-uvm-1.2/base/uvm_component.svh
      // Setting this static variable causes uvm_config_db::get() to print info about
      // matching configuration settings as they are being applied.
    
      static bit print_config_matches;
    
    
      //----------------------------------------------------------------------------
      // Group: Objection Interface
      //----------------------------------------------------------------------------
      //
      // These methods provide object level hooks into the <uvm_objection> 
      // mechanism.
      // 
      //----------------------------------------------------------------------------
    
    
      // Function: raised
      //
      // The ~raised~ callback is called when this or a descendant of this component
    

    src/vcs-uvm-1.2/base/uvm_component.svh
      // and other methods in the <Recording Interface>.  
      // Default is <uvm_coreservice_t::get_default_tr_database>.
      uvm_tr_database tr_database;
      extern virtual function uvm_tr_database m_get_tr_database();
    
      //----------------------------------------------------------------------------
      //                     PRIVATE or PSUEDO-PRIVATE members
      //                      *** Do not call directly ***
      //         Implementation and even existence are subject to change. 
      //----------------------------------------------------------------------------
      // Most local methods are prefixed with m_, indicating they are not
      // user-level methods. SystemVerilog does not support friend classes,
      // which forces some otherwise internal methods to be exposed (i.e. not
      // be protected via 'local' keyword). These methods are also prefixed
      // with m_ to indicate they are not intended for public use.
      //
      // Internal methods will not be documented, although their implementa-
      // tions are freely available via the open-source license.
      //----------------------------------------------------------------------------
    

    src/vcs-uvm-1.2/base/uvm_component.svh
                                               uvm_bitstream_t value);
    
      if (!m_config_deprecated_warned) begin
         `uvm_warning("UVM/CFG/SET/DPR", "get/set_config_* API has been deprecated. Use uvm_config_db instead.")
         m_config_deprecated_warned = 1;
      end
      uvm_config_int::set(this, inst_name, field_name, value);
    endfunction
    
    //
    // set_config_string
    //
    function void uvm_component::set_config_string(string inst_name,
                                                   string field_name,
                                                   string value);
    
      if (!m_config_deprecated_warned) begin
         `uvm_warning("UVM/CFG/SET/DPR", "get/set_config_* API has been deprecated. Use uvm_config_db instead.")
         m_config_deprecated_warned = 1;
    

    src/vcs-uvm-1.2/base/uvm_component.svh
                                                        bit recurse=0);
      static bit have_been_warned;
      if(!have_been_warned) begin
        uvm_report_warning("deprecated", "uvm_component::print_config_settings has been deprecated.  Use print_config() instead");
        have_been_warned = 1;
      end
    
      print_config(recurse, 1);
    endfunction
    
    
    // print_config_with_audit
    // -----------------------
    
    function void uvm_component::print_config_with_audit(bit recurse = 0);
      print_config(recurse, 1);
    endfunction
    

    完整源码 · SHA256:a64354e981dcf241513831f16466d6bea6dea05c561ffe3a3ae02dd7bcce99fc

    src/vcs-uvm-ieee-2020-2.0/base/uvm_component.svh
      extern function void print_config(bit recurse = 0, bit audit = 0);
    
      //@uvm-compat provided for compatibility with 1.1d
      extern function void print_config_settings(string field="",
                                                 uvm_component comp=null,
                                                 bit recurse=0);
    
    
      // Function -- NODOCS -- print_config_with_audit
      //
      // Operates the same as print_config except that the audit bit is
      // forced to 1.  This interface makes user code a bit more readable as
      // it avoids multiple arbitrary bit settings in the argument list.
      //
      // If ~recurse~ is set, then configuration information for all
      // children and below are printed as well.
    
      extern function void print_config_with_audit(bit recurse = 0);
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_component.svh
      // 0 which may be overwritten by set_print_config_matches()
      //
      // @uvm-accellera The details of this API are specific to the Accellera implementation, and are not being considered for contribution to 1800.2
      static function bit get_print_config_matches() ;
         return print_config_matches;
      endfunction
    
      // Function: set_print_config_matches
      //
      // static function void set_print_config_matches(bit val)
      //
      // Sets the value of the internal static variable print_config_matches to val
      // (see get_print_config_matches)
      //
      // @uvm-accellera The details of this API are specific to the Accellera implementation, and are not being considered for contribution to 1800.2
       static function void set_print_config_matches(bit val) ;
         print_config_matches = val;
      endfunction
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_component.svh
      uvm_tr_database tr_database;
    
      // @uvm-ieee 1800.2-2020 auto 13.1.7.12
      extern virtual function uvm_tr_database get_tr_database();
    
      // @uvm-ieee 1800.2-2020 auto 13.1.7.11
      extern virtual function void set_tr_database(uvm_tr_database db);
    
    
      //----------------------------------------------------------------------------
      //                     PRIVATE or PSUEDO-PRIVATE members
      //                      *** Do not call directly ***
      //         Implementation and even existence are subject to change. 
      //----------------------------------------------------------------------------
      // Most local methods are prefixed with m_, indicating they are not
      // user-level methods. SystemVerilog does not support friend classes,
      // which forces some otherwise internal methods to be exposed (i.e. not
      // be protected via 'local' keyword). These methods are also prefixed
      // with m_ to indicate they are not intended for public use.
      //
      // Internal methods will not be documented, although their implementa-
      // tions are freely available via the open-source license.
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_component.svh
      // @uvm-ieee 1800.2-2020 auto 13.1.6.14
      extern virtual function bit get_recording_enabled();
    
      // Function: set_recording_enabled 
      //
      // | function void set_recording_enabled(bit enabled)
      //
      // In addition to the functionality described in IEEE 1800.2, this
      // library implements a call to set_recording_enabled in build_phase
      // when a config_db access of the form 
      // uvm_config_db #(uvm_bitstream_t)::get(this, "", "recording_detail", x)
      // or 
      // uvm_config_db #(int)::get(this, "", "recording_detail", x)
      // returns a non-zero value for x
    
      // @uvm-ieee 1800.2-2020 auto 13.1.6.13
      extern virtual function void set_recording_enabled(bit enabled);
    
      // @uvm-ieee 1800.2-2020 auto D.2.3
      extern virtual function void set_recording_enabled_hier (bit enabled);
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_component.svh
      for(int i = 0; i < name_length; i++) begin
          if((name.substr(i, (i+1)) == "..") || (name[i] == "*") || (name[i] == "?")) begin
          `uvm_warning("Lookup String Error", $sformatf("Malformed look up string: %s", name))
          return null;
        end
      end    
    
      m_extract_name(name, leaf, remainder);
    
      if (leaf == "") begin
        comp = top; // absolute lookup
        m_extract_name(remainder, leaf, remainder);
      end
    
      if (!comp.has_child(leaf)) begin
        `uvm_warning("Lookup Error", 
           $sformatf("Cannot find child %0s",leaf))
        return null;
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_component.svh
       bit clone;
    endclass : uvm_config_object_wrapper
    
    function void uvm_component::set_config_int(string inst_name,
                                               string field_name,
                                               uvm_bitstream_t value);
    
      uvm_config_int::set(this, inst_name, field_name, value);
    endfunction
    
    //
    // set_config_string
    //
    function void uvm_component::set_config_string(string inst_name,
                                                   string field_name,
                                                   string value);
    
      uvm_config_string::set(this, inst_name, field_name, value);
    endfunction
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_component.svh
    endfunction
    
    function bit uvm_component::get_recording_enabled();
       return (uvm_verbosity'(recording_detail) != UVM_NONE);
    endfunction
    
    function void uvm_component::print_config_settings (string field="",
                                                        uvm_component comp=null,
                                                        bit recurse=0);
      print_config(recurse, 1);
    endfunction
    
    function void uvm_component::set_recording_enabled(bit enabled);
       if (get_recording_enabled() != enabled) begin
          recording_detail = enabled ? UVM_LOW : UVM_NONE;
       end
       // else don't change another recording_detail value that maps to enabled
    endfunction
    
    function void uvm_component::set_recording_enabled_hier(bit enabled);
      set_recording_enabled(enabled);
      foreach( m_children[c] )
        m_children[c].set_recording_enabled_hier(enabled);
    

    完整源码 · SHA256:a35015c7b14dbf63f2e47a4d202e49555159bb91c263255a1421e3cfdf9e63f2

    术语解释 · 兼容配置

    返回Object / Factory · 迁移清单

    版本适用范围