How to make a Data Object Alias that's reusable

Joined
Jan 27, 2010
Messages
1
Reaction score
0
I am getting started on a design that will have many 2D arrays (13x32) in which about 50 data fields are packed. The arrays get transferred across 32-bit interfaces and stored to memory as 32-bit values, so it makes good sense to use a 2D array type for the object.

The data within that array is used as the individual fields, so it would be nice to use aliases to do the assignment and manipulation of the fields. However since there are lots (12 or so) of these arrays throughout the design, I'd need to define the 50 aliases in 12 different places, which becomes unwieldy.

My preference would be define a "record alias" in a package which could be applied to any 13x32 array. Then the definition would be in one place (so if it were to change, I'd only need to modify it in one place) and I'd be able to assign it on one line instead of 50.

I'd envision something like:
type SCD_ARRAY is array(12 downto 0) of STD_LOGIC_VECTOR(31 downto 0));
type RECORD_ALIAS_TYP is record
ADDR : STD_LOGIC_VECTOR(7 downto 0);
DATA : STD_LOGIC_VECTOR(7 downto 0);
. . .
end record;

variable IN_SCD_ARRAY : SCD_ARRAY;
variable OUT_SCD_ARRAY : SCD_ARRAY;
alias IN_SCD : RECORD_ALIAS_TYP is IN_SCD_ARRAY;
alias OUT_SCD : RECORD_ALIAS_TYP is OUT_SCD_ARRAY;
. . .
OUT_SCD.ADDR <= IN_SCD.ADDR + 1;

Obviously, "record aliases" don't exist (there would need to be some way to tie the record fields to the actual data object). Can anyone think of a way to do this (perhaps an alias to a pointer or an alias to an alias?).
Thanks,
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,961
Messages
2,570,131
Members
46,689
Latest member
liammiller

Latest Threads

Top