跳转至

输入查询内容

    本页内容

    uvm_config_db#(T)::set 改进非空 context 下 /regex/ 拼接,优先级来源改为 coreservice

    影响范围

    普通 set/get 与 glob 配置不需要批量改写;自定义 coreservice、正则作用域和按 type 查询需另查条件。

    具体差异

    ① 1.2 已支持根 context 下的 /regex/;2.0 新增的是非空 context 全名与斜杠正则的正确分组拼接(uvm_config_db_implementation.svh:298-308)。② build 期优先级改从 coreservice 获取,默认实现仍读旧静态字段(M05-004)。③ 1.2 首次 set 走 r.set_override()(name+type 双置顶,uvm_config_db.svh:214-218),2.0 用 set_scope + set_priority_name(PRI_HIGH)uvm_config_db_implementation.svh:319,334);绕过 config_db 按 type 查询时需核对队列顺序。④ wait_modified 的匹配入口改为 uvm_is_match,标准 glob 用法保留。

    修改方案

    常规 uvm_config_db#(T)::set(cntxt, "env.*", ...) 用法无需改动;uvm_resource_base::default_precedence 在默认 coreservice 下仍有效,新代码推荐 uvm_resource_pool::set_default_precedence()

    兼容措施与范围:常规 config_db 调用可保留,无需兼容开关;非空 context 的正则拼接及资源查询顺序仍按目标行为核对。

    迁移后验证

    在非空 context 下分别设置 /regex/ 和 glob 作用域,核对命中/不命中实例的读回值;绕过 config_db 的按 type 查询单独检查选中资源与优先级。

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

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

    • S42 · 启发式:config_db 非空 context 的正则作用域。 支持位置、命名及混合实参,定位非 null 或待确认 context 加字面 /regex/ 的 config_db::set;普通 glob 和显式 null context 不报此项。变量字符串与自定义实现仍需核对。
    uv run tools/uvm_migration_scan.py <SoC代码目录> --rules S42
    

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2uvm_config_db.svh:152(set)

    VCS 内置 uvm-ieee-2020-2.0uvm_config_db.svh:111(set,委托)→ uvm_config_db_implementation.svh:267(默认实现)

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

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

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

    src/vcs-uvm-1.2/base/uvm_config_db.svh
      //| set_config_string(...) => uvm_config_db#(string)::set(cntxt,...)
      //| set_config_object(...) => uvm_config_db#(uvm_object)::set(cntxt,...)
    
      static function void set(uvm_component cntxt,
                               string inst_name,
                               string field_name,
                               T value);
    
        uvm_root top;
        uvm_phase curr_phase;
        uvm_resource#(T) r;
        bit exists;
        string lookup;
        uvm_pool#(string,uvm_resource#(T)) pool;
        string rstate;
        uvm_coreservice_t cs = uvm_coreservice_t::get();
    
        //take care of random stability during allocation
        process p = process::self();
    

    完整源码 · SHA256:8c3f79dad00da1cb7514f4c77072e39de74ae23cbb9ead18a83de04bcd0c8070

    src/vcs-uvm-ieee-2020-2.0/base/uvm_config_db.svh
      //| set_config_object(...) => uvm_config_db#(uvm_object)::set(cntxt,...)
    
      // @uvm-ieee 1800.2-2020 auto C.4.2.2.1
      static function void set(uvm_component cntxt,
                               string inst_name,
                               string field_name,
                               T value);
    
        uvm_pool#(string,uvm_resource#(T)) pool;
        uvm_config_db_implementation_t #(T) imp; 
        uvm_coreservice_t cs ;
        imp = uvm_config_db_implementation_t #(T)::get_imp();
        cs = uvm_coreservice_t::get();
    
        if(cntxt == null) 
          cntxt = cs.get_root();
    
        if(!m_rsc.exists(cntxt)) begin
          m_rsc[cntxt] = new;
    

    完整源码 · SHA256:9f42e23db0ecf274613f6e48991e7f7cbee5b36234390b16b49551e5efdff313

    src/vcs-uvm-ieee-2020-2.0/base/uvm_config_db_implementation.svh
      // Provides an implementation of set, including support for  
      // config_db tracing
      // @uvm-accellera
      virtual function void set(string                              cntxt_name,
                                      string                              inst_name,
                                      string                              field_name,
                                      T                                   value,
                                      int                                 cntxt_depth,
                                      uvm_pool#(string, uvm_resource#(T)) pool,
                                      uvm_component                       cntxt);
    
        uvm_root top;
        uvm_phase curr_phase;
        uvm_resource#(T) r;
        string lookup;
        string rstate;
        uvm_coreservice_t cs = uvm_coreservice_t::get();
        uvm_resource_pool rp = cs.get_resource_pool();
        int unsigned precedence;
    

    完整源码 · SHA256:3b8fc1506c85209e497bdaf2d8dbc8c25a88dac65075c4894207091ce4ca21f0

    术语解释 · 兼容配置

    resource precedence 的设置时机与保留写法(M05-004)

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

    版本适用范围