跳转至

输入查询内容

    本页内容

    VCS 定制改写:覆盖率声明、数组录制、显式时间与资源追踪

    环境:VCS W-2024.09-SP2-8。1.2 使用 uvm-1.2,2.0 使用 uvm-ieee-2020-2.0

    实验检查观察值是否符合预期;成功复现问题不代表问题已修复。

    结果对比

    本组配置:+UVM_RESOURCE_DB_TRACE

    观察内容 UVM 1.2 UVM 2.0
    构造后同时支持所声明的两种覆盖率(1=是) vendor_bank_has 1 1
    FIELD_VALS 与 REG_BITS 是否开启(1=开启) vendor_bank_enabled 1:0 1:0
    记录项数、值之和、最后字段名称 vendor_record_fields 2:33:data[1] 2:33:data[1]
    显式传入的整数时间读回值(time 单位) vendor_record_time 7 7
    显式开启后的 Resource DB 追踪状态(1=开启) vendor_resource_trace 1 1

    运行命令

    目录与环境准备;从解包根目录执行:

    uv run tools/run_uvm_review.py --case vendor_migration_probe --variants 12,20 --plusarg +UVM_RESOURCE_DB_TRACE
    

    最小源码

    vendor_migration_probe.sv

    vendor_migration_probe.sv
    `timescale 1ns/1ps
    `include "uvm_macros.svh"
    import uvm_pkg::*;
    
    class bounded_record_item extends uvm_object;
      int data[] = '{11, 22, 33, 44};
      int unsigned record_limit = 2;
      function new(string name = "bounded_record_item"); super.new(name); endfunction
      // data is deliberately not registered with a uvm_field_* macro.
      function void do_record(uvm_recorder recorder);
        super.do_record(recorder);
        foreach (data[i]) begin
          if (i >= record_limit) break;
          recorder.record_field_int($sformatf("data[%0d]", i), data[i], 32, UVM_DEC);
        end
      endfunction
    endclass
    
    class count_text_recorder extends uvm_text_recorder;
      int fields;
      int sum;
      string last_name;
      function new(string name = "count_text_recorder"); super.new(name); endfunction
      protected virtual function void do_record_field_int(string name, uvm_integral_t value,
                                                          int size, uvm_radix_enum radix);
        fields++;
        sum += value;
        last_name = name;
        super.do_record_field_int(name, value, size, radix);
      endfunction
    endclass
    
    module vendor_migration_probe;
      initial begin
        uvm_reg_cvr_t supported = UVM_CVR_REG_BITS | UVM_CVR_FIELD_VALS;
        snps_uvm_reg_bank_group bank = new("bank", null, supported);
        bounded_record_item item = new();
        count_text_recorder counter = new();
        uvm_text_tr_database db = new("db");
        uvm_tr_stream stream;
        uvm_recorder recorder;
        #1;
        $display("REVIEW|vendor_bank_has|%0d", bank.has_coverage(supported));
        void'(bank.set_coverage(UVM_CVR_FIELD_VALS));
        $display("REVIEW|vendor_bank_enabled|%0d:%0d", bank.get_coverage(UVM_CVR_FIELD_VALS), bank.get_coverage(UVM_CVR_REG_BITS));
        stream = db.open_stream("stream", "scope", "type");
        counter.m_do_open(stream, 7, "type");
        item.record(counter);
        $display("REVIEW|vendor_record_fields|%0d:%0d:%s", counter.fields, counter.sum, counter.last_name);
        counter.close();
        counter.free();
        recorder = stream.open_recorder("explicit_time", 7, "type");
        $display("REVIEW|vendor_record_time|%0d", recorder.get_open_time());
        recorder.close();
        recorder.free();
        stream.close();
        stream.free();
        void'(db.close_db());
        $display("REVIEW|vendor_resource_trace|%0d", uvm_resource_db_options::is_tracing());
        $display("REVIEW|done|1");
      end
    endmodule
    

    全部用例 · 证据摘要

    版本适用范围