Specifying "ignore_bins = <everything else>" in coverpoint bins

I’m covering values defined as ‘typedef enum’. Some of them have dozens of
members (enum values), but i only want to cover a few of them in most
contexts.

I usually want the majority of the values to be in ignore_bins and/or
illegal_bins. So what i’d like to do would look something like this:

----------------------------------------------

typedef enum { A, B, C, …, P } color_t;
color_t sampledColor;

covergroup aardvark_cg;
color_cp : coverpoint sampledColor {
bins A_cp = { A };
bins B_cp = { B };
bins C_cp = { C };
ignore_bins = ;
}
endgroup

----------------------------------------------

I’m going to need to do a lot of this type of thing, so want to avoid
having to specify everything like this:

ignore_bins = { D, E, F, G, H, I, J, K, L, M, N, O, P };

Harder to read (with the actual enum names), and much harder to maintain.
I’ve tried a variety of syntaxes to simplify this, but can’t find anything
that works.

I’ve also tried creating sets of things i want to be ignored or illegal in
various places, then using that in my ignore_bins/illegal_bins statements:

// Tried both with/without the "`".
color_t IgnoredColors[13] = '{ D, E, F, ..., P };
...
ignore_bins = IgnoredColors;

This doesn’t work.

The only thing that i’ve found to work so far is using macros. Want to get
away from that for reasons beyond my control.

It seems like this must be something provided for in the standard, but i
can’t figure out how to do it. Any suggestions?

Thanks in advance.

You don’t need to explicitly ignore_bins when you are explicit about the bins you do want to cover.

In reply to dave_59:

What about if I wanted to make all the rest of the bins illegal instead of ignoring them. Is that possible to do?

In reply to jogile:

A covergroup should not take the place of an assertion. An illegal_bin does not have all the reporting and filtering capabilities that an assertion has. It was a feature leftover from another language that did not have assertions. It should only be used as a debugging aid.

If you insist, you can use the bin with clause

bins good[] = sampledColor with (item inside {LIST});
illegal_bin bad[] = sampledColor with (!(item inside {LIST});

In reply to dave_59:

Thanks for your answer Dave, debugging is exactly what I will be using it for.

In reply to dave_59:

hi,
i tried this syntax and got " Semicolon (‘;’) symbol is not specified. (in ActNCVerilogPostProcess.pm:237)

            bins port_type[]     = PortTypeFec with (item inside {TestedTypes});

TestedTypes is a SystemVerilog queue - is there a problem in the syntax?

thanks is advance.

In reply to kobiyonai:

Many syntax error result from problems before the line the error message points to. What is PortTypeFec?

In reply to dave_59:

In reply to kobiyonai:
Many syntax error result from problems before the line the error message points to. What is PortTypeFec?

PortTypeFec is a struct PortTypeFec_s

typedef struct packed {
    PHY_TECH phy_tec;
    FEC_TYPE fec;

} PortTypeFec_s;


typedef PortTypeFec_s PortTypeFecQ[$];

PortTypeFecQ TestedTypes;

Hi Dave,
in this case the coverage tool will show you all unwanted values (possibles bins), I want to see only what I have specified (A_cp, B_cp, C_cp as in the above example)?

In reply to Mohamed_TN:

Don’t use ignore_bins or default.