covergroup cg_multi_layer (ref int layer0_index, int layer1_index, input int size);
cp_layer0: coverpoint layer0_index {
bins id[]={[0:size]};
}
cp_layer1: coverpoint layer1_index {
bins id[]={[0:size]};
}
cx_layers : cross cp_layer0, cp_layer1;
endgroup
在new function中,準備所需要的sequence queue, 然後random
seq_q.push_back("xxx0"); ...
layer[0] = $urandom_range(seq_q.size()-1, 0);
layer[1] = $urandom_range(seq_q.size()-1, 0);
cg_multi_layer = new(layer[0], layer[1], seq_q.size()-1); // 也可以使用string表示