跳转至

输入查询内容

    本页内容

    资源构造 scope 仍有效;对象 set() 删除后改由 pool 入池

    影响范围

    普通 uvm_resource#(T) 构造后依赖 scope、入池状态或 get_scope 字符串的代码;便利特化类构造入池另见 M05-011

    具体差异

    两版都需要入池才能由数据库查询。2.0 构造函数仍保存并转换显式 scope,match_scope() 在入池前也有效;不能解释为构造参数失效。删除的是资源对象的 set(),主库保留的 rp.set(rsrc) 会委托新入池接口,亦可显式调用 rp.set_scope(rsrc, scope)。两版 DPI 都支持 glob/regex/;2.0 改用 uvm_is_match,并允许资源池保存原始 scope。get_scope() 形式取决于构造转换或显式入池路径,不再保证返回旧版无斜杠的正则串,不宜解析该内部表现形式。

    修改方案

    显式 new(name, "scope") 可保留;将资源对象的 rsrc.set() 改为 rp.set_scope(rsrc, "scope"),或使用主库保留的 rp.set(rsrc)。普通资源两版都必须入池才能由数据库查询;无需仅为迁移删除构造 scope。连续示例见 M05-001,未直接操作 scope 的普通 config_db 用户无需为本条改写。

    兼容措施与范围:主库保留 set_scope/get_scope/match_scope 和 pool.set 兼容成员;仅在构造函数中传 scope 不会自动入池,仍须完成显式注册。 相关实现:uvm_resource_base.svh:521-537uvm_resource_pool.svh:195

    迁移后验证

    构造带显式 scope 的资源,分别在入池前后检查 match_scope 和查询;不要解析 get_scope 的内部正则格式。

    记录本条结果M05-002 · 状态与证据

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

    • C7 · 启发式:uvm_resource#(T) 自管理接口删除(set/set_override/get_by_name/get_by_type/UVM_RESOURCE_GET_FCNS)。 覆盖静态查询、UVM_RESOURCE_GET_FCNS,以及调用处可见 resource 句柄的 set/set_override;支持标准包限定、嵌套特化、类成员后声明和可解析的 for 作用域,typedef、复杂层级路径与跨文件类型仍需核对。
    uv run tools/uvm_migration_scan.py <SoC代码目录> --rules C7
    

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2uvm_resource.svh:231uvm_resource_base::new(string name="", string s="*"),构造即 uvm_glob_to_re 转换并存入 scope)、uvm_resource.svh:1423uvm_resource#(T)::new(string name="", scope="")

    VCS 内置 uvm-ieee-2020-2.0uvm_resource_base.svh:348new(string name="", string s="<not provided>"),注释明示"string argument added for compatibility")、uvm_resource.svh:68uvm_resource#(T)::new(string name="", string scope="<not provided>")

    标准依据:IEEE 1800.2-2020 §C.2.3.2.1、§C.2.4.3.1

    标为“源码标注”或未注明原文核对的条款仅作定位;具体库行为以源码和实测为准。

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

    src/vcs-uvm-1.2/base/uvm_resource.svh
      // arguments, the name of the resource and a regular expression which
      // represents the set of scopes over which this resource is visible.
    
      function new(string name = "", string s = "*");
        super.new(name);
        set_scope(s);
        modified = 0;
        read_only = 0;
        precedence = default_precedence;
      endfunction
    
      // Function: get_type_handle
      //
      // Pure virtual function that returns the type handle of the resource
      // container.
    
      pure virtual function uvm_resource_base get_type_handle();
    

    src/vcs-uvm-1.2/base/uvm_resource.svh
    `endif
    
      function new(string name="", scope="");
        super.new(name, scope);
    
    `ifndef UVM_NO_DEPRECATED
    begin
        for(int i=0;i<name.len();i++) begin
            if(name.getc(i) inside {".","/","[","*","{"}) begin
                `uvm_warning("UVM/RSRC/NOREGEX", $sformatf("a resource with meta characters in the field name has been created \"%s\"",name))
                break;
            end 
        end 
    end
    
    `endif    
      endfunction
    

    完整源码 · SHA256:6dd457f7586da01b713fb94bdb5472e7fdb3e741219398f87f341c21f5a0f8af

    src/vcs-uvm-ieee-2020-2.0/base/uvm_resource_base.svh
      static int unsigned default_precedence = 1000;
    
      // @uvm-ieee 1800.2-2020 auto C.2.3.2.1
      function new(string name = "",string s = "<not provided>"); //string argument added for compatibility
        super.new(name);
        modified = 0;
        read_only = 0;
        // begin lines provided for compatibility with 1.2
        if (s == "<not provided>") scope = s; //don't call glob_to_re unless legacy usage
        else scope = uvm_glob_to_re(s) ; 
        precedence = default_precedence ;
        // end lines provided for compatibility with 1.2
      endfunction
    
      // Function -- NODOCS -- get_type_handle
      //
      // Pure virtual function that returns the type handle of the resource
      // container.
    

    完整源码 · SHA256:1c28e6cc95c0ae5c636a1a6c81b65d5d9feab621c22d71b932791147f1c69e85

    src/vcs-uvm-ieee-2020-2.0/base/uvm_resource.svh
      // @uvm-ieee 1800.2-2020 auto C.2.5.2
      function new(string name="", string scope="<not provided>"); //scope argument added for compatibility
        super.new(name,scope);
      endfunction
    
      virtual function string m_value_type_name();
        return `uvm_typename(T);
      endfunction : m_value_type_name
    
      virtual function string m_value_as_string();
        return $sformatf("%p", val);
      endfunction : m_value_as_string
    
      //----------------------
      // Group -- NODOCS -- Type Interface
      //----------------------
      //
    

    完整源码 · SHA256:7ea343e2caccbe066149268c978931c0190db327ec6940dffc17dfff00d5fc90

    术语解释 · 兼容配置

    uvm_resource#(T) 自管理接口 set() / set_override() / get_by_name() / get_by_type() 被删除(M05-001) · 资源特化类删除返回子类型的静态 get_by_name/get_by_type(M05-011)

    返回Config DB / Resource DB · 迁移清单

    版本适用范围