Reputation: 1223
I have a packed array which is used to hold a series of words, like this:
reg [31:0][79:0] H;
As I understand, packed arrays are stored as a contiguous block of memory, and so I'm wondering if there is a way to access the values as if they were declared in a 1 dimensional array like this:
H[500] <= x;
Which would be the same as H[11][15] <= x
.Is this possible? I need to fill various blocks within the array that are not at word boundaries, so this would make things much easier.
Upvotes: 0
Views: 76
Reputation: 42623
What you need is a packed union
union packed {
logic [31:0][79:0] words;
lofic [0:2559] bits;
logic [7:0][319:0] bytes;
} H;
Then the following would be equivalent if the math is correct
H.words[11][15] <= x;
H.bits[500] <=x;
Upvotes: 2