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

From: Daniel Kho <daniel.kho@tauhop.com>
Date: Mon Oct 27 2014 - 20:49:30 PDT
Jim, YG, all,
Great. When I was reading through Implicit Numeric Conversions proposal, it
wasn't very clear to me regarding how meta-values will be handled.

If the ?? operator uses something like the to_integer_or_die() function, I
will support it.

However, the only catch with this approach is that this only works around
the problems, but not fix them. We still potentially run into things like
how we want to be able to display meta-valued integers in a meaningful way
in a simulator (for example).

The to_integer_or_die() or safe_integer() functions also add extra
complexity to the end user, unless these functions are standardized. I use
something similar (I have a function is_01 which checks for all valid 0s
and 1s similar to how is_x checks for 'X's):

    process(clk) is begin
        if rising_edge(clk) then
            if not is_01(addr) then
                report "Metavalues detected, returning 'X's" severity
warning;
                q <= (others=>'X');
            else
                q <= rom(to_integer(addr));
            end if;
        end if;
    end process;

The reason I need this is simple. I want my simulation to continue running
(severity failure will cause a complete stop, which is not intended), but
see a red line on the 'q' databus at times when the address is invalid.

Again, I feel my solution (same can be said as well to safe_integer /
to_integer_or_die) unnecessarily complex and just works around the problem
instead of fixing it.

I'm not sure about how the simulation performance will be significantly
reduced by adding metavalues to integer types. I somehow tend to agree with
Martin where all we need is probably a 1-bit flag which is used internally
by the simulator to determine if a value is a metavalue or not. Don't think
this eats up much performance, or does it?

cheers, dan

On 28 October 2014 08:15, Brian Drummond <brian@shapes.demon.co.uk> wrote:

> 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.
>
>
>

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

This archive was generated by hypermail 2.1.8 : Mon Oct 27 2014 - 20:51:18 PDT