There is another reason why I like to use unpacked ones. With unpacked, there is no temptation (and no chance) to process the entire array name as a variable and erroneously assigned. There is also no possibility of bit bleeding from one element to another when you might think that you are accessing bits B of element N, but in fact you can access K bits of element N and bits BK of element N + -1 ..
My philosophy is to preserve only that which belongs together as a “unit of information” in a packaged dimension. Everything else is in the unpacked dimension. By default, thinking should be unpacked and pack only what you need.
For example, if I have 9 ports, each of which contains 21 bits of information, I would like to declare it as:
input logic [20:0] p1 [9];
Part 20:0 is a unit of information assigned and selected together (nominally). Separating these bits will destroy the protocol or nature of the port. On the other hand, changing the number of ports from 9 to, say, 16, will not affect the nature of the information in each port, so 9 ports really belong to the unpacked dimension in my mind.
I hope this can give you a paradigm for reflection ... In this paradigm you will be surprised how many things begin to seem unpacked, which you always considered packed.
Biswajit khandai
source share