'image of Enumerated Types

23 views
Skip to first unread message

gnuarm.del...@gmail.com

unread,
Nov 14, 2020, 12:34:29 AM11/14/20
to
I never realized that if you use characters to enumerate a type, when you use the 'image attribute on it you get the apostrophes along with the character!

type Pixel_t is ('_', '@');
function pixel (Data : natural) return string is
variable temp : string (1 to 3);
begin
temp := Pixel_t'image(Pixel_t'Val(Data));
report "Pixel - temp = """ & temp & """";

results in

NOTE : Pixel - temp = "'_'"

Am I the only one surprised by this?

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Jim Lewis

unread,
Nov 16, 2020, 5:05:50 PM11/16/20
to
Have you tried the VHDL-2008, to_string?

It was added due to this issue and since it can be overloaded.

gnuarm.del...@gmail.com

unread,
Nov 18, 2020, 6:00:33 AM11/18/20
to
On Monday, November 16, 2020 at 5:05:50 PM UTC-5, j...@synthworks.com wrote:
> Have you tried the VHDL-2008, to_string?
>
> It was added due to this issue and since it can be overloaded.

Mostly the reason is I was not aware of that one. I guess I've been blowing right past all the times I must have seen it. I was aware of to_hstring(). So to_string() will give the character without the enclosing apostrophes? Why would they have implemented 'image that way in the first place?

VHDL had some unusual thinkers in the mix when it was being developed. I had occasion to converse with one and when asked why some feature was so messed up he dug into the bowels to explain the logical analysis of the standard. It was an effort to get him to understand the question was "Why is it that way?" which pretty much meant nothing to him. It just was as if no one developing the language considered that anyone might want to use the language for productive work. It was financed by the government, no?

I worked with the people developing the Enhanced Modular Signal Processor. Great ideas early on, but then reality had to be faced and after some years of ever diminishing expectations it bit the dust. A previous job was with a company designing array processors... a DSP chip in rack cabinets before anyone thought about DSP on a chip, like the Cray. All the concepts of data flow, etc. could have been implemented on any machine really. But they were designing custom hardware to go in subs and ships and such, mostly water cooled. Then there was the odd duck that would fly where weight was the premium consideration. It couldn't be everything to everyone.

--

Rick C.

+ Get 1,000 miles of free Supercharging
+ Tesla referral code - https://ts.la/richard11209
Reply all
Reply to author
Forward
0 new messages