Transition Coverage

Statical values are good, but verifying sequences (A followed by B) is better. Transition coverage allows you to track value changes over consecutive sample events.

Basic Transitions (=>)

Use the => operator inside a bin definition to specify a sequence.

covergroup cg_fsm @(posedge clk);
    cp_state: coverpoint state {
        // Did we go from IDLE (0) directly to BUSY (1)?
        bins idle_to_busy = (0 => 1);
        
        // Did we go from BUSY (1) back to IDLE (0)?
        bins busy_to_idle = (1 => 0);
    }
endgroup

Complex Sequences

You can chain multiple steps and use ranges.

cp_sequence: coverpoint data {
    // 3-step sequence: 0 -> 1 -> 2
    bins count_up = (0 => 1 => 2);

    // Any value from 0-3 followed by any value from 4-7
    bins low_to_high = ([0:3] => [4:7]);
    
    // Repetition: 1, followed by 1 (at least twice)
    bins stable_high = (1 [* 2]); 
    
    // Goto: 1, then anything, then 3 (non-consecutive)
    bins one_eventually_three = (1 => ... => 3); 
}

Note

Transition coverage is strictly synchronous to the sampling event of the covergroup.

Common Interview Questions

Q: Can I use wildcards in transition bins?
No, you cannot explicitly use a wildcard character like `*` inside the transition sequence in the same way you might expect. However, you can list multiple values or ranges locally, e.g., `(0,1,2 => 3)`.
Q: What is the difference between (0=>1) and (0,1)?
(0 => 1) is a temporal transition: Value 0 at time T, then Value 1 at time T+1. (0, 1) is a set: Value 0 OR Value 1 at any time T.