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

From: Brian Drummond <brian@shapes.demon.co.uk>
Date: Mon Oct 27 2014 - 17:15:06 PDT
On Mon, 2014-10-27 at 16:19 -0700, Jim Lewis wrote:
> Dan,
> Why not just the following:
>   q <= rom(to_integer_or_die(addr)) when rising_edge(clk);
> 
> Where to_integer_or_die is defined as follows:
>         function to_integer_or_die ( A : unsigned) return integer is 
>         begin
>           if is_x(A) then 
>             report "to_integer_or_die contains meta-values" severity
>         failure ;
>             return 0 ; 
>           else 
>             return to_integer(A) ; 
>           end if ; 
>         end function to_integer_or_die ; 
> While we probably do not want to change the to_integer in this
> fashion, I do have a proposal for using "??" to implicitly convert
> between like types, such as unsigned and integer, and it could include
> the assertion.  We also have a proposal to adds trace back information
> to package assertions  so that they give a reference back to the
> outermost usage in the code (assignment, mapping, ...).

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?

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



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Oct 27 17:15:40 2014

This archive was generated by hypermail 2.1.8 : Mon Oct 27 2014 - 17:15:58 PDT