跳转至

输入查询内容

    本页内容

    TLM 组件的工厂创建与类型名

    影响范围

    通过 factory 创建 TLM 组件,或按 transport_channel 类型字符串匹配。

    具体差异

    2.0 对上述类增加参数化组件注册,获得 type override 能力。fifo/analysis_fifo/req_rsp 的类型名保持;transport_channel 以前继承 req_rsp 的名字,现在显式返回 uvm_tlm_transport_channel #(REQ,RSP),按类型字符串识别的日志/工具需要更新。同时 req_rsp 的手写 create 删除,由宏提供。

    修改方案

    普通 FIFO 和 req_rsp 传输调用可保留;根据 transport_channel 的 get_type_name() 输出匹配日志时,改为目标 uvm_tlm_transport_channel #(REQ,RSP)。类型判断优先使用实际类型句柄或 $cast;采用新 factory 创建能力时验证 override 后对象身份和一次完整请求/响应。

    兼容措施与范围:现有入口无需兼容开关;这不表示两版行为相同,仍按本条条件和验证方法核对。

    迁移后验证

    工厂创建后检查实际类型及名称,传输请求/响应一轮并核对数量;更新实际依赖的类型字符串。

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

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

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

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2uvm_tlm_fifos.svh:48uvm_tlm_fifos.svh:228(仅 const static string type_name + get_type_name(),无注册);uvm_tlm_req_rsp.svh:50

    VCS 内置 uvm-ieee-2020-2.0uvm_tlm_fifos.svh:51–52uvm_tlm_fifos.svh:233–234uvm_tlm_req_rsp.svh:53–54uvm_tlm_req_rsp.svh:295

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

    src/vcs-uvm-1.2/tlm1/uvm_tlm_fifos.svh
    class uvm_tlm_fifo #(type T=int) extends uvm_tlm_fifo_base #(T);
    
      const static string type_name = "uvm_tlm_fifo #(T)";
    
      local mailbox #( T ) m;
      local int m_size;
      protected int m_pending_blocked_gets;
    
    
      // Function: new
      //
      // The ~name~ and ~parent~ are the normal uvm_component constructor arguments. 
      // The ~parent~ should be ~null~ if the <uvm_tlm_fifo#(T)> is going to be used in a
      // statically elaborated construct (e.g., a module). The ~size~ indicates the
      // maximum size of the FIFO; a value of zero indicates no upper bound.
    
      function new(string name, uvm_component parent = null, int size = 1);
        super.new(name, parent);
    

    src/vcs-uvm-1.2/tlm1/uvm_tlm_fifos.svh
        analysis_export = new("analysis_export", this);
      endfunction
    
      const static string type_name = "uvm_tlm_analysis_fifo #(T)";
    
      virtual function string get_type_name();
        return type_name;
      endfunction
    
      function void write(input T t);
        void'(this.try_put(t)); // unbounded => must succeed
      endfunction
    
    endclass
    

    完整源码 · SHA256:f4de9fa81bff8301401a46a2b108a88d767dab7f5a78a4d0e0f2ed0ecd63020e

    src/vcs-uvm-1.2/tlm1/uvm_tlm_req_rsp.svh
      typedef uvm_tlm_req_rsp_channel #(REQ, RSP) this_type;
    
      const static string type_name = "uvm_tlm_req_rsp_channel #(REQ,RSP)";
    
      // Port: put_request_export
      //
      // The put_export provides both the blocking and non-blocking put interface
      // methods to the request FIFO:
      //
      //|  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 request FIFO
      // via this export, provided the transaction types match.
    
      uvm_put_export #(REQ) put_request_export;
    

    完整源码 · SHA256:c6992ce50c64c3199a637c0548d760414846f20c33d466f8cd899f911104d888

    src/vcs-uvm-ieee-2020-2.0/tlm1/uvm_tlm_fifos.svh
    // @uvm-ieee 1800.2-2020 auto 18.2.8.2
    class uvm_tlm_fifo #(type T=int) extends uvm_tlm_fifo_base #(T);
    
      `uvm_component_param_utils(uvm_tlm_fifo#(T))
      `uvm_type_name_decl("uvm_tlm_fifo #(T)")
    
      local mailbox #( T ) m;
      local int m_size;
     `ifndef UVM_USE_PROCESS_CONTAINER 
      protected bit m_pending_blocked_gets[process];
     `else
      protected bit m_pending_blocked_gets[process_container_c];
     `endif 
    
    
      // Function -- NODOCS -- new
      //
      // The ~name~ and ~parent~ are the normal uvm_component constructor arguments. 
      // The ~parent~ should be ~null~ if the <uvm_tlm_fifo#(T)> is going to be used in a
    

    src/vcs-uvm-ieee-2020-2.0/tlm1/uvm_tlm_fifos.svh
    //------------------------------------------------------------------------------
    
    class uvm_tlm_analysis_fifo #(type T = int) extends uvm_tlm_fifo #(T);
      `uvm_component_param_utils(uvm_tlm_analysis_fifo#(T))
      `uvm_type_name_decl("uvm_tlm_analysis_fifo #(T)")
    
      // Port -- NODOCS -- analysis_export #(T)
      //
      // The analysis_export provides the write method to all connected analysis
      // ports and parent exports:
      //
      //|  function void write (T t)
      //
      // Access via ports bound to this export is the normal mechanism for writing
      // to an analysis FIFO. 
      // See write method of <uvm_tlm_if_base #(T1,T2)> for more information.
    
      uvm_analysis_imp #(T, uvm_tlm_analysis_fifo #(T)) analysis_export;
    

    完整源码 · SHA256:fe915359c5e25996ddb3cf93580e80d18a4d39ff0f290ab5c69c386a1ff5bef6

    src/vcs-uvm-ieee-2020-2.0/tlm1/uvm_tlm_req_rsp.svh
      typedef uvm_tlm_req_rsp_channel #(REQ, RSP) this_type;
    
      `uvm_component_param_utils(uvm_tlm_req_rsp_channel#(REQ,RSP))
      `uvm_type_name_decl("uvm_tlm_req_rsp_channel #(REQ,RSP)")
    
      // Port -- NODOCS -- put_request_export
      //
      // The put_export provides both the blocking and non-blocking put interface
      // methods to the request FIFO:
      //
      //|  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 request FIFO
      // via this export, provided the transaction types match.
    
      uvm_put_export #(REQ) put_request_export;
    

    src/vcs-uvm-ieee-2020-2.0/tlm1/uvm_tlm_req_rsp.svh
    class uvm_tlm_transport_channel #(type REQ=int, type RSP=REQ) 
                                         extends uvm_tlm_req_rsp_channel #(REQ, RSP);
    
      `uvm_component_param_utils(uvm_tlm_transport_channel#(REQ,RSP))
      `uvm_type_name_decl("uvm_tlm_transport_channel #(REQ,RSP)")
    
      typedef uvm_tlm_transport_channel #(REQ, RSP) this_type;
    
      // Port -- NODOCS -- transport_export
      //
      // The put_export provides both the blocking and non-blocking transport
      // interface methods to the response FIFO:
      //
      //|  task transport(REQ request, output RSP response);
      //|  function bit nb_transport(REQ request, output RSP response);
      //
      // Any transport port variant can connect to and send requests and retrieve
      // responses via this export, provided the transaction types match. Upon
      // return, the response argument carries the response to the request.
    

    完整源码 · SHA256:7da584a58993dc14247b1c34440923efd75cb4c56a6745d21479642611b293ca

    术语解释 · 兼容配置

    返回TLM · 迁移清单

    版本适用范围