跳转至

输入查询内容

    本页内容

    版本宏与版本字符串的迁移

    影响范围

    构建或代码按 UVM_VERSION_1_2 等宏选择实现、签名或能力时,分别检查两库实际进入的分支。 解析 uvm_revision_string() 返回值的日志脚本也需核对。

    具体差异

    UVM_VERSION_1_2 等精确版本宏删除;UVM_MINOR_REV 的 token 从整数 2 变为实数 2.0。UVM_VERSION_STRING 从字符串字面量展开改为 uvm_pkg::UVM_VERSION_STRING,要求该包已编译且上下文接受包常量表达式;限定名本身不要求 import。 uvm_revision_string() 的版本文本由 UVM-1.2.Synopsys 改为 Accellera:1800.2-2020:UVM:2.0,影响依赖旧前缀和分隔符的日志解析;uvm_mgc_copyright 等旧 copyright 参数也被删除。

    修改方案

    逐个确认分支意图。需要“恰为 1.2”与“支持 1.2 以后能力”时条件不同,不能一律把 UVM_VERSION_1_2 替换为 UVM_POST_VERSION_1_2。跨库签名示例见 semantic_probe 的目标宏分支;SV 预处理器没有 C 风格数值 #if,可用构建定义区分受支持版本。 日志解析脚本用两版实际版本文本校验前缀和分隔规则;删除对旧 copyright 参数的直接引用,版权文本以所用库随附声明为准,不把它当版本判断接口。

    兼容措施与范围:旧精确版本宏与字符串展开方式不恢复;构建分支及日志解析须保持原版本判断意图。

    迁移后验证

    两库分别给分支输出可识别标记;精确版本和能力分支分开检查,避免静默走 else。 另外捕获两版 uvm_revision_string() 返回值,回放到实际日志解析脚本。

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

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

    • S4 · 文本匹配:UVM_VERSION_1_2 等版本宏删除,`ifdef 静默走 else 分支。
    uv run tools/uvm_migration_scan.py <SoC代码目录> --rules S4
    

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

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

    源码与标准依据

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

    1. 精确版本条件与 POST 条件含义不同

    VCS 内置 UVM-1.2:精确版本宏明确表示当前版本为 1.2:uvm_version_defines.svh:127–134

    VCS 内置 uvm-ieee-2020-2.0:目标同时定义两个历史 POST 宏:uvm_version_defines.svh:56–58。替换条件前要保留原分支意图;宏的完整定义集合见上下文和源码文件。

    2. UVM_VERSION_STRING 的展开从字面量变为包常量

    VCS 内置 UVM-1.2:旧宏用预处理器拼接版本字符串;这里保留完整 ifdef/else/endif:uvm_version_defines.svh:91–95

    VCS 内置 uvm-ieee-2020-2.0:目标宏展开为限定包常量,旁边也可看到 major/minor token:uvm_version_defines.svh:51–54。使用处须允许该包常量表达式。

    补充定位

    VCS 内置 UVM-1.2uvm_version_defines.svh:49UVM_MAJOR_REV 1)、uvm_version_defines.svh:57UVM_MINOR_REV 2)、uvm_version_defines.svh:92–94UVM_VERSION_STRING 文本宏)、uvm_version_defines.svh:118/uvm_version_defines.svh:125/uvm_version_defines.svh:131/uvm_version_defines.svh:134UVM_MAJOR_REV_1/UVM_MINOR_REV_2/UVM_VERSION_1_2/UVM_MAJOR_VERSION_1_2) ;补充:uvm_version.svh:33

    VCS 内置 uvm-ieee-2020-2.0uvm_version_defines.svh:30UVM_VERSION 2020)、uvm_version_defines.svh:40–44UVM_VERSION_POST_*)、uvm_version_defines.svh:51/uvm_version_defines.svh:52UVM_MAJOR_REV 2020UVM_MINOR_REV 2.0)、uvm_version_defines.svh:54UVM_VERSION_STRING uvm_pkg::UVM_VERSION_STRING)、uvm_version_defines.svh:58UVM_POST_VERSION_1_2) ;补充:uvm_version_defines.svh:57uvm_version.svh:30uvm_version.svh:32

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

    src/vcs-uvm-1.2/macros/uvm_version_defines.svh
    // For UVM version 1.2, the MAJOR revision number is '1'
    //
    // | `define UVM_MAJOR_REV 1
    `define UVM_MAJOR_REV 1
    
    // Macro: UVM_MINOR_REV
    // Defines the MINOR revision number.
    //
    // For UVM version 1.2, the MINOR revision number is '2'
    //
    // | `define UVM_MINOR_REV 2
    `define UVM_MINOR_REV 2
    
    // Macro: UVM_FIX_REV
    // (Optionally) Defines the FIX revision letter.
    //
    // For the first "X.Y" release of the UVM, there is no
    // FIX revision letter.  In these cases, the UVM_FIX_REV
    // is left undefined.
    //
    // For any subsequent "X.Y" fix releases, the UVM_FIX_REV
    // value is set to the appropriate fix release letter.
    //
    // Example:
    // 1.1 - First release, UVM_FIX_REV is undefined
    // 1.1a - Fix release, UVM_FIX_REV is 'a'
    

    src/vcs-uvm-1.2/macros/uvm_version_defines.svh
    // When there is a FIX_REV, the string is "<name>-<major>.<minor><fix>" (such as "UVM-1.1d").
    // When there is NO FIX_REV, the string is "<name>-<major>.<minor>" (such as "UVM-1.2").
    
    `ifdef UVM_FIX_REV
     `define UVM_VERSION_STRING `"`UVM_NAME``-```UVM_MAJOR_REV``.```UVM_MINOR_REV`UVM_FIX_REV`"
    `else
     `define UVM_VERSION_STRING `"`UVM_NAME``-```UVM_MAJOR_REV``.```UVM_MINOR_REV```"
    `endif
    
    // Group: Conditional Compilation
    // These macros provide the ability to conditionally compile based on the
    // revision of the library which is being used.
    //
    // These macros are required for conditional compilation, as SystemVerilog does
    // not support conditionals with `ifdefs.
    //
    // For example:
    // |  // Illegal:
    // | `if (UVM_MAJOR_REV == 1)
    // |
    

    src/vcs-uvm-1.2/macros/uvm_version_defines.svh
    //
    // | `define UVM_MAJOR_REV_1
    //
    `define UVM_MAJOR_REV_1
    
    // Macro: UVM_MINOR_REV_2
    // Indicates that the MINOR version of this release is '2'.
    //
    // | `define UVM_MINOR_REV_2
    //
    `define UVM_MINOR_REV_2
    
    // Macro: UVM_VERSION_1_2
    // Indicates that the version of this release is '1.2'.
    //
    // | `define UVM_VERSION_1_2
    `define UVM_VERSION_1_2
    
    // Undocumented, same thing as UVM_VERSION_1_2
    `define UVM_MAJOR_VERSION_1_2
    
    // Group: UVM Version Ladder
    
    // Macro: UVM_POST_VERSION_1_1
    // Indicates that this version of the UVM came after the
    // 1.1 versions, including the various 1.1 fix revisions.  
    //
    // The first UVM version wherein this macro is defined is
    // 1.2, and the macro will continue to be defined
    // for all future revisions of the UVM library.
    //
    // | `define UVM_POST_VERSION_1_1
    `define UVM_POST_VERSION_1_1
    
    `endif // UVM_VERSION_DEFINES_SVH
    

    完整源码 · SHA256:ff9f4e96dd106dfde2c69f7365ad5a636790e476de1c04ec33c221a42965a483

    src/vcs-uvm-1.2/base/uvm_version.svh
    parameter string uvm_nv_copyright   = "(C) 2013-2014 NVIDIA Corporation";
    parameter string uvm_revision = `UVM_VERSION_STRING;
    
    function string uvm_revision_string();
      return {uvm_revision, ".Synopsys"}; // Modified by Verdi
    endfunction
    
    `endif // UVM_VERSION_SVH
    

    完整源码 · SHA256:3c69068a5460451e64367bdc1138fe0ce14dd8a204ad08c8440e56435ab3ca6f

    src/vcs-uvm-ieee-2020-2.0/macros/uvm_version_defines.svh
    `ifndef UVM_VERSION_DEFINES_SVH
    `define UVM_VERSION_DEFINES_SVH
    
       `define UVM_VERSION 2020
    
    
    // Title --NODOCS-- UVM Version Defines
    
    // Group --NODOCS-- UVM Version Ladder
    // The following defines are provided as an indication of 
    // how this implementation release relates to previous UVM 
    // implementation releases from Accellera.
    
       `define UVM_VERSION_POST_2017
       `define UVM_VERSION_POST_2017_1_0   
       `define UVM_VERSION_POST_2017_1_1
       `define UVM_VERSION_POST_2020_1_0
       `define UVM_VERSION_POST_2020_1_1
    
    // These defines are used in earlier versions of UVM
    // They are provided here with mappings relevant to IEEE 1800.2 2020 v2.0  
    //@back_compat   
      `define UVM_NAME UVM
    
      `define UVM_MAJOR_REV 2020
      `define UVM_MINOR_REV 2.0
    
      `define UVM_VERSION_STRING uvm_pkg::UVM_VERSION_STRING
    
      // Defines for `ifdefs
      `define UVM_POST_VERSION_1_1
      `define UVM_POST_VERSION_1_2
    
    
    `endif // UVM_VERSION_DEFINES_SVH
    

    完整源码 · SHA256:8fd50c4752a2d49dd6a3c35bdb8b36c770cec6fd97dc8c84cf69972fd9bc1bf4

    src/vcs-uvm-ieee-2020-2.0/base/uvm_version.svh
    `ifndef UVM_VERSION_SVH
    `define UVM_VERSION_SVH
    
    parameter string UVM_VERSION_STRING = "Accellera:1800.2-2020:UVM:2.0";
    
    function string uvm_revision_string();
      return UVM_VERSION_STRING;
    endfunction
    
    `endif // UVM_VERSION_SVH
    

    完整源码 · SHA256:1a5cdcdb45fe990bddbceb54572d950f7fb9eb84b418a71dae3529345b08f1bc

    术语解释 · 兼容配置

    返回Field Automation / 版本宏 · 迁移清单

    版本适用范围