跳转至

输入查询内容

    本页内容

    port.get_connected_to / get_provided_to 返回容器改为 port 句柄

    影响范围

    保存 get_connected_to/get_provided_to 的旧 proxy 容器。

    具体差异

    直接调用 port 的查询接口并传 uvm_port_list,在目标 VCS 报 IRPC,不能将 TLM 查询 API 一概称为不变。目标返回真实 port,需再调用 get_comp() 取得 proxy;新增 get_provided_to_component 返回 parent component,和 proxy 不是同一概念。

    修改方案

    将容器声明为与端口 IF 参数匹配的 uvm_port_base#(IF) list[string],并调整后续访问;若需要旧 proxy 容器,可经 port.get_comp() 调用其查询接口。

    uvm_blocking_put_port#(int) port_value 为例,实际 IF 为 uvm_tlm_if_base#(int,int)。在端口已构造并完成连接解析后查询:

    1
    2
    3
    // UVM 1.2
    uvm_port_list peers;
    port_value.get_connected_to(peers);
    
    1
    2
    3
    // UVM 2.0: collection of actual ports
    uvm_port_base#(uvm_tlm_if_base#(int,int)) peers[string];
    port_value.get_connected_to(peers);
    

    其他端口按自身 IF 类型声明容器;get_provided_to 同样调整。集合元素现在是真实 port,要取得旧 proxy 时调用 peers[name].get_comp()

    如果后续代码确实需要 proxy 集合,可保留 uvm_port_list,改用主库保留的 proxy 查询:

    uvm_port_list peers;
    port_value.get_comp().get_connected_to(peers);
    

    两种写法按后续代码需要选择。proxy component 与端口所属的 parent component 含义不同,不能互换。

    兼容措施与范围:主库 proxy 保留旧 uvm_port_list 查询,可通过 port.get_comp() 使用;直接 port 的旧容器签名未保留,改用真实 port 集合时同步元素类型。

    迁移后验证

    编译与 IF 匹配的新容器,建立已知连接后检查集合大小和每个 port 句柄;需要 proxy 时验证 get_comp 路径。

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

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

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

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

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

    源码与标准依据

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

    证据tests/uvm_review/compile_extended.sv C15。

    VCS 内置 UVM-1.2uvm_port_base.svh:636 / uvm_port_base.svh:649(ref uvm_port_list,值为 proxy component)

    VCS 内置 uvm-ieee-2020-2.0uvm_port_base.svh:710 / uvm_port_base.svh:736(ref uvm_port_base#(IF) list[string]);uvm_port_base.svh:171 / uvm_port_base.svh:182(proxy 上保留旧形态)

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

    src/vcs-uvm-1.2/base/uvm_port_base.svh
      // get_connected_to
      // ----------------
    
      function void get_connected_to (ref uvm_port_list list);
        this_type port;
        list.delete();
        foreach (m_provided_by[name]) begin
          port = m_provided_by[name];
          list[name] = port.get_comp();
        end
      endfunction
    
    
      // get_provided_to
      // ---------------
    
      function void get_provided_to (ref uvm_port_list list);
        this_type port;
        list.delete();
        foreach (m_provided_to[name]) begin
          port = m_provided_to[name];
          list[name] = port.get_comp();
        end
      endfunction
    
    
      // m_check_relationship
      // --------------------
    
      local function bit  m_check_relationship (this_type provider);  
        string s;
        this_type from;
    

    完整源码 · SHA256:7e89b6e472722336f11596e5d50cd4069d999a3a9429a1898bae4dfc906fe227

    src/vcs-uvm-ieee-2020-2.0/base/uvm_port_base.svh
      //
      // @uvm-accellera The details of this API are specific to the Accellera implementation, and are not being considered for contribution to 1800.2
    
      virtual function void get_connected_to(ref uvm_port_list list);
    
        PORT list1[string];
        m_port.get_connected_to(list1);
        list.delete();
        foreach(list1[name]) begin
          list[name] = list1[name].get_comp();
        end
    
      endfunction
    
      virtual function void get_provided_to(ref uvm_port_list list);
    
        PORT list1[string];
        m_port.get_provided_to(list1);
        list.delete();
        foreach(list1[name]) begin
          list[name] = list1[name].get_comp();
        end
      endfunction  
    
      function bit is_port ();
        return m_port.is_port();
      endfunction
    
      function bit is_export ();
        return m_port.is_export();
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_port_base.svh
      // ----------------
    
      // @uvm-ieee 1800.2-2020 auto 5.5.2.9
      function void get_connected_to (ref uvm_port_base #(IF) list[string]);
        this_type port;
        list.delete();
        foreach (m_provided_by[name]) begin
          port = m_provided_by[name];
          list[name] = port;
        end
      endfunction
    
      // Modified by Verdi
      // get_provided_to_component
      // ----------------
      function void get_provided_to_component (ref uvm_component list[string]);
        this_type port;
        list.delete();
        foreach (m_provided_to[name]) begin
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_port_base.svh
      // ---------------
    
      // @uvm-ieee 1800.2-2020 auto 5.5.2.10
      function void get_provided_to (ref uvm_port_base #(IF) list[string]);
        this_type port;
        list.delete();
        foreach (m_provided_to[name]) begin
          port = m_provided_to[name];
          list[name] = port;
        end
      endfunction
    
    
      // m_check_relationship
      // --------------------
    
      local function bit  m_check_relationship (this_type provider);  
        string s;
        this_type from;
    

    完整源码 · SHA256:4d0d18356912309caf9fa1fc549b969cc18efb5af42b96fdb9e1e2a7d11549c4

    术语解释 · 兼容配置

    返回TLM · 迁移清单

    版本适用范围