Cross coverage for unpacked array elements

Hi,

I’m running into compilation issue when I tried to write cross coverage on unpacked array elements (mod[0], mod[1]) with other cover points. Is there any other way to achieve this.

covergroup cg_cmd();
cp_mod_0 : coverpoint mod[0];
cp_mod_1 : coverpoint mod[1];
cp_size : coverpoint size;
cp_cmd : coverpoint cmd;
cross_cmd_size_mod_0_mod_1 : cross cmd, size, mod[0], mod[1];
endgroup

Thanks for help.

In reply to vdev:

Use the coverpoint labels instead of the expression.

cross_cmd_size_mod_0_mod_1 : cross cp_cmd, cp_size, cp_mod_0, cp_mod_1;

In reply to dave_59:

Thanks Dave. It works. Appreciate your quick response.

I have a followup question. If my cmd had multiple types (ex. add/inc/sub…) but my mod are only supported for only add is there a directed way to write cross coverpoint instead of cross entire cmd and add ignore bins ?

something like: cross_cmd_mod_0_mod_1 : cross (cmd==add), cp_mod_0, cp_mod_1;

You can try this way.

In reply to vdev:


covergroup cg_cmd();
cp_mod_0 : coverpoint mod[0];
cp_mod_1 : coverpoint mod[1];
cp_size : coverpoint size;
cp_cmd : coverpoint cmd
         {  bins sum = {add};
            bins others[] = {sub,mul,div};
          }
cross_cmd_size_mod_0_mod_1 : cross cp_cmd, cp_mod_0, cp_mod_1
                           {bins add_mod0_mod1 = binsof(cp_cmd.sum) && binsof(cp_mod_0) &&       binsof(cp_mod_1);}
endgroup