跳转至

输入查询内容

    本页内容

    新增 API(uvm_globals / uvm_misc)

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

    具体差异

    新增库初始化/状态查询(uvm_init/get_core_state)、字符串转 verbosity、与 uvm_split_string 语义不同的 uvm_string_split(保留空字段,旧函数跳过空字段)。另 uvm_re_match 新增 deglob 默认参数(src/vcs-uvm-ieee-2020-2.0/dpi/uvm_regex.svh:40),uvm_is_match 改经 deglob=1 实现;不能把调用重构推导为所有开关下都等价,缓存模式问题见 M10-006

    修改方案

    无(存量代码不受影响;注意 uvm_string_splituvm_split_string,勿混用)。

    兼容措施与范围:本条是新增能力或实现说明,无需恢复旧接口;按使用条件核对行为。

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2:无

    VCS 内置 uvm-ieee-2020-2.0uvm_globals.svh:287uvm_string_to_verbosity)、uvm_globals.svh:343get_core_state)、uvm_globals.svh:369uvm_init)、uvm_globals.svh:530uvm_string_split)、uvm_globals.svh:703uvm_shared#(T));uvm_object_globals.svh:640 起(uvm_core_state 枚举,§F.2.10)

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

    src/vcs-uvm-ieee-2020-2.0/base/uvm_globals.svh
      end
    endfunction
    
    function automatic bit uvm_string_to_verbosity(string verb_str, output uvm_verbosity verb_enum);
        case (verb_str)
          "NONE"       : begin verb_enum = UVM_NONE;   return 1; end
          "UVM_NONE"   : begin verb_enum = UVM_NONE;   return 1; end
          "LOW"        : begin verb_enum = UVM_LOW;    return 1; end
          "UVM_LOW"    : begin verb_enum = UVM_LOW;    return 1; end
          "MEDIUM"     : begin verb_enum = UVM_MEDIUM; return 1; end
          "UVM_MEDIUM" : begin verb_enum = UVM_MEDIUM; return 1; end
          "HIGH"       : begin verb_enum = UVM_HIGH;   return 1; end
          "UVM_HIGH"   : begin verb_enum = UVM_HIGH;   return 1; end
          "FULL"       : begin verb_enum = UVM_FULL;   return 1; end
          "UVM_FULL"   : begin verb_enum = UVM_FULL;   return 1; end
          "DEBUG"      : begin verb_enum = UVM_DEBUG;  return 1; end
          "UVM_DEBUG"  : begin verb_enum = UVM_DEBUG;  return 1; end
          default      : begin                         return 0; end
        endcase
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_globals.svh
    endfunction
    
    // @uvm-ieee 1800.2-2020 auto F.3.1.1
    function uvm_core_state get_core_state();
       if (m_uvm_core_state.size() == 0) return UVM_CORE_UNINITIALIZED;
       else return m_uvm_core_state[0];
    endfunction
    
    // Function: uvm_init
    // Implementation of uvm_init, as defined in section
    // F.3.1.3 in 1800.2-2020.
    //
    // *Note:* The LRM states that subsequent calls to <uvm_init> after
    // the first are silently ignored, however there are scenarios wherein
    // the implementation breaks this requirement.
    //
    // If the core state (see <get_core_state>) is ~UVM_CORE_PRE_INIT~ when <uvm_init>,
    // is called, then the library can not determine the appropriate core service.  As
    // such, the default core service will be constructed and a fatal message
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_globals.svh
    // @uvm-contrib This API represents a potential contribution to IEEE 1800.2
    
    // @uvm-ieee 1800.2-2020 auto F.3.1.3
    function void uvm_init(uvm_coreservice_t cs=null);
      uvm_default_coreservice_t dcs;
    
      if(get_core_state()!=UVM_CORE_UNINITIALIZED) begin
        if (get_core_state() == UVM_CORE_PRE_INIT) begin
          // If we're in this state, something very strange has happened.
          // We've called uvm_init, and it is actively assigning the
          // core service, but the core service isn't actually set yet.
          // This means that either the library messed something up, or
          // we have a race occurring between two threads.  Either way, 
          // this is non-recoverable.  We're going to setup using the default
          // core service, and immediately fatal out.
          dcs = new();
          uvm_coreservice_t::set(dcs);
          `uvm_fatal("UVM/INIT/MULTI", "Non-recoverable race during uvm_init")
        end
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_globals.svh
    // on the sep. values shall be a queue.
    //----------------------------------------------------------------------------
    
    function automatic void uvm_string_split (string str, byte sep, ref string values[$]);
      int s = 0, e = 0, limit;
      values.delete();
      limit = str.len() + 1;
      do 
        begin
          for(s=e; e<str.len(); ++e)
            if(str[e] == sep) break;
          values.push_back(str.substr(s,e-1));
          e++;
        end
      while(e < limit);
    endfunction
    
    
    // Class -- NODOCS -- uvm_enum_wrapper#(T)
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_globals.svh
    // after a function/task scope has been exited.
    //
    // @uvm-contrib - For potential contribution to 1800.2 standard
    class uvm_shared#(type T=int);
      // Variable- value
      // The value contained within the ref.
      T value;
    endclass : uvm_shared
    

    完整源码 · SHA256:7c9321d117c5e3391f81792b730837a5bca47d3539152d98412ae3c75594fe2f

    src/vcs-uvm-ieee-2020-2.0/base/uvm_object_globals.svh
    // @uvm-contrib Potential contribution to 1800.2
    
    // @uvm-ieee 1800.2-2020 manual F.2.10
    typedef enum {
        UVM_CORE_UNINITIALIZED,
            UVM_CORE_PRE_INIT,
            UVM_CORE_INITIALIZING,
        UVM_CORE_INITIALIZED, // UVM_CORE_POST_INIT
        UVM_CORE_PRE_RUN,
        UVM_CORE_RUNNING,
        UVM_CORE_POST_RUN,
        UVM_CORE_FINISHED,
        UVM_CORE_PRE_ABORT,
        UVM_CORE_ABORTED    
    } uvm_core_state;
    
    // Used to indicate a strict name vs. regex name lookup in apply_config_settings
    typedef struct {
      string       name;
    

    完整源码 · SHA256:0901c91b4736870c6b7bc6408ab2f60ce30cb1c64c5017f71164bc6ccfd7a78f

    src/vcs-uvm-ieee-2020-2.0/dpi/uvm_regex.svh
    // dereferencing.  When enabled, uvm_re_match should be significantly 
    // faster.   
    `ifdef UVM_ENABLE_RE_MATCH_CACHE
    function int uvm_re_match(string re, string str, bit deglob = 0);
      uvm_regex_cache cache;
      chandle cached[$];
      int retval;
    
      cache = uvm_regex_cache::get_inst();
      cached = cache.get(re);
      if (cached.size()) begin
        // Cache hit, use pre-compiled regex
        retval = uvm_re_exec(cached[0], str);
      end
      else begin
        // Cache miss, compile and cache regex
        chandle rexp;
        rexp = uvm_re_compexec(re, str, deglob, retval);
        if (rexp == null) begin
    

    完整源码 · SHA256:cd60f89f2d96f4d849f420dcc86c7df74f73c72b557104231f62a205323d93d5

    术语解释 · 兼容配置

    正则接口与缓存(M10-006)

    返回Reporting / 命令行 · 迁移清单

    版本适用范围