I have a list of constant
objects as shown below. They are
record
type. I am trying to run a loop
in which I can access all of them one by one. Could somebody suggest a way to do that?
type objecttype is record
id, x_start, x_end, y_start, y_end : integer;
end record objecttype;
constant C_OBJ1: objecttype :=(id => 0,
x_start => 200,
x_end => 300);
constant C_OBJ2: objecttype :=(id => 0,
x_start => 400,
x_end => 500);
I want to do something like :
for i in 0 to 5 loop
C_OBJ(i).........
end loop;
Make an array of objects. E.g.:
entity test_e is
end entity;
architecture test_a of test_e is
type objecttype is record
id, x_start, x_end, y_start, y_end : integer;
end record objecttype;
type objectarray is array (natural range <>) of objecttype;
constant C_OBJ : objectarray(0 to 5) := (
(1, 2, 3, 4, 5),
(1, 2, 3, 4, 5),
(1, 2, 3, 4, 5),
(1, 2, 3, 4, 5),
(1, 2, 3, 4, 5),
(1, 2, 3, 4, 5)
);
begin
end architecture;