Field macro for two dimensional array

Hi,

What field macro should i use for a two dimensional dynamic array?

For example, I am having transaction class which contains the two dimensional dynamic array “arr”. I have registered it with the factory using the field macro “uvm_field_array_int”.

class mem_seq_item extends uvm_sequence_item;
  rand bit [7:0] address;
  rand bit [7:0] data_in;
  rand bit [7:0] data_out;
  rand bit we;
  
  rand bit [23:0] arr [][];
   
  `uvm_object_utils_begin(mem_seq_item)
    `uvm_field_int(address, UVM_DEFAULT)
    `uvm_field_int(data_in, UVM_DEFAULT)
    `uvm_field_int(data_out, UVM_DEFAULT)
    `uvm_field_int(we, UVM_DEFAULT)
    `uvm_field_array_int(arr, UVM_DEFAULT) 
  `uvm_object_utils_end
  
  function new(string name = "uvm_seq_item");
    super.new(name);
  endfunction
endclass

I am getting the following error:
Error: running_uvm_example.sv(89): Arg. ‘lhs’ of ‘compare_field’: Illegal assignment to type ‘reg signed[4095:0]’ from type ‘bit[23:0] []': Cannot assign an unpacked type to a packed type. ** Error: running_uvm_example.sv(89): Arg. 'rhs' of 'compare_field': Illegal assignment to type 'reg signed[4095:0]' from type 'bit[23:0] ’: Cannot assign an unpacked type to a packed type.
** Error: running_uvm_example.sv(89): Arg. ‘value’ of ‘pack_field_int’: Illegal assignment to type ‘reg[63:0]’ from type ‘bit[23:0] []': Cannot assign an unpacked type to a packed type. ** Error: running_uvm_example.sv(89): Arg. 'value' of 'pack_field': Illegal assignment to type 'reg signed[4095:0]' from type 'bit[23:0] ’: Cannot assign an unpacked type to a packed type.
** Error: running_uvm_example.sv(89): Case item comparison: Illegal assignment to type ‘bit[23:0] []' from type 'reg[63:0]': Cannot assign a packed type to an unpacked type. ** Error: running_uvm_example.sv(89): Case item comparison: Illegal assignment to type 'bit[23:0] ’ from type ‘reg signed[4095:0]’: Cannot assign a packed type to an unpacked type.
** Error: running_uvm_example.sv(89): Arg. ‘value’ of ‘record_field’: Illegal assignment to type ‘reg signed[4095:0]’ from type ‘bit[23:0] []': Cannot assign an unpacked type to a packed type. ** Error: running_uvm_example.sv(89): Arg. 'value' of 'record_field': Illegal assignment to type 'reg signed[4095:0]' from type 'bit[23:0] ’: Cannot assign an unpacked type to a packed type.
** Error: running_uvm_example.sv(89): Arg. ‘value’ of ‘record_field’: Illegal assignment to type ‘reg signed[4095:0]’ from type ‘bit[23:0] []': Cannot assign an unpacked type to a packed type. ** Error: running_uvm_example.sv(89): Arg. 'value' of 'print_int': Illegal assignment to type 'reg signed[4095:0]' from type 'bit[23:0] ’: Cannot assign an unpacked type to a packed type.
** Error: running_uvm_example.sv(89): Arg. ‘value’ of ‘print_int’: Illegal assignment to type ‘reg signed[4095:0]’ from type ‘bit[23:0] []': Cannot assign an unpacked type to a packed type. ** Error: running_uvm_example.sv(89): Case item comparison: Illegal assignment to type 'bit[23:0] ’ from type ‘reg signed[4095:0]’: Cannot assign a packed type to an unpacked type.
** Error: running_uvm_example.sv(89): Case item comparison: Illegal assignment to type ‘bit[23:0] []' from type 'reg signed[4095:0]': Cannot assign a packed type to an unpacked type. -- Compiling interface intf ** Error: running_uvm_example.sv(89): Arg. 'lhs' of 'compare_field': Illegal assignment to type 'reg signed[4095:0]' from type 'bit[23:0] ’: Cannot assign an unpacked type to a packed type.
** Error: running_uvm_example.sv(89): Arg. ‘rhs’ of ‘compare_field’: Illegal assignment to type ‘reg signed[4095:0]’ from type ‘bit[23:0] []': Cannot assign an unpacked type to a packed type. ** Error: running_uvm_example.sv(89): Arg. 'value' of 'pack_field_int': Illegal assignment to type 'reg[63:0]' from type 'bit[23:0] ’: Cannot assign an unpacked type to a packed type.
** Error: running_uvm_example.sv(89): Arg. ‘value’ of ‘pack_field’: Illegal assignment to type ‘reg signed[4095:0]’ from type ‘bit[23:0] []': Cannot assign an unpacked type to a packed type. ** Error: running_uvm_example.sv(89): Case item comparison: Illegal assignment to type 'bit[23:0] ’ from type ‘reg[63:0]’: Cannot assign a packed type to an unpacked type.
** Error: running_uvm_example.sv(89): Case item comparison: Illegal assignment to type ‘bit[23:0] []' from type 'reg signed[4095:0]': Cannot assign a packed type to an unpacked type. ** Error: running_uvm_example.sv(89): Arg. 'value' of 'record_field': Illegal assignment to type 'reg signed[4095:0]' from type 'bit[23:0] ’: Cannot assign an unpacked type to a packed type.
** Error: running_uvm_example.sv(89): Arg. ‘value’ of ‘record_field’: Illegal assignment to type ‘reg signed[4095:0]’ from type ‘bit[23:0] []': Cannot assign an unpacked type to a packed type. ** Error: running_uvm_example.sv(89): Arg. 'value' of 'record_field': Illegal assignment to type 'reg signed[4095:0]' from type 'bit[23:0] ’: Cannot assign an unpacked type to a packed type.
** Error: running_uvm_example.sv(89): Arg. ‘value’ of ‘print_int’: Illegal assignment to type ‘reg signed[4095:0]’ from type ‘bit[23:0] []': Cannot assign an unpacked type to a packed type. ** Error: running_uvm_example.sv(89): Arg. 'value' of 'print_int': Illegal assignment to type 'reg signed[4095:0]' from type 'bit[23:0] ’: Cannot assign an unpacked type to a packed type.
** Error: running_uvm_example.sv(89): Case item comparison: Illegal assignment to type ‘bit[23:0] []' from type 'reg signed[4095:0]': Cannot assign a packed type to an unpacked type. ** Error: running_uvm_example.sv(89): Case item comparison: Illegal assignment to type 'bit[23:0] ’ from type ‘reg signed[4095:0]’: Cannot assign a packed type to an unpacked type.

In reply to shankar_logic:

It seems UVM automation macros don’t support 2 dimensions dynamic array. You can refer the supported list:
https://verificationacademy.com/verification-methodology-reference/uvm/docs_1.1c/html/files/macros/uvm_object_defines-svh.html

And using `uvm_field_* is not recommended. Here is the reason:
https://verificationacademy.com/cookbook/macrocostbenefit