SV function to split 9x9 multidimensional array into 3x3 arrays

In reply to n347:
much better

module top;
   typedef bit [3:0] array3x3[3][3];// there will be 9 3x3 arrays output
   typedef bit [3:0] array9x9[9][9];
   array9x9 in_game = '{
			{1, 3, 2, 5, 7, 9, 4, 6, 8},
			{4, 9, 8, 2, 6, 1, 3, 7, 5},
			{7, 5, 6, 3, 8, 4, 2, 1, 9},
			{6, 4, 3, 1, 5, 8, 7, 9, 2},
			{5, 2, 1, 7, 9, 3, 8, 4, 6},
			{9, 8, 7, 4, 2, 6, 5, 3, 1},
			{2, 1, 4, 9, 3, 5, 6, 8, 7},
			{3, 6, 5, 8, 1, 7, 9, 2, 4},
			{8, 7, 9, 6, 4, 2, 1, 5, 3}
			};
   array3x3 out_game[9];
   
   function automatic void split_fn(input array9x9 in, output array3x3 out[9]);
      foreach(out[chunk]) begin
	 int x = chunk % 3;
	 int y = chunk / 3 % 3;
	 for(int i=0; i<3;i++)
	   out[chunk][i] = in[y*3+i][x*3+:3];
      end
   endfunction : split_fn
   initial begin
      split_fn(in_game, out_game);
      foreach(out_game[i]) $display("%d\n%p", i, out_game[i]);
   end
endmodule : top