跳转至

输入查询内容

    本页内容

    get_local_map/get_default_map 移除 caller 调试形参(含 Xcheck_accessX)

    影响范围

    传入 get_local_map/get_default_map 的 caller 参数或重写相关接口。

    具体差异

    最后一个 string caller = "" 形参删除。不传 caller 的既有调用兼容;显式传 caller 的调用和保留该形参的 override 都需修改。C9 已用 get_default_map("caller") 复现目标版参数过多错误。

    修改方案

    删除调用点的 caller 实参,并同步派生类的方法原型。

    rg 为已有寄存器,requested_map 为实际选定的 map,selected_map 为接收结果的 uvm_reg_map 句柄:

    1
    2
    3
    4
    5
    6
    // UVM 1.2
    selected_map = rg.get_default_map("my_seq");
    selected_map = rg.get_local_map(requested_map, "my_seq");
    // UVM 2.0
    selected_map = rg.get_default_map();
    selected_map = rg.get_local_map(requested_map);
    

    只删除最后一个 caller 字符串,不要删掉决定访问路径的 map 实参。重写相应方法时同步移除 string caller="" 形参;mem/indirect reg 的同类入口同样处理。直接依赖内部 Xcheck_accessX(rw, map_info, caller) 时,改为两参数并继续核对输出的 map_info。原本未传 caller 的公开调用可保留。

    兼容措施与范围:已删除的 caller 形参不恢复;调用与派生 override 同步修改。

    迁移后验证

    删除多余实参并同步 override,编译后在多 map 模型检查返回 map 身份和地址。

    记录本条结果M07-002 · 状态与证据

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

    • C9 · 启发式:map 查询删除 caller 形参,核对显式实参与 override。 解析嵌套参数和命名 caller;参数数量符合目标的普通 get_local_map/get_default_map/Xcheck_accessX 调用不触发此规则。仍需区分同名用户方法。
    uv run tools/uvm_migration_scan.py <SoC代码目录> --rules C9
    

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2uvm_reg.svh:208uvm_reg.svh:210uvm_mem.svh:195uvm_mem.svh:198uvm_reg_indirect.svh:131Xcheck_accessX(rw, map_info, caller)uvm_mem.svh:535

    VCS 内置 uvm-ieee-2020-2.0uvm_reg.svh:225uvm_reg.svh:237uvm_mem.svh:162uvm_mem.svh:164uvm_reg_indirect.svh:118Xcheck_accessX(rw, map_info)uvm_mem.svh:343

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

    src/vcs-uvm-1.2/reg/uvm_reg.svh
       extern virtual function void get_maps (ref uvm_reg_map maps[$]);
    
    
       /*local*/ extern virtual function uvm_reg_map get_local_map   (uvm_reg_map map,
                                                                      string caller = "");
       /*local*/ extern virtual function uvm_reg_map get_default_map (string caller = "");
    
    
       // Function: get_rights
       //
       // Returns the accessibility ("RW, "RO", or "WO") of this register in the given ~map~.
       //
       // If no address map is specified and the register is mapped in only one
       // address map, that address map is used. If the register is mapped
       // in more than one address map, the default address map of the
       // parent block is used.
       //
       // Whether a register field can be read or written depends on both the field's
       // configured access policy (refer to <uvm_reg_field::configure>) and the register's
       // accessibility rights in the map being used to access the field. 
       //
    

    完整源码 · SHA256:a01d27ace4190cce87f4bf8f78d0db63b1517ffb43a412e187e67391984971b6

    src/vcs-uvm-1.2/reg/uvm_mem.svh
       extern virtual function void get_maps (ref uvm_reg_map maps[$]);
    
    
       /*local*/ extern function uvm_reg_map get_local_map   (uvm_reg_map map,
                                                              string caller = "");
    
       /*local*/ extern function uvm_reg_map get_default_map (string caller = "");
    
    
       // Function: get_rights
       //
       // Returns the access rights of this memory.
       //
       // Returns "RW", "RO" or "WO".
       // The access rights of a memory is always "RW",
       // unless it is a shared memory
       // with access restriction in a particular address map.
       //
       // If no address map is specified and the memory is mapped in only one
       // address map, that address map is used. If the memory is mapped
       // in more than one address map, the default address map of the
       // parent block is used.
    

    src/vcs-uvm-1.2/reg/uvm_mem.svh
       extern protected function bit Xcheck_accessX (input uvm_reg_item rw,
                                                     output uvm_reg_map_info map_info,
                                                     input string caller);
    
    
       extern virtual task do_write (uvm_reg_item rw);
       extern virtual task do_read  (uvm_reg_item rw);
    
    
       //-----------------
       // Group: Frontdoor
       //-----------------
    
       // Function: set_frontdoor
       //
       // Set a user-defined frontdoor for this memory
       //
    

    完整源码 · SHA256:17f9d299cdc8517a1e1c4d4c8b4667e6a598b843fb0cae96f9a4c641473b9302

    src/vcs-uvm-1.2/reg/uvm_reg_indirect.svh
       endfunction
    
    
       virtual function uvm_reg_map get_local_map(uvm_reg_map map, string caller="");
          return  m_idx.get_local_map(map,caller);
       endfunction
    
       //
       // Just for good measure, to catch and short-circuit non-sensical uses
       //
       virtual function void add_field  (uvm_reg_field field);
          `uvm_error(get_full_name(), "Cannot add field to an indirect data access register");
       endfunction
    
       virtual function void set (uvm_reg_data_t  value,
                                  string          fname = "",
                                  int             lineno = 0);
          `uvm_error(get_full_name(), "Cannot set() an indirect data access register");
       endfunction
    

    完整源码 · SHA256:2c4c4f34949ab08a7e0ef82cff75de8adaf3de84c4a55155bc8ffa32f97e7188

    src/vcs-uvm-ieee-2020-2.0/reg/uvm_reg.svh
       // @uvm-ieee 1800.2-2020 auto 18.4.3.6
       extern virtual function uvm_reg_map get_local_map (uvm_reg_map map);
    
       // Function: get_default_map
       //
       // Returns default map for the register as follows:
       //
       // If the register is not associated with any map - returns null
       // Else If the register is associated with only one map - return a handle to that map
       // Else try to find the first default map in its parent blocks and return its handle
       // If there are no default maps in the registers parent blocks return a handle to the first map in its map array 
       //  
       // @uvm-contrib
       extern virtual function uvm_reg_map get_default_map ();
    
    
    
       // @uvm-ieee 1800.2-2020 auto 18.4.3.7
       extern virtual function string get_rights (uvm_reg_map map = null);
    
    
       // Function -- NODOCS -- get_n_bits
       //
       // Returns the width, in bits, of this register.
       //
       extern virtual function int unsigned get_n_bits ();
    
    
       // Function -- NODOCS -- get_n_bytes
    

    完整源码 · SHA256:a0b3ba54fe8e7a696018aa531a0e93c98cfdc89c74073dfcf7eed58b9833618e

    src/vcs-uvm-ieee-2020-2.0/reg/uvm_mem.svh
       extern virtual function void get_maps (ref uvm_reg_map maps[$]);
    
    
       /*local*/ extern function uvm_reg_map get_local_map   (uvm_reg_map map);
    
       /*local*/ extern function uvm_reg_map get_default_map ();
    
    
    
       // @uvm-ieee 1800.2-2020 auto 18.6.4.5
       extern virtual function string get_rights (uvm_reg_map map = null);
    
    
    
       // @uvm-ieee 1800.2-2020 auto 18.6.4.6
       extern virtual function string get_access(uvm_reg_map map = null);
    
    
       // Function -- NODOCS -- get_size
       //
       // Returns the number of unique memory locations in this memory. 
    

    src/vcs-uvm-ieee-2020-2.0/reg/uvm_mem.svh
       extern protected function bit Xcheck_accessX (input uvm_reg_item rw,
                                                     output uvm_reg_map_info map_info);
    
    
       extern virtual task do_write (uvm_reg_item rw);
       extern virtual task do_read  (uvm_reg_item rw);
    
    
       //-----------------
       // Group -- NODOCS -- Frontdoor
       //-----------------
    
    
       // @uvm-ieee 1800.2-2020 auto 18.6.6.2
       extern function void set_frontdoor(uvm_reg_frontdoor ftdr,
                                          uvm_reg_map map = null,
                                          string fname = "",
    

    完整源码 · SHA256:e9ae7cb0d6ec028458cd7d5475508ab54d539dee4f4842a58451439b7908b6bd

    src/vcs-uvm-ieee-2020-2.0/reg/uvm_reg_indirect.svh
       endfunction
    
    
       virtual function uvm_reg_map get_local_map(uvm_reg_map map);
          return  m_idx.get_local_map(map);
       endfunction
    
       //
       // Just for good measure, to catch and short-circuit non-sensical uses
       //
       virtual function void add_field  (uvm_reg_field field);
          `uvm_error(get_full_name(), "Cannot add field to an indirect data access register")
       endfunction
    
       virtual function void set (uvm_reg_data_t  value,
                                  string          fname = "",
                                  int             lineno = 0);
          `uvm_error(get_full_name(), "Cannot set() an indirect data access register")
       endfunction
    

    完整源码 · SHA256:8718ca1131a701d870fac92ac42ab0916aa99d8a957f308914b6a16331790115

    术语解释 · 兼容配置

    返回RAL(寄存器模型) · 迁移清单

    版本适用范围