verilator/test_regress/t/t_covergroup_trans_3value.v

43 lines
1.2 KiB
Systemverilog

// DESCRIPTION: Verilator: Test transition bins - 3-value sequences
// Known limitation: multi-value (3+) transition bins generate incomplete case
// statements; complex transitions are not fully supported.
// This file ONLY is placed into the Public Domain, for any use, without warranty.
// SPDX-FileCopyrightText: 2025 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
module t;
logic [2:0] state;
covergroup cg;
cp_state: coverpoint state {
bins trans_3val = (0 => 1 => 2); // 3-value sequence
bins trans_3val_2 = (2 => 3 => 4); // Another 3-value sequence
}
endgroup
cg cg_inst = new;
initial begin
// Test sequence 1: 0 => 1 => 2 (should complete trans_3val)
state = 0;
cg_inst.sample();
state = 1; // 0 => 1 (state machine now at position 1)
cg_inst.sample();
state = 2; // 1 => 2 (completes trans_3val: 0=>1=>2)
cg_inst.sample();
// Test sequence 2: 2 => 3 => 4 (should complete trans_3val_2)
state = 3; // 2 => 3 (state machine now at position 1 for trans_3val_2)
cg_inst.sample();
state = 4; // 3 => 4 (completes trans_3val_2: 2=>3=>4)
cg_inst.sample();
$write("*-* All Finished *-*\n");
$finish;
end
endmodule