跳转至

输入查询内容

    本页内容

    use_uvm_seeding 静态变量 → get/set_uvm_seeding()

    新增功能:目标库新增的 API 和可选替代接口;已有用法的迁移要求列在用户接口与行为中。

    具体差异

    新旧接口读写同一变量(uvm_default_coreservice_t::get_uvm_seeding() 直接返回 uvm_object::use_uvm_seedinguvm_coreservice.svh:367-371),旧代码 uvm_object::use_uvm_seeding = 0; 在 2.0 仍然生效;新写法是标准推荐形式。

    修改方案

    建议统一改为 uvm_object::set_uvm_seeding(0);不强制。

    兼容措施与范围:主库保留 use_uvm_seeding 字段,普通读写无需开启宏或编译 compat 包;改用访问器后仍需检查对象随机种子。

    补充查阅

    扫描定位与记录结果

    无对应规则。当前脚本没有针对本条的直接检测规则。

    本条处理级别为“可选采用”,按修改方案评估;缺少扫描规则本身不增加迁移改造要求。

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

    源码与标准依据

    核查方式:源码核对。未单独进行 VCS 行为实测。

    VCS 内置 UVM-1.2uvm_object.svh:87static bit use_uvm_seeding = 1;)、uvm_object.svh:836(reseed 直接读该变量)

    VCS 内置 uvm-ieee-2020-2.0uvm_object.svh:65–66(变量保留,标 @uvm-compat)、uvm_object.svh:71/uvm_object.svh:76(新增 get_uvm_seeding()/set_uvm_seeding(bit),经 coreservice 转发)、uvm_object.svh:804(reseed 改读 get_uvm_seeding())

    标准依据:IEEE 1800.2-2020 §5.3.3.1 / §5.3.3.2

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

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

    src/vcs-uvm-1.2/base/uvm_object.svh
      // The <uvm_component> class is an example of a type that has a unique
      // instance name.
    
      static bit use_uvm_seeding = 1;
    
    
      // Function: reseed
      //
      // Calls ~srandom~ on the object to reseed the object using the UVM seeding
      // mechanism, which sets the seed based on type name and instance name instead
      // of based on instance position in a thread. 
      //
      // If the <use_uvm_seeding> static variable is set to 0, then reseed() does
      // not perform any function. 
    
      extern function void reseed ();
    
    
      // Group: Identification
    

    src/vcs-uvm-1.2/base/uvm_object.svh
    // reseed
    // ------
    
    function void uvm_object::reseed ();
      if(use_uvm_seeding)
        this.srandom(uvm_create_random_seed(get_type_name(), get_full_name()));
    endfunction
    
    
    // get type
    // --------
    
    function uvm_object_wrapper uvm_object::get_type();
      uvm_report_error("NOTYPID", "get_type not implemented in derived class.", UVM_NONE);
      return null;
    endfunction
    
    
    // get inst_id
    

    完整源码 · SHA256:5bacc747c3d5a16a0206864bd84eedf1aeff153a7152dcb0d0e40af208fbe4ec

    src/vcs-uvm-ieee-2020-2.0/base/uvm_object.svh
      // Group -- NODOCS -- Seeding
    
      //@uvm-compat provided for compatbility with 1.2
      static bit use_uvm_seeding = 1;
    
      // Function -- NODOCS -- get_uvm_seeding
    
      // @uvm-ieee 1800.2-2020 auto 5.3.3.1
      extern static function bit get_uvm_seeding();
    
      // Function -- NODOCS -- set_uvm_seeding
    
      // @uvm-ieee 1800.2-2020 auto 5.3.3.2
      extern static function void set_uvm_seeding(bit enable);
    
      // Function -- NODOCS -- reseed
      //
      // Calls ~srandom~ on the object to reseed the object using the UVM seeding
      // mechanism, which sets the seed based on type name and instance name instead
      // of based on instance position in a thread. 
      //
      // If <get_uvm_seeding> returns 0, then reseed() does
      // not perform any function. 
    
      // @uvm-ieee 1800.2-2020 auto 5.3.3.3
      extern function void reseed ();
    
    
      // Group -- NODOCS -- Identification
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_object.svh
    // ------
    
    function void uvm_object::reseed ();
      if(get_uvm_seeding())
        this.srandom(uvm_create_random_seed(get_type_name(), get_full_name()));
    endfunction
    
    
    // get type
    // --------
    
    function uvm_object_wrapper uvm_object::get_type();
      uvm_report_error("NOTYPID", "get_type not implemented in derived class.", UVM_NONE);
      return null;
    endfunction
    
    
    // get inst_id
    // -----------
    

    完整源码 · SHA256:53c99f38f1ce6cb3c6a215858b84938d18eb858f9396d3dba281a32addb3c9c9

    术语解释 · 兼容配置

    返回Object / Factory · 迁移清单

    版本适用范围