跳转至

输入查询内容

    本页内容

    新增 uvm_cache / uvm_lru_cache(及内部 uvm_regex_cache)

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

    具体差异

    通用缓存基类 + LRU 实现,标注 @uvm-contrib(尚未进标准正文)。纯新增,不影响存量代码。

    修改方案

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

    补充查阅

    扫描定位与记录结果

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

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2:无

    VCS 内置 uvm-ieee-2020-2.0uvm_cache.svh:41(virtual uvm_cache#(KEY_T,DATA_T):size/exists/get/put/evict/keys/flush/set_max_size,默认 max_size=256)、uvm_lru_cache.svh:46(uvm_lru_cache 实现 LRU 逐出)、uvm_regex_cache.svh:33(内部单例,缓存 uvm_is_match 编译结果)

    标准依据:无(IEEE 1800.2-2020 未收录,Accellera 贡献扩展)

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

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

    src/vcs-uvm-ieee-2020-2.0/base/uvm_cache.svh
    //------------------------------------------------------------------------------
    //
    // @uvm-contrib
    virtual class uvm_cache#(type KEY_T=int, type DATA_T=int) extends uvm_object;
    
      // Type: this_type
      // Typedef representing this cache parameterization.
      typedef uvm_cache#(KEY_T, DATA_T) this_type;
    
      // Type: optional_data
      // The cache can be queried for data at a given key.  If the
      // key exists within the cache then the data can be returned, but
      // if the key does ~not~ exist then the cache needs to return
      // "nothing".
      //
      // The ~optional_data~ type is a simple wrapper around a queue
      // of ~DATA_T~.  If the key is found (ie. hit), then the first
      // (and only) element of the queue stores the value.  If the
      // key is not found (ie. missed), then an empty queue is returned.
    

    完整源码 · SHA256:256909ae293ef970c3aeabdd03d801b9fd129e40e58cd3a12f0fc6dfc1a9554e

    src/vcs-uvm-ieee-2020-2.0/base/uvm_lru_cache.svh
      endclass : uvm_lru_cache_node
    
    // @uvm-contrib
    class uvm_lru_cache#(type KEY_T=int, type DATA_T=int) extends uvm_cache#(KEY_T, DATA_T);
    
      typedef uvm_lru_cache#(KEY_T,DATA_T) this_type;
    
      `uvm_object_param_utils(uvm_lru_cache#(KEY_T, DATA_T))
      `uvm_type_name_decl("uvm_lru_cache")
    
      // Function: new
      // Constructor, initializes the cache.
      //
      // The ~max_size~ argument defines the initial maximum size of
      // the cache.  The default ~max_size~ shall be 256.
      //
      // A ~max_size~ of 0 indicates that the cache is unsized, and will
      // not evict any keys.
      //
    

    完整源码 · SHA256:576ab2c31d2125c4a4b9feb8df92cf381f669835d6e49665800d5b0350b5423e

    src/vcs-uvm-ieee-2020-2.0/base/uvm_regex_cache.svh
    // Extends a uvm_lru_cache to add C-side memory management during eviction.  
    //------------------------------------------------------------------------------
    //
    class uvm_regex_cache extends uvm_lru_cache#(string, chandle);
    
      `uvm_type_name_decl("uvm_regex_cache")
    
      // Constructor is protected (singleton)
      protected function new(string name="unnamed-uvm_regex_cache");
        super.new(name);
      endfunction : new
    
      // Singleton accessor
      static function uvm_regex_cache get_inst();
        static uvm_regex_cache m_inst;
        if (m_inst == null)
          m_inst = new("uvm_regex_cache");
        return m_inst;
      endfunction : get_inst
    

    完整源码 · SHA256:b80996b87c9ddd376083f254106f1226304924ed7dc80acd21eac7efda56d894

    术语解释 · 兼容配置

    返回Comparer / Printer / Packer / Recorder · 迁移清单

    版本适用范围