Parameter over-ride of array

**One of the annoying things of system verilog paramteter array is that only unpacked arrays are supported. So the override becomes cumbersome. Is there a better way to do the following:
The compiler doesn’t like the way I override the MASK. I am not sure what I am doing wrong here by creating the list for override. If NUM_DATA is large then is there an easier way to create the MASK for the override.

Thanks

Noel

module data_array
  #(
    parameter int NUM_DATA                                      = 2,
    parameter int DATA_WIDTH                                    = 32,
    parameter logic [DATA_WIDTH-1):0] DATA_MASK [(NUM_DATA-1):0]= '{'1, '1},
    )
   (
 
    output reg [(NUM_DATA-1):0] [(DATA_WIDTH-1):0] reg_data

    );
endmodule

module instance   #(
    parameter int NUM_DATA                                      = 2,
    parameter int DATA_WIDTH                                    = 32,
)(
 output logic [(NUM_DATA-1):0] [(DATA_WIDTH-1):0] reg_data

);

   localparam NUM_DATA = 3;
   localparam DATA_MASK = '{32'hDEAD_BEEF, 32'hFFFF_FFFF, 32'hAAAA_AAAA};

      data_array
     #(
       .NUM_DATA       ( NUM_DATA  ),
       .DATA_WIDTH     ( DATA_WIDTH),
       .DATA_MASK      ( DATA_MASK )
       )
   data_array
     (

      .reg_data     ( reg_data )

      );


endmodule

**

In reply to noel:
I am not sure what you mean by “only unpacked arrays are supported”. Parameters can be declared with any data type. Your parameter DATA_MASK is an unpacked array of a packed array.

Your problem is not with the override, but the way you declared localparam DATA_MASK. You declared localparam DATA_MASK without an explicit data type, and it is supposed to pick up the data type from the RHS of the assignment. But you have an assignment pattern on the RHS which requires a data type context from the LHS, which does not exist. The way you declared parameter DATA_MASK is correct. You just need to declare localparam DATA_MASK the same way

module data_array
  #(
    parameter int NUM_DATA                                      = 2,
    parameter int DATA_WIDTH                                    = 32,
    parameter logic [DATA_WIDTH-1:0] DATA_MASK [NUM_DATA-1:0]= '{'1, '1}
  )
  (
    output reg [NUM_DATA-1:0] [DATA_WIDTH-1:0] reg_data
  );
endmodule
 
module inst #(
  parameter int NUM_DATA                                      = 3,
  parameter int DATA_WIDTH                                    = 32
)
  (
    output logic [(NUM_DATA-1):0] [DATA_WIDTH-1:0] reg_data
  );
  localparam logic [DATA_WIDTH-1:0] DATA_MASK [NUM_DATA-1:0] = '{32'hDEAD_BEEF, 32'hFFFF_FFFF, 32'hAAAA_AAAA};
  data_array #(
    .NUM_DATA       ( NUM_DATA  ),
    .DATA_WIDTH     ( DATA_WIDTH),
    .DATA_MASK      ( DATA_MASK )
  )
  data_array (
    .reg_data
  );
 
endmodule

In reply to dave_59:

Thanks Dave. My mistake. What I meant was can I do the following (and this is for code that needs to be synthesized):

In the module data_array
parameter logic [(NUM_DATA-1):0][DATA_WIDTH-1):0] DATA_MASK = '{'1} // its a packed array here
In module instance
localparam logic [NUM_DATA-1:0] [DATA_WIDTH-1:0] DATA_MASK = '{32’hDEAD_BEEF, 32’hFFFF_FFFF, 32’hAAAA_AAAA};

So if I need to have all 1’s then I could say '1 and in the instance does the override have to be a list or can I just say '1. I was trying to see if the number are large like 100 then listing each would be tedious.

In reply to noel:

You can write

localparam logic [NUM_DATA-1:0] [DATA_WIDTH-1:0] DATA_MASK = '{default:'1};