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

From: Jim Lewis <jim@synthworks.com>
Date: Wed Oct 29 2014 - 08:11:46 PDT
Hi Brian,

> This has some appeal. If ?? in this role was an operator and therefore
> overloadable, I could see other uses for it.
>
> Could I overload it to convert between integer and a new integer type?
>     type saturable_integer is new integer;
> with the overloaded ?? operator providing saturation?
In the proposal [[ImplicitConversionNumeric]] I have explored converting between distinct, but similar types (unsigned and integer).  So if you were using saturable_integer and wanted to assign it to 
an integer, I can see that.

OTOH, it does not seem to be a mechanism that would allow intercepting the assignment of the same type to itself.  I like your suggestion of using control types to do this.

I have also been thinking of the new operator as you have above.  I am guessing it creates a new type that inherits all the functions of the base type, except it is a distinct type and we can  add 
additional overloading.  Can it also replace the inherited overloading with explicitly defined overload functions?  It would have been handy to derive unresolved_unsigned, unresolved_signed, ... from 
std_ulogic_vector.  That way we would not have had to create "and" - however this is water under the bridge at this point.



  I see it as a mechanism to go from one type to another type that holds a similar value.  So if you have a separate type for saturable_integer, then I
>
> That would be a more flexible and general mechanism. It's late here so
> I'll probably see the inevitable downside right after "Send".
>
> - Brian

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis                                  Jim@SynthWorks.com
VHDL Training Expert                       http://www.SynthWorks.com
IEEE VHDL Working Group Chair
OSVVM, Chief Architect and Cofounder
1-503-590-4787
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Oct 29 08:12:02 2014

This archive was generated by hypermail 2.1.8 : Wed Oct 29 2014 - 08:12:44 PDT