In reply to Etrx91:
- The correct result is randomize should fail. There are no elements to sum, so how could it ever equal 27?
- You are bitstream casting the 2nd dimension to an int. So if there were any elements in that dimension, they get concatenated to a single int
- The ()'s after sum is where you can change item. You can write
box.sum(item1d) with (item1d.sum(item2d) with (item2d));
- SystemVerilog does not really have multidimensional array, it has arrays of arrays. So there is no simpler way to size the dimensions.
- No.
- You can flatten your array to a single dimension.