In reply to J_M:
You can add the enum values into a queue and then you can create the transition bins something like this
Probably there are more efficient ways of achieving the same, and also some simulators may not support it, anyways hope it helps
module test();
typedef enum {
ADD,
SUBSTRACT,
MULTIPLY,
DIVIDE
} operation_t;
operation_t ops;
//queue to get the enums
typedef operation_t ops_queue[$];
covergroup cg(ops_queue m_ops_q);
ops_transition_cp: coverpoint ops {
//transitions between the first and last enum and all combinations
bins transitions[]= ([m_ops_q[0] : m_ops_q[$]] => [m_ops_q[0] : m_ops_q[$]]);
}
endgroup
//logic to put all enums in a queue to be used for transitions
function automatic ops_queue get_ops();
ops_queue m_ops_q;
operation_t op = op.first();
m_ops_q.push_back(op.first());
m_ops_q.push_back(op.last());
$display("m_ops_q %p", m_ops_q);
return m_ops_q;
endfunction
initial begin
ops_queue ops;
cg m_cg;
ops = get_ops();
m_cg = new(ops);
repeat(10) begin
if(!std::randomize(ops)) $fatal(1,"Randomize failure");
m_cg.sample();
end
$display("m_cg.get_coverage = %0.2f%%", m_cg.get_coverage());
end
endmodule
I think in the GUI all transitions are shown