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

From: Daniel Kho <daniel.kho@tauhop.com>
Date: Mon Oct 27 2014 - 13:36:47 PDT
One more thing. As for the case of the ROM example posted earlier, I feel
it is not quite right for a simulator to return valid data from memory, and
just give a metavalue warning. In fact, is would be incorrect / unsafe for
a real design to return valid data from an invalid memory address. Consider
the earlier example:

    q <= rom(to_integer(addr)) when rising_edge(clk);

The function to_integer(addr) returns 0 even when 'addr' contains invalid
values such as 'X's for example. Hence, assuming 'X's are present at the
address lines, 'rom(to_integer(addr))' is equivalent to saying 'rom(0)',
which returns the first value in the ROM. Note that the design returns a
valid memory value even though the address bus is invalid.

Of course there are ways to get around this, such as not using 'to_integer'
in the first place, but it complicates the design a bit more.

This is just another example that I frequently bump into, which helps make
the case for having a NaN value (or something similar) added to the type
integer.

cheers, dan

On 28 October 2014 04:04, Daniel Kho <daniel.kho@tauhop.com> wrote:

> Yes, that's what's going to happen now. Hence the proposal to add
> something like NaN as an integer value, similar to how it was done for the
> float type.
>
> Cheers, dan
>
>
> On 28 October 2014 01:44, <tgingold@free.fr> wrote:
>
>> > Another use case for this is when we are modelling memories, one
>> > could possibly apply the to_integer function on an address bus to
>> > read contents of a memory. For example:
>> >
>> > q <= rom(to_integer(addr)) when rising_edge(clk);
>> >
>> > If "addr" contains 'X's, then zero would be returned. Yes, the
>> > simulator would warn us of a meta-value detection, but wouldn't it
>> > be better if the to_integer were to return something that
>> > corresponds to NaN for example? I think seeing a red line on the
>> > databus in simulation whenever the address lines are invalid would
>> > give the designer better insight to what went wrong, as compared to
>> > a few warning messages.
>>
>> But then the simulation would immediately stop as 'rom(NaN)' is not
>> defined.
>>
>> --
>> 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 13:37:31 2014

This archive was generated by hypermail 2.1.8 : Mon Oct 27 2014 - 13:37:50 PDT