Hi, I want to divide all elements of a record by 2. How can I perform that
in a kind of loop?
type typeMine is record
a : natural;
b : natural;
c : positive;
d : integer
... end record;
You can't iterate through the elements of a record so you can't do exactly what you're asking.
However, if all of your elements are integers of the same range (yours are all integers but not of the same range), then you could consider that your 'record' is simply a vector of integers. If you're using the record type as a way to make the usage clearer (i.e. xx.a means something whereas xx(0) isn't quite so informative) then there is another approach...
type t_my_thing_of_integers is(a, b, c, d);
type arr_my_integers is array(t_my_thing_of_integers);
signal xx: arr_my_integers;
Then you would access the elements as xx(a) which from the perspective selfdocumenting is equivalent to xx.a where xx is a signal of your record type..
Not sure if this alternate usage is along the lines you were looking for ornot since your record elements weren't of the same integer ranges but thought I'd toss it out as food for thought.
Kevin Jennings