Difference between Packed and UnPacked Arrays

In reply to yt:

Explanation is indeed very good, last example is mistaken though. It would be the third unpacked element. Also the endianing for the packed dimensions should be inverted as it is declared [2:0] and not [0:2]

2    1    0 <----Packed dimensions
0000 0000 0000      0   Unpacked dimension
0000 0000 0000      1       |
0000 1010 0000      2       |
0000 0000 0000      3       |
0000 0000 0000      4       |

See example below


module tb;
initial
  begin
    
    static bit [2:0][3:0]a[5] = '{default:$random};
    $display("a=%p",a);

    $display("a[4]   =12'h%h",a[4]);
    $display("a[0][2]=4'h%h",a[0][2]);
    $display("a[0][1]=4'h%h",a[0][1]);
    $display("a[0][0]=4'h%h",a[0][0]);
    $display("a[4][0]=4'h%h",a[4][0]);
  end
endmodule

a='{'h419, 'h3dd, 'h521, 'hd6d, 'hdc9}
a[4]   =12'hdc9
a[0][2]=4'h4
a[0][1]=4'h1
a[0][0]=4'h9
a[4][0]=4'h9