How to put unpacked array to systemverilog mailbox

In reply to peterjin:

The IEEE 1800-2017 SystemVerilog LRM
in section 15.4 Mailboxes says you can only put singular data types into a mailbox. Some tools allow any type if the mailbox is parameterized. I strongly suggest you always use parameterized mailboxes instead of a generic mailbox for type safety— you will thank me later.

The LRM complaint way of doing this is wrapping the array in a class.

typedef bit[255:0] matrix_t[32];
class array_wrapper;
  matrix_t a;
endclass

class my_class; 
mailbox #(array_wrapper) mb_matrix_a;
function new;
  mb_matrix_a=new();
endfunction
 
task my_task;
  array_wrapper aw;
  aw = new;
  for(int i=0;i<32;i++)
    aw.matrix_a[i]=256'b0;
  mb_matrix_a.put(aw);
endtask