跳转至

输入查询内容

    本页内容

    resource precedence 的设置时机与保留写法

    影响范围

    普通静态默认值没有强制改写要求;入池前设置实例 precedence 或自定义 coreservice 的代码需单独核对。

    具体差异

    2.0 将默认值访问委托给 coreservice,但默认 uvm_default_coreservice_t::set/get_resource_pool_default_precedence() 仍直接读写 uvm_resource_base::default_precedenceuvm_coreservice.svh:345-350)。旧静态字段赋值仍有效(S5 为兼容性提示)。实例 rsrc.precedence 也仍用于比较(uvm_resource_pool.svh:559-587),并由 set/get_precedence 直接读写。真正的边界是首次 set_scope() 入池时会以默认值覆写该实例字段(:264);需要特殊优先级时应在入池后设置。已有自定义 coreservice 的环境需核对其实现。

    修改方案

    旧字段写法无强制迁移;新代码推荐 uvm_resource_pool::set_default_precedence(...)uvm_coreservice_t::get().set_resource_pool_default_precedence(...),以及 rp.set_precedence(r, p) / rp.get_precedence(r)。后一组实例级操作在资源入池后执行。

    兼容措施与范围:默认 coreservice 下,主库保留的 default_precedence 静态字段仍有效;自定义 coreservice 的优先级来源和资源入池后的 precedence 仍需分别核对。

    迁移后验证

    创建竞争资源,入池后设置特殊 precedence 并读回;检查最终选中值,避免入池重置覆盖调用方的优先级。

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

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

    • S5 · 启发式:default_precedence 兼容字段核对(原静默失效结论已撤销)。

    • S15 · 启发式:resource 单侧 override 掩码与入池前 precedence 需核对。

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

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2uvm_resource.svh:214(precedence)、uvm_resource.svh:223(static default_precedence = 1000)

    VCS 内置 uvm-ieee-2020-2.0uvm_resource_base.svh:343–345(两者均标注 //@uvm-compat provided for compatibility with 1.2);真实默认优先级在 uvm_coreservice.svh:144–146uvm_coreservice.svh:345–349

    标准依据:IEEE 1800.2-2020 §C.2.4.5.4

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

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

    src/vcs-uvm-1.2/base/uvm_resource.svh
      // and name. Resources are set to the <default_precedence> initially,
      // and may be set to a higher or lower precedence as desired.
    
      int unsigned precedence;
    
      // variable: default_precedence
      //
      // The default precedence for an resource that has been created.
      // When two resources have the same precedence, the first resource
      // found has precedence.
      //
    
      static int unsigned default_precedence = 1000;
    
      // Function: new
      //
      // constructor for uvm_resource_base.  The constructor takes two
      // 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
    

    完整源码 · SHA256:6dd457f7586da01b713fb94bdb5472e7fdb3e741219398f87f341c21f5a0f8af

    src/vcs-uvm-ieee-2020-2.0/base/uvm_resource_base.svh
      protected string scope;
    
      //@uvm-compat provided for compatibility with 1.2
      int unsigned precedence;
      //@uvm-compat provided for compatibility with 1.2
      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
    

    完整源码 · SHA256:1c28e6cc95c0ae5c636a1a6c81b65d5d9feab621c22d71b932791147f1c69e85

    src/vcs-uvm-ieee-2020-2.0/base/uvm_coreservice.svh
        pure virtual function uvm_resource_pool get_resource_pool();
    
        // @uvm-ieee 1800.2-2020 auto F.4.1.4.23
        pure virtual function void set_resource_pool_default_precedence(int unsigned precedence);
    
        pure virtual function int unsigned get_resource_pool_default_precedence();
    
            // Function: get_phase_hopper
            //
            // Returns the <uvm_phase_hopper> (singleton) instance for this environment
            //
            // @uvm-contrib For potential contribution to 1800.2
            pure virtual function uvm_phase_hopper get_phase_hopper();
    
        local static uvm_coreservice_t inst;
    
        // @uvm-ieee 1800.2-2020 auto F.4.1.3
        static function uvm_coreservice_t get();
            if(inst==null)
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_coreservice.svh
            return m_rp;
        endfunction
    
        virtual function void set_resource_pool_default_precedence(int unsigned precedence);
            uvm_resource_base::default_precedence = precedence;
        endfunction
    
        virtual function int unsigned get_resource_pool_default_precedence();
            return uvm_resource_base::default_precedence;
        endfunction
    
            local uvm_phase_hopper m_hopper;
    
            virtual function uvm_phase_hopper get_phase_hopper();
              if (m_hopper == null) begin
                m_hopper = uvm_phase_hopper::type_id::create("default_hopper");
              end
              return m_hopper;
            endfunction // get_phase_hopper
    

    完整源码 · SHA256:f7cad9269dafa30402c6ffe86a99dc8c0fedf1e02e8faff9ec4e6f6e7b083202

    术语解释 · 兼容配置

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

    版本适用范围