Declare cross coverage with condition

Hello,

I have a script which get list of signals and create a covergroup, the covergroup declare a cverpoint to every signal, and now I want to add a cross between all the coverpoint with one of the coverpoint that will be defined by the user with `define statement.
for this I need to know if there a way to use generate statement into a covergroup and if there a way to ask if coverpoint is equal to other coverpoint.

that should be seems something like this:

covergroup covergroup_cg;

`define user_cp cp_2
cp_1: coverpoint sig1;
cp_2: coverpoint sig2;
cp_3: coverpoint sig3;

generate if (`user_cp != cp_1)  cross `user_cp, cp_1; endgenerate
generate if (`user_cp != cp_2)  cross `user_cp, cp_2; endgenerate
generate if (`user_cp != cp_3)  cross `user_cp, cp_3; endgenerate

endgroup

Is there a way to implement something like this?
it include two questions.

  1. use generate inside a covergroup
  2. ask if coverpoint equal to the other

or Is there other way to declare cross coverage with condition.

Thanks

In reply to rraa:

You cannot use a generate inside another declaration (except in the declaration of a module or interface. And you cannot compare coverpoint using equality.

There is no rule against crossing a coverpoint with itself, but most tools generate warnings to catch typos. Crossing a coverpoint with itself is redundant with the coverpoint by itself.

You can have your script generate code using another macro and `ifndef’s instead of generate

`define cross_cp(n) \
`define cp_``n \
`define user_cp cp_``n

covergroup covergroup_cg;
  cp_1: coverpoint sig1;
  cp_2: coverpoint sig2;
  cp_3: coverpoint sig3;
`cross_cp(2)
`ifndef cp_1 cross `user_cp, cp_1; `endif
`ifndef cp_2 cross `user_cp, cp_2; `endif
`ifndef cp_3 cross `user_cp, cp_3; `endif
endgroup