Let's say I have an array of record like this:
type foo_rec is record
a : std_logic;
b : std_logic_vector ( 3 downto 0 );
c : integer range 0 to 7;
end record;
type foo_array is array ( 0 to 5 ) of foo_rec;
constant cf_array : foo_array := ???
how can i initialize the array ?
Thank in advance
Timo
--
-------------------------------------------------------------------------
Timo Miettunen
Design Engineer
Fincitec Oy http://www.fincitec.com
e-mail: timo.mi...@fincitec.fi
Tel: +358-(0)16-2151240
Fax: +358-(0)16-221561
-------------------------------------------------------------------------
: type foo_rec is record
: a : std_logic;
: b : std_logic_vector ( 3 downto 0 );
: c : integer range 0 to 7;
: end record;
: type foo_array is array ( 0 to 5 ) of foo_rec;
: constant cf_array : foo_array := ???
: how can i initialize the array ?
You use an aggregate of six elements, each of which is a nested
aggregate of three elements, one each for a, b, and c. The b element
is, in turn, either a nested aggregate or a string:
constant cf_array: foo_array := (
('U', "UUUU", 0),
('X', (others => '0'), 5),
(a => '0', b => "01XZ", c => 2),
others => ('W', (2 => 'H', others => '-'), 3)
);
Named or positional association may be used for any of the aggregate
elements.
Hope this helps,
Paul
--
Paul Menchini | me...@mench.com | "Every damn thing is your
Menchini & Associates | www.mench.com | own fault if you're any
P.O. Box 71767 | 919-479-1670[v] | good."
Durham, NC 27722-1767 | 919-479-1671[f] | -- Ernest Hemingway