Sampling covergroup when a FSM state ends

In reply to Ariel Elliassi:

The elegant way is using a cover directive instead of a covergroup

cover property (@(posedge clk) cur_state==STATE_1 |-> cur_state!=STATE_1[->1]);

But if this code needs be be in a class, you will have to resort to less elegant ways.

You could use a range if that works out for your states

bins end_state_1 = (STATE_1 => [STATE_2:STATE_N]);