Packed array to unpacked array and vice versa?

In reply to mseyunni:

Bit-stream casting and the streaming operators work very simplistically when dealing with fixed sized arrays containing the exact same number of bits. The assignment

a = {>>{b}};

streams left-to-right. This means the MSBs on the RHS of the assignment get assigned to the MSBs on the LHS of the assignment.

a[3][2] = b[11];
a[3][1] = b[10];
a[3][0] = b[9];
a[2][2] = b[8];
...
a[0][0] = b[0];

If you had the assignment

a = {<<{b}};

streams right-to-left. This means the LSBs on the RHS of the assignment get assigned to the MSBs on the LHS of the assignment.

a[3][2] = b[11];
a[3][1] = b[0];
a[3][0] = b[1];
a[2][2] = b[2];
...
a[0][0] = b[11];

You can also stream right-to-left in blocks.

a = {<< 3 {b}};
a[3][2] = b[2];
a[3][1] = b[1];
a[3][0] = b[0];
a[2][2] = b[3];
...
a[0][0] = b[9];

If none of these operations work for your bit-ordering, you may need to use a foreach loop.