Function return array

In reply to anil tirumalasetty:

Try this code please:

module top;
  import uvm_pkg::*;
  `include "uvm_macros.svh"

  
  typedef bit [7:0] byte_da_t[];
         
  function byte_da_t payl(int length,int data_size,int data[]);
    byte_da_t temp_payload;
    
    logic [31:0][7:0] temp_data;//varible(packed array) used to to convert 256 bit data in to 8 bit form
    int a;
    payl = new[length];
    a =0;
   
    temp_payload = new[length];
    for(int i=0;i<data_size;i++)begin
        temp_data = data[i];//data is 256 bit array
        for(int j=0;(j<32 && a<length);j++)begin
           temp_payload[a] = temp_data[j];
           `uvm_info("TEMP_PAYLOAD",$sformatf("temp_payload[%0d]    :   %0h",a,temp_payload[a]),UVM_HIGH)
           `uvm_info("TEMP_DATA",$sformatf("tmp[%0d]       :   %0h",j,temp_data[j]),UVM_HIGH)
           a++;
        end
    end
      return temp_payload;
  endfunction : payload_calc
  
  initial begin
    
  end  
  
endmodule