跳转至

输入查询内容

    本页内容

    uvm_tree_printer.newline 字段私有化;uvm_table_printer::calculate_max_widths 删除

    影响范围

    访问 tree printer 的 newline,或调用 table printer 的 calculate_max_widths。

    具体差异

    uvm_tree_printer.newline 公开字段改名 protected m_newline(配 m_linefeed),直接写 my_tree_printer.newline = " " 的代码编译报错;table printer 的公开方法 calculate_max_widths() 删除(逻辑并入 pop_element);table/tree/line printer 构造函数由 new() 变为 new(string name="")(向后兼容),并全部 uvm_object_utils 注册进工厂。

    修改方案

    需要单行输出时使用 uvm_line_printer;自定义换行规则需在派生 printer 中实现并对照输出。set_separators 配置对象的起止分隔字符,不替代 newline。删除 calculate_max_widths() 调用后,验证目标自动列宽满足原输出契约。

    兼容措施与范围:旧 newline 公开字段和 calculate_max_widths 无兼容恢复;换行与列宽按实际输出需求处理。

    迁移后验证

    编译派生 printer 与调用方,用多层对象检查换行和列宽输出;外部直接字段访问应迁移到允许的配置路径。

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

    补充查阅

    扫描定位与记录结果

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

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

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2uvm_printer.svh:360string newline = "\n"; 公开)、uvm_printer.svh:333/uvm_printer.svh:1013(calculate_max_widths)

    VCS 内置 uvm-ieee-2020-2.0uvm_printer.svh:517protected string m_newline

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

    src/vcs-uvm-1.2/base/uvm_printer.svh
      protected int m_max_size;
      protected int m_max_value;
    
      extern function void calculate_max_widths();
    
    endclass
    
    
    //------------------------------------------------------------------------------
    //
    // Class: uvm_tree_printer
    //
    // By overriding various methods of the <uvm_printer> super class,
    // the tree printer prints output in a tree format.
    //
    // The following shows sample output from the tree printer.
    //
    //|  c1: (container@1013) {
    //|    d1: (mydata@1022) {
    

    src/vcs-uvm-1.2/base/uvm_printer.svh
    class uvm_tree_printer extends uvm_printer;
    
      string newline = "\n";
    
      // Variable: new
      //
      // Creates a new instance of ~uvm_tree_printer~.
    
      extern function new();
    
      // Function: emit
      //
      // Formats the collected information from prior calls to ~print_*~
      // into hierarchical tree format.
      //
      extern virtual function string emit();
    
    endclass
    

    src/vcs-uvm-1.2/base/uvm_printer.svh
    // calculate_max_widths
    // --------------------
    
    function void uvm_table_printer::calculate_max_widths();
       m_max_name=4;
       m_max_type=4;
       m_max_size = 4;
       m_max_value= 5;
       foreach(m_rows[j]) begin
          int name_len;
          uvm_printer_row_info row = m_rows[j];
          name_len = knobs.indent*row.level + row.name.len();
          if (name_len > m_max_name)
            m_max_name = name_len;
          if (row.type_name.len() > m_max_type)
            m_max_type = row.type_name.len();
          if (row.size.len() > m_max_size)
            m_max_size = row.size.len();
          if (row.val.len() > m_max_value)
    

    完整源码 · SHA256:3a007c7a488ef1943aa1bfce8bb945eaa32c3023170f6c35ce6358f5f6f5a378

    src/vcs-uvm-ieee-2020-2.0/base/uvm_printer.svh
    // @uvm-ieee 1800.2-2020 auto 16.2.11.1
    class uvm_tree_printer extends uvm_printer;
    
      protected string m_newline = "\n";
      protected string m_linefeed ;
    
         // @uvm-ieee 1800.2-2020 auto 16.2.11.2.2
         `uvm_object_utils(uvm_tree_printer)
      // Variable -- NODOCS -- new
      //
      // Creates a new instance of ~uvm_tree_printer~.
    
      // @uvm-ieee 1800.2-2020 auto 16.2.11.2.1
      extern function new(string name="");
    
      // @uvm-ieee 1800.2-2020 auto 16.2.11.2.3
      extern static function void set_default(uvm_tree_printer printer) ;
    
      // @uvm-ieee 1800.2-2020 auto 16.2.11.2.4
    

    完整源码 · SHA256:960f0c18aee9036a3261b2108183dc85b3cf572d1912605325c6b595f4b9aaef

    术语解释 · 兼容配置

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

    版本适用范围