Coverpoint for an Unpacked Array

I have an unpacked array which stores the clock cycle difference between req and ack for 4 separate channels simultaneously. I want to check the coverage for all 4 channels collectively. I get the following error for the following code.
“An expression with an unpacked array datatype is not allowed in this context”



int CHANNEL WIDTH = 4;
int req_to_ack_cycles [CHANNEL_WIDTH]; 

covergroup cg1;

    req_to_ack_cycles: coverpoint req_to_ack_cycles {} 

endgroup: cg1


covergroup cg1;
 
    req_to_ack_cycles: coverpoint {req_to_ack_cycles[0], req_to_ack_cycles[1], req_to_ack_cycles[2], req_to_ack_cycles[3]} 
 
endgroup: cg1

May be above would work.

In reply to the_ceylonese:

what you could do is create an array of covergroups

int CHANNEL WIDTH = 4;
int req_to_ack_cycles [CHANNEL_WIDTH]; 
 
covergroup cg1 with function sample(int req_to_ack_cycle);
 
    coverpoint req_to_ack_cycle
        { bins = ... } // I assume you have specific bins to construct 
endgroup: cg1

cg1 cg_channel[CHANNEL_WIDTH];

foreach(cg_channel[ii]) ch_channel[ii] = new();
//then when sampling
foreach(cg_channel[ii]) ch_channel[ii].sample( req_to_ack_cycles[ii] );

Can you elaborate on what this line does? Is there documentation on covergroup somewhere that covers the different options such as this?

covergroup cg1 witth function sample(int req_to_ack_cycle);

In reply to dillanmills:
See Section 19.8.1 Overriding the built-in sample method in the IEEE 1800-2012 LRM.