\'image of Enumerated Types...

  • Thread starter gnuarm.del...@gmail.com
  • Start date
G

gnuarm.del...@gmail.com

Guest
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
 
Have you tried the VHDL-2008, to_string?

It was added due to this issue and since it can be overloaded.
 
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
 

Welcome to EDABoard.com

Sponsor

Back
Top