RE: [vhdl-200x] Image attribute for array types

From: <ryan.w.hinton@L-3com.com>
Date: Tue Jul 22 2014 - 11:04:30 PDT
Jim:

I understand your point of view and we are in fundamental agreement.  I like extending 'image and 'value because it feels like they *ought* to be available.  And I agree that to_string is more concise and more flexible, so I want to extend it also and will use it more often.

Thanks for pointing out my non-LRM shortcuts.  The compiler also reminds me when I forget that 'image belongs to the type instead of the object. 

- Ryan

-----Original Message-----
From: owner-vhdl-200x@eda.org [mailto:owner-vhdl-200x@eda.org] On Behalf Of Jim Lewis
Sent: Monday, July 21, 2014 3:53 PM
To: vhdl-200x@eda.org
Subject: Re: [vhdl-200x] Image attribute for array types

Hi Ryan,
> 1.  Fundamentally you like the idea and don't see any technical issues with the static approach I suggested.
>
> 2.  You would like to add a facility to globally control the formatting.
>
> 3.  You would like to add a facility to locally override the global formatting controls.
>
> ...  Otherwise, I don't particularly need (2) or (3).
The value of 2 and 3 flow out of Tristan's conservative view, "There is no natural format (particular for records)".  Fundamentally, I don't know if I prefer parens and commas as you suggest or if I 
want just spaces between objects, however, if I have 2 and 3, then I can get what I want for a particular situation   I am not so worried about writing out in a VHDL-like format, I am more worried 
about writing out in a format that I can read back in easily.  Having to remove the parens and commas on reading is annoying.

I prefer "to_string" since it is overloadable ('image is not) and simple to use.   Your example took some non-LRM compliant short-cuts.   The LRM says that 'image requires "any scalar type or subtype 
T", and hence, your write statement should be:

   write(ln, std_logic_vector'image(ary));

OTOH, using to string is just the following.  And if I don't like what it does, I can create appropriate overloading for the type.

   write(ln, to_string(ary));


Cheers,
Jim

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
VHDL Training Expert, SynthWorks
IEEE 1076 VHDL Working Group Chair
Open Source VHDL Verification Methodology (OSVVM), Chief Architect and Co-founder

1-503-320-0782
Jim@SynthWorks.com
http://www.SynthWorks.com

VHDL Training on leading-edge, best coding practices for hardware design and verification.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Jul 22 11:04:57 2014

This archive was generated by hypermail 2.1.8 : Tue Jul 22 2014 - 11:05:45 PDT