跳转至

输入查询内容

    本页内容

    旧全局配置、timeout 和 stop 函数需要改写

    影响范围

    调用已删的全局配置、timeout、test_done 或 stop 函数。

    具体差异

    1.2 中已标记 DEPRECATED 的全局仿真控制/配置函数在 2.0 彻底移除,引用即编译错误。set_global_timeoutuvm_root::get().set_timeout()(或 uvm_top.set_timeout);uvm_test_done/stop 机制改为明确完成条件与 objection;全局 set_config_* 可转调 root 的同名组件方法,或按下面的类型、scope 与克隆契约迁移到 uvm_config_db

    修改方案

    全局配置调用优先改为 uvm_root::get().set_config_int/object/string(...),保留原实参与 object 的 clone 标志;这些组件方法在目标主库仍存在(M01-015),不需要 deprecated 开关。统一改用 config_db 时,必须同步类型、作用域和克隆契约,详见下面的映射。timeout 改 uvm_root::get().set_timeout(...);stop 的收尾超时按 M03-002 单独设计。

    只迁移已删除的全局入口时,可保留组件配置方法的语义:

    1
    2
    3
    4
    5
    6
    7
    // Before: global functions in UVM 1.2.
    uvm_pkg::set_config_int("uvm_test_top.env.*", "limit", 64'h1234567801234567);
    uvm_pkg::set_config_object("uvm_test_top.env.*", "cfg", cfg, 1);
    
    // After: methods retained by the target library.
    uvm_root::get().set_config_int("uvm_test_top.env.*", "limit", 64'h1234567801234567);
    uvm_root::get().set_config_object("uvm_test_top.env.*", "cfg", cfg, 1);
    

    全局函数旧实现转调 root 的组件方法;目标保留相同配置入口。对象 setter 默认 clone=1,而 config_db::set 不自动克隆。

    需要进一步统一到 config_db 时,按下表同步所有读写方:

    旧全局接口 config_db 的类型参数 T
    set_config_int uvm_bitstream_t
    set_config_string string
    set_config_object uvm_object

    对应调用形式为:

    uvm_config_db#(T)::set(null, inst_name, field_name, value);
    

    null context 保留从 root 开始的完整路径。整数配置原本使用 uvm_bitstream_t;直接换 #(int) 既可能截断,也无法被旧类型 getter 找到。对象配置若改为具体类型,所有读写方必须同步使用同一类型参数。

    对象还需明确共享句柄还是克隆。旧 setter 和 get_config_object 的 clone 参数、自动配置路径中的消费者克隆都要核对,不能只在 set 前 clone 一次就认定等价。

    新增 guidance_probe 对跑确认:旧全局入口与目标 root 方法均保留 64 位值、写入克隆和消费者克隆;错误的 #(int) 查询返回未命中,直接 config_db 对象 set/get 共享原句柄。已有 component 的 set/get_config_* 无需因全局函数删除而批量改写。

    兼容措施与范围:已删除的全局入口不恢复;主库组件 set_config_* 方法仍可承接配置,类型、scope 与克隆意图须保留。

    迁移后验证

    编译每种替代调用;配置检查 scope、set/get 的同一类型参数、完整宽值及对象身份,写入后修改原对象以验证克隆隔离。超时用受控测试验证,结束控制使用 M03-003 的完成标志验收。

    记录本条结果M04-004 · 状态与证据

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

    • C10a · 文本匹配:全局仿真控制函数删除(uvm_test_done/global_stop_request/set_global_timeout/set_global_stop_timeout)。

    • C10c · 启发式:全局 set_config_int/object/string 删除(注意:组件方法仍可用)。

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

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2uvm_globals.svh:63uvm_test_done)、uvm_globals.svh:71global_stop_request)、uvm_globals.svh:85set_global_timeout)、uvm_globals.svh:99set_global_stop_timeout)、uvm_globals.svh:341uvm_globals.svh:364uvm_globals.svh:388(全局 set_config_int/object/string,均位于 `ifndef UVM_NO_DEPRECATED 内)

    VCS 内置 uvm-ieee-2020-2.0:全部删除(src/vcs-uvm-ieee-2020-2.0/base/uvm_globals.svh 中无对应符号)

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

    src/vcs-uvm-1.2/base/uvm_globals.svh
    // raised objections, an implicit call to <global_stop_request> is issued
    // to end the run phase (or any other task-based phase).
    
    const uvm_test_done_objection uvm_test_done = uvm_test_done_objection::get();
    
    
    // Method- global_stop_request  - DEPRECATED
    //
    // Convenience function for uvm_test_done.stop_request(). See 
    // <uvm_test_done_objection::stop_request> for more information.
    
    function void global_stop_request();
      uvm_test_done_objection tdo;
      tdo = uvm_test_done_objection::get();
      tdo.stop_request();
    endfunction
    
    
    // Method- set_global_timeout  - DEPRECATED
    //
    // Convenience function for uvm_top.set_timeout(). See 
    // <uvm_root::set_timeout> for more information.  The overridable bit 
    // controls whether subsequent settings will be honored.
    
    
    function void set_global_timeout(time timeout, bit overridable = 1);
      uvm_root top;
      uvm_coreservice_t cs;
      cs = uvm_coreservice_t::get();
      top = cs.get_root();
      top.set_timeout(timeout,overridable);
    endfunction
    
    
    // Function- set_global_stop_timeout - DEPRECATED
    //
    // Convenience function for uvm_test_done.stop_timeout = timeout.
    // See <uvm_uvm_test_done::stop_timeout> for more information.
    
    function void set_global_stop_timeout(time timeout);
      uvm_test_done_objection tdo;
      tdo = uvm_test_done_objection::get();
      tdo.stop_timeout = timeout;
    endfunction
    `endif
    
    `ifdef  UVM_DISABLE_ERROR_MSG_POST_QUIT_COUNT
    
    static bit set_error = 0;
    
    //Set 1 when UVM quit count is reached.
    function void  set_error_max_count_reached(int error);
      set_error = error;
    endfunction
    

    src/vcs-uvm-1.2/base/uvm_globals.svh
    // component-level setting.  See <uvm_component::set_config_int> for
    // details on setting configuration.
    
    function void  set_config_int  (string inst_name,
                                    string field_name,
                                    uvm_bitstream_t value);
      uvm_root top;
      uvm_coreservice_t cs;
      if (!uvm_component::m_config_deprecated_warned) begin
         `uvm_warning("UVM/CFG/SET/DPR", "get/set_config_* API has been deprecated. Use uvm_config_db instead.")
         uvm_component::m_config_deprecated_warned = 1;
      end
      cs = uvm_coreservice_t::get();
      top = cs.get_root();
      top.set_config_int(inst_name, field_name, value);
    endfunction
    
    
    // Function- set_config_object
    

    src/vcs-uvm-1.2/base/uvm_globals.svh
    // component-level setting.  See <uvm_component::set_config_object> for
    // details on setting configuration.
    
    function void set_config_object (string inst_name,
                                     string field_name,
                                     uvm_object value,
                                     bit clone=1);
      uvm_root top;
      uvm_coreservice_t cs;
      if (!uvm_component::m_config_deprecated_warned) begin
         `uvm_warning("UVM/CFG/SET/DPR", "get/set_config_* API has been deprecated. Use uvm_config_db instead.")
         uvm_component::m_config_deprecated_warned = 1;
      end
      cs = uvm_coreservice_t::get();
      top = cs.get_root();
      top.set_config_object(inst_name, field_name, value, clone);
    endfunction
    

    src/vcs-uvm-1.2/base/uvm_globals.svh
    // component-level setting.  See <uvm_component::set_config_string> for
    // details on setting configuration.
    
    function void set_config_string (string inst_name,  
                                     string field_name,
                                     string value);
      uvm_root top;
      uvm_coreservice_t cs;
      if (!uvm_component::m_config_deprecated_warned) begin
         `uvm_warning("UVM/CFG/SET/DPR", "get/set_config_* API has been deprecated. Use uvm_config_db instead.")
         uvm_component::m_config_deprecated_warned = 1;
      end
      cs = uvm_coreservice_t::get();
      top = cs.get_root();
      top.set_config_string(inst_name, field_name, value);
    endfunction
    `endif
    

    完整源码 · SHA256:1223cc2b6daf5c3b7a134c0abaef0008c08223aa15f61b08c9b7a8142480a564

    术语解释 · 兼容配置

    组件配置与 transaction database 改用访问器(M01-015) · stop 机制整体删除(M03-002) · 旧 test_done 不再保持 run 存活(M03-003)

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

    版本适用范围