Subject: Re: [vhdl-200x] Minutes for VHDL-200X-FT meeting, San Jose Dec 4, 2003
From: Jonas Nilsson (jonas@hardi.se)
Date: Wed Dec 10 2003 - 01:52:22 PST
Hamish Moffatt wrote:
> to_string seems to duplicate 'image to some extent; could 'image be
> improved instead?
I agree.
Augmenting 'image to be a more universal attribute (not
only an attribute on types) would be a big improvement.
a'IMAGE would be much easier to use and understand than
INTEGER'IMAGE(a). I give VHDL courses, and have seen this
mistake made by students thousands of times. a'IMAGE
is a very reasonable thing to try to do.
(It should still be a TYPE attribute, of course,
in order to resolve possible conflicts and for
legacy code.)
Allowing 'IMAGE on one dimensional arrays would also
be a great benefit. Just concatenate the 'IMAGE of all
elements.
The problems that arise when the element type is an
enum that contains identifiers instead of single
characters can be solved in at least two ways:
1) The element is converted to the CHARACTER with
the corresponding 'POS. This would give the
resulting STRING a consistent length, equal
to that of the array. (It would also make 'IMAGE
of a STRING identical to the original STRING...)
2) Each element could be 'IMAGEd and appended to the
result, preceeded by a space to separate identifiers
if there number of characters in the previous
element's IMAGE was >1.
This is good for human readability, and is more
consistent than (1) with how 'IMAGE works for
scalars.
Both would allow a 'VALUE to reverse the 'IMAGE in all but
pathological cases such as having ' ' as an element value
and simultaneously having 32 or more elements in the type
which would break both alt 1 and 2, or having spaces inside
identifiers which could break alt 2.
I personally wouldn't care too much about which of the above
(or any other) are chosen. You would most often use 'IMAGE for
arrays of BIT or STD_ULOGIC anyway. (If I would use it on
other kinds of arrays, I think that alt 2 would be my
preferred choice.)
Regards,
Jonas
-- Jonas Nilsson HAPS Technical manager HARDI Electronics AB Traktorvagen 4 SE-226 60 LUND SWEDEN email : jonas@hardi.se Phone : +46-46-16 29 00 Fax : +46-46-16 29 01 www : http://www.hardi.se/haps
This archive was generated by hypermail 2b28 : Wed Dec 10 2003 - 01:49:43 PST