跳转至

输入查询内容

    本页内容

    选择 sequence 前检查候选集边界

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

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

    修改前后对比

    观察内容 1.2 旧写法 2.0 旧写法 1.2 改写后 2.0 改写后
    候选索引上限缩减为 0 后实际返回的索引 shrinking_max_selection 0 3 0 0

    运行命令

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

    uv run tools/run_uvm_review.py --case library_migrated --variants 12,20
    

    旧写法运行命令

    uv run tools/run_uvm_review.py --case library_probe --variants 12,20
    

    最小源码

    library_migrated.sv

    library_migrated.sv
    `timescale 1ns/1ps
    `include "uvm_macros.svh"
    import uvm_pkg::*;
    class bounded_library extends uvm_sequence_library#(uvm_sequence_item);
      int unsigned next_index;
      function new(string name="bounded_library"); super.new(name); endfunction
      virtual function int unsigned select_sequence(int unsigned max);
        if (next_index > max) next_index = 0;
        select_sequence = next_index;
        next_index = next_index == max ? 0 : next_index + 1;
      endfunction
    endclass
    module library_migrated;
      initial begin
        bounded_library lib = new("lib");
        int selected;
        repeat(3) selected = lib.select_sequence(3);
        $display("REVIEW|shrinking_max_selection|%0d", lib.select_sequence(0));
        $display("REVIEW|done|1");
        $finish;
      end
    endmodule
    

    全部用例 · 证据摘要

    版本适用范围