Can we pass an array to a covergroup as argument

hi,

I got a position where i need to pass an array as argument to covergroup. is it possible?
if yes, please give one example for explanation.

thanks
sandeep k

Yes, but you will need to reduce the array to a single integral expression by using one of the array reduction operators or comparing it with another array of an equivalent type.

module top;
   bit [2:0] v [31:0];
 covergroup maskbit(ref bit [2:0] vector [31:0]);
   pos: coverpoint vector.and();
   
 endgroup 
   maskbit gga; 

 initial begin
      gga = new(v);
  end
endmodule

In reply to dave_59:

hi Dave!
i’v the same question but dipper…
i’m trying to follow the above but i’m getting syntax error message.
this is the code i’m trying to compile:

covergroup CON_COV (string cg_name = "con_cov") with function sample (bit con_array[$][$][$][$][$]);
EXAMPLE0_COVPOINT : coverpoint con_array[0][0][0][0][0]
        {
            DONE     = {1};
            NOT_DONE = {0};
        }
EXAMPLE1_COVPOINT : coverpoint con_array[0][0][0][1][0]
        {
            DONE     = {1};
            NOT_DONE = {0};
        }
EXAMPLE2_COVPOINT : coverpoint con_array[0][0][1][0][0]
        {
            DONE     = {1};
            NOT_DONE = {0};
        }
endgroup

i’m getting this error:
Error-[SE] Syntax error
Following verilog source has syntax error :
“EXAMPLE.sv”,
39: token is ‘DONE’
DONE = {1};
^

what is my mistake?
thanks! - Chaim

In reply to gotlibhaim:
You are missing the bins keyword.

In reply to dave_59:

OMG LOL…
thanks!