跳转至

输入查询内容

    本页内容

    派生 TLM FIFO 的字段自动配置默认停止

    影响范围

    派生 uvm_tlm_fifo_base、uvm_tlm_fifo 或 uvm_tlm_analysis_fifo,并依赖注册字段的自动配置;无需覆盖 build_phase 也可能受影响。

    具体差异

    1.2 的 fifo_base override build_phase() 后仍调用继承的 build(),默认会执行字段自动配置;源码中的关闭意图注释不能代替实际调用链。VCS 1.2 另有全局禁用条件,见 M01-007。2.0 删除该 override,新增默认返回 0 的 use_automatic_config(),因此依赖自动配置的派生字段会保留初始值。两侧 fifo_base 均与各自 Accellera 参照一致;原版 1.2 的 build 也调用自动配置(src/uvm-1.2/src/base/uvm_component.svh:2319),原版 2.0 同样按钩子门控(src/1800.2-2020-2.0/src/base/uvm_component.svh:3450)。

    修改方案

    需要维持派生字段自动赋值时,在派生 FIFO 中 override virtual function bit use_automatic_config() 并返回 1;已有 build_phase 仍须保留业务逻辑和所需的 super 调用。未依赖派生字段自动配置的普通 FIFO 传输无需为本条改写。字段 FLAG 的使能方式另按 M09-002 核对。

    旧派生 FIFO 可只注册字段,并在父组件 build 时设置配置:

    1
    2
    3
    // 派生 FIFO 内注册:`uvm_field_int(configured_value, UVM_DEFAULT)
    // 父组件 build 中设置,fifo 是该派生实例的名字:
    uvm_config_db#(uvm_bitstream_t)::set(this, "fifo", "configured_value", 42);
    

    目标版若继续依赖自动赋值,在派生 FIFO 内增加:

    1
    2
    3
    virtual function bit use_automatic_config();
      return 1;
    endfunction
    

    兼容措施与范围deprecated / legacy field 开关和 compat 包不会自动改变 FIFO 的 use_automatic_config 返回值;恢复所需赋值须显式重写该主库钩子。返回 1 只重新启用自动配置调用,不保证配置类型、路径和字段 FLAG 已正确。

    迁移后验证

    设置已注册字段的非默认配置值,比较 build 后的实际值与 apply_config_settings 调用次数;恢复自动配置后重验字段赋值,并核对业务 FIFO 传输。

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

    已有实测与复现

    doc_fact_probe 的字段初始值为 0,父组件配置为 42。1.2 / 2.0 默认的自动配置调用次数为 1 / 0,build 后字段值为 42 / 0;目标派生类返回 1 后恢复为调用 1 次、字段值 42。该探针核对注册整数字段的配置,不代替任意对象配置、定制 build 链或并发 FIFO 传输验证。

    补充查阅

    扫描定位与记录结果

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

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

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

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

    源码与标准依据

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

    1. FIFO 自身的 build 路径改为自动配置钩子

    VCS 内置 UVM-1.2:fifo_base 的 build_phase 仍调用继承的 build:uvm_tlm_fifo_base.svh:165–169。注释中的关闭意图需结合下一项核对。

    VCS 内置 uvm-ieee-2020-2.0:fifo_base 的 use_automatic_config 默认返回 0:uvm_tlm_fifo_base.svh:173–176

    2. component::build 决定字段是否实际得到自动配置

    VCS 内置 UVM-1.2:build 在未全局禁用时调用 apply_config_settings:uvm_component.svh:2447–2457。与上一项的 build 调用相接,默认会执行自动配置。

    VCS 内置 uvm-ieee-2020-2.0:build 仅在 use_automatic_config 返回 1 时调用:uvm_component.svh:3927–3932。FIFO 默认返回 0,因而跳过;派生类返回 1 后的恢复效果见实测。

    补充定位

    VCS 内置 UVM-1.2uvm_tlm_fifo_base.svh:166(调用 build);uvm_component.svh:2447(默认调用 apply_config_settings)

    VCS 内置 uvm-ieee-2020-2.0uvm_tlm_fifo_base.svh:174(use_automatic_config 返回 0);uvm_component.svh:3928(仅钩子返回 1 时调用 apply_config_settings);uvm_tlm_fifo_base.svh:53(同时新增 `uvm_component_abstract_param_utils

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

    src/vcs-uvm-1.2/tlm1/uvm_tlm_fifo_base.svh
      endfunction
    
      //turn off auto config
      function void build_phase(uvm_phase phase);
        build(); //for backward compat, won't cause auto-config
        return;
      endfunction
    
      virtual function void flush();
        uvm_report_error("flush", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
      endfunction
    
      virtual function int size();
        uvm_report_error("size", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
        return 0;
      endfunction
    
      virtual task put(T t);
        uvm_report_error("put", `UVM_TLM_FIFO_TASK_ERROR, UVM_NONE);
    

    完整源码 · SHA256:e9e8aab0475b307651bc442dad3a36eef18c6316cca12a58ec9721d68eec69b8

    src/vcs-uvm-1.2/base/uvm_component.svh
    // Backward compatibility build function
    
    function void uvm_component::build();
      uvm_root r_obj;
      m_build_done = 1;
       r_obj = uvm_root::get();   
       if (!(r_obj.disable_apply_cfg_settings)) 
      apply_config_settings(print_config_matches);
    //   else `uvm_info("NO_APPLY_CFG","apply_config_settings disabled by +UVM_DISABLE_APPLY_CFG_SETTINGS",UVM_DEBUG)
      if(m_phasing_active == 0) begin
        uvm_report_warning("UVM_DEPRECATED", "build()/build_phase() has been called explicitly, outside of the phasing system. This usage of build is deprecated and may lead to unexpected behavior.");
      end
    endfunction
    
    // these phase methods are common to all components in UVM. For backward
    // compatibility, they call the old style name (without the _phse)
    
    function void uvm_component::connect_phase(uvm_phase phase);
    

    完整源码 · SHA256:a64354e981dcf241513831f16466d6bea6dea05c561ffe3a3ae02dd7bcce99fc

    src/vcs-uvm-ieee-2020-2.0/tlm1/uvm_tlm_fifo_base.svh
    // @uvm-ieee 1800.2-2020 auto 12.2.8.1.1
    virtual class uvm_tlm_fifo_base #(type T=int) extends uvm_component;
    
      `uvm_component_abstract_param_utils(uvm_tlm_fifo_base #(T))
    
      typedef uvm_tlm_fifo_base #(T) this_type;
    
      // Port -- NODOCS -- put_export
      //
      // The ~put_export~ provides both the blocking and non-blocking put interface
      // methods to any attached port:
      //
      //|  task put (input T t)
      //|  function bit can_put ()
      //|  function bit try_put (input T t)
      //
      // Any ~put~ port variant can connect and send transactions to the FIFO via this
      // export, provided the transaction types match. See <uvm_tlm_if_base #(T1,T2)>
      // for more information on each of the above interface methods.
    

    src/vcs-uvm-ieee-2020-2.0/tlm1/uvm_tlm_fifo_base.svh
      endfunction
    
      //turn off auto config
      virtual function bit use_automatic_config();
        return 0;
      endfunction : use_automatic_config
    
      // @uvm-ieee 1800.2-2020 auto 12.2.8.2.6
      virtual function void flush();
        uvm_report_error("flush", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
      endfunction
    
      // @uvm-ieee 1800.2-2020 auto 12.2.8.2.2
      virtual function int size();
        uvm_report_error("size", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
        return 0;
      endfunction
    
      // @uvm-ieee 1800.2-2020 auto 12.2.8.1.3
    

    完整源码 · SHA256:b28d8df5e88cc7bd30e9e4b385d01bdf1ec0b641776f269813b318af7fab0d48

    src/vcs-uvm-ieee-2020-2.0/base/uvm_component.svh
      return begin_tr(tr, stream_name, label, desc, begin_time, parent_handle);
    endfunction
    
    // contains default behavior for build_phase()
    function void uvm_component::build();
      m_build_done = 1;
      if (use_automatic_config())
        apply_config_settings(get_print_config_matches());
    endfunction
    
    // These are the old style phase names for backward compatibility. 
    function void uvm_component::connect();             return; endfunction
    function void uvm_component::start_of_simulation(); return; endfunction
    function void uvm_component::end_of_elaboration();  return; endfunction
    task          uvm_component::run();                 return; endtask
    function void uvm_component::extract();             return; endfunction
    function void uvm_component::check();               return; endfunction
    function void uvm_component::report();              return; endfunction
    

    完整源码 · SHA256:a35015c7b14dbf63f2e47a4d202e49555159bb91c263255a1421e3cfdf9e63f2

    src/uvm-1.2/src/base/uvm_component.svh
    // Backward compatibility build function
    
    function void uvm_component::build();
      m_build_done = 1;
      apply_config_settings(print_config_matches);
      if(m_phasing_active == 0) begin
        uvm_report_warning("UVM_DEPRECATED", "build()/build_phase() has been called explicitly, outside of the phasing system. This usage of build is deprecated and may lead to unexpected behavior.");
      end
    endfunction
    
    // these phase methods are common to all components in UVM. For backward
    // compatibility, they call the old style name (without the _phse)
    
    function void uvm_component::connect_phase(uvm_phase phase);
      connect();
      return; 
    endfunction
    function void uvm_component::start_of_simulation_phase(uvm_phase phase);
    

    完整源码 · SHA256:9fd0e7ac796bb235832266d13062c2a41418d4c43b377b49213af15239aacf6f

    src/1800.2-2020-2.0/src/base/uvm_component.svh
    endfunction
    
    // contains default behavior for build_phase()
    function void uvm_component::build();
      m_build_done = 1;
      if (use_automatic_config())
        apply_config_settings(get_print_config_matches());
    endfunction
    
    // These are the old style phase names for backward compatibility. 
    function void uvm_component::connect();             return; endfunction
    function void uvm_component::start_of_simulation(); return; endfunction
    function void uvm_component::end_of_elaboration();  return; endfunction
    task          uvm_component::run();                 return; endtask
    function void uvm_component::extract();             return; endfunction
    function void uvm_component::check();               return; endfunction
    function void uvm_component::report();              return; endfunction
    

    完整源码 · SHA256:8929ab133a8cd0e1d753f647e158b99b202cb379f1b3cd5fb2d42012fdf7f7b6

    术语解释 · 兼容配置

    禁用自动字段配置(M01-007) · uvm_field_* automation(M09-002)

    返回TLM · 迁移清单

    版本适用范围