Re: EXTERNAL: Re: [vhdl-200x] Update to proposal for arbitrary integers

From: Brian Drummond <brian@shapes.demon.co.uk>
Date: Tue Oct 28 2014 - 05:39:42 PDT
On Tue, 2014-10-28 at 07:46 -0400, Ray Andraka, Andraka Consulting
Group, Inc wrote:
> I don't think this is a good way to implement this, even if it were a 
> good idea.  Doing so destroys
> the modularity of the integer type, making it no longer match the 
> behavior of 32 bit 2's complement
> arithmetic used by every modern 32 bit CPU.  

If applied to Standard.Integer, this is absolutely true. We must
preserve the current properties of Integer, and any increased length
variants whether 64 bit or arbitrary length or Universal_Integer.

I'm asking about creating new integer types and whether they can be
provided with different semantics - such as NAN. 
Saturation, modular semantics and logical/shift semantics could be
candidates too.

We have a plethora of different proposals for different use cases.

I'm wondering what's preventing us from improving the underlying
mechanism so that these can be implemented in terms of the language, or
alternatively, what is the minimum set of most general changes that
would allow these to be added at the library level, rather than having
to create ad-hoc mechanisms for each separate requirement. I apologise
that I'm not expressing it clearly enough.

For example, Ada has a mechanism of "controlled types" where a type
declared as "controlled" must also supply three functions (callbacks)
declared on that type, Initialize, Adjust, and Finalize. 

Focussing on "Adjust", this function is called at the moment of
assignment to a controlled variable. If your "Adjust" function
saturates, or calculates modulus, or reports "NAN detected", every such
assignment is handled via the Adjust callback. This is similar to the
idea of a resolution function. Whether it carries quite as high a
penalty as Tristan mentioned for resolution functions I can't say.

(Initialize and Finalize act similarly on object creation and
destruction, for example automatically allocating or freeing resources)

(In languages where assignment is implemented as though it were an
operator, the assignment "operator" would be overloaded for the same
purpose. But making assignment an operator would be hugely disruptive)

- Brian



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Oct 28 05:39:50 2014

This archive was generated by hypermail 2.1.8 : Tue Oct 28 2014 - 05:40:15 PDT