Re: [vhdl-200x] "??"[std_ulogic return boolean] and meta values

From: Jim Lewis <jim@synthworks.com>
Date: Wed Sep 10 2014 - 09:33:42 PDT
Thanks Ryan,
Seems I left off the check part.  I suspect your expression has a polarity issue.
Assuming I have my polarity correct, I think the resulting code would be:
    function "??" (l : STD_ULOGIC) return BOOLEAN is
    begin
        assert not is_x(l) or NO_WARNING
          report "STD_LOGIC_1164.""??"": metavalue detected, returning FALSE"
          severity warning;
        return l = '1' or l = 'H';
    end function "??";

Or if you prefer if statements:
    function "??" (l : STD_ULOGIC) return BOOLEAN is
    begin
        if is_x(l) and not NO_WARNING then
          report "STD_LOGIC_1164.""??"": metavalue detected, returning FALSE"
          severity warning;
        end if ;
        return l = '1' or l = 'H';
    end function "??";

Jim

> Sounds good to me.  I assume you want the assert condition to be something like
>
>     assert NO_WARNING or ('X' = to_X01(l))
>
> - Ryan
>
> *From:*owner-vhdl-200x@eda.org [mailto:owner-vhdl-200x@eda.org] *On Behalf Of *Jim Lewis
> *Sent:* Tuesday, September 09, 2014 11:09 PM
> *To:* vhdl-200x@eda.org
> *Subject:* [vhdl-200x] "??"[std_ulogic return boolean] and meta values
>
> Hi,
> In conjunction with a stack overflow post, http://stackoverflow.com/questions/25737877/how-to-get-simulation-warning-when-comparing-std-logic-with-x, I have been looking at the 'X' handling of
> overloaded versions of "=" and "??".
>
> If you look at "="[unsigned, unsigned return unsigned], you will note that if one of the inputs has an 'X', an assertion warning is produced.
>
> OTOH, if "??" sees an 'X' it quietly reports false.   From std_logic_1164:
>    function "??" (l : STD_ULOGIC) return BOOLEAN is
>    begin
>      return l = '1' or l = 'H';
>    end function "??";
>
> To be consistent with numeric_std, it would seem appropriate that we add an assertion (and NO_WARNING constant) similar to the following:
>    function "??" (l : STD_ULOGIC) return BOOLEAN is
>    begin
>        assert NO_WARNING
>          report "STD_LOGIC_1164.""??"": metavalue detected, returning FALSE"
>          severity warning;
>        return l = '1' or l = 'H';
>    end function "??";
>
> What do you think?  Do we need it?  It would slow down code execution.  There would be no backward compatibility issues since it is just an assertion.
>
> Regards,
> Jim
>
> --
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Jim Lewis
>
> VHDL Training Expert, SynthWorks
>
> IEEE 1076 VHDL Working Group Chair
>
> Open Source VHDL Verification Methodology (OSVVM), Chief Architect and Co-founder
>
>
>
> 1-503-320-0782
>
> Jim@SynthWorks.com  <mailto:Jim@SynthWorks.com>
>
> http://www.SynthWorks.com
>
>
>
> VHDL Training on leading-edge, best coding practices for hardware design and verification.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
>
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.


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

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Sep 10 09:34:30 2014

This archive was generated by hypermail 2.1.8 : Wed Sep 10 2014 - 09:34:52 PDT