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

From: Jim Lewis <Jim@synthworks.com>
Date: Tue Sep 09 2014 - 22:09:04 PDT
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
     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
       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.


Jim Lewis
VHDL Training Expert, SynthWorks
IEEE 1076 VHDL Working Group Chair
Open Source VHDL Verification Methodology (OSVVM), Chief Architect and Co-founder


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, and is
believed to be clean.
Received on Tue Sep 9 22:09:38 2014

This archive was generated by hypermail 2.1.8 : Tue Sep 09 2014 - 22:10:37 PDT