BTF BE92 to review

From: Anders Nordstrom (andersn@nortelnetworks.com)
Date: Wed Jul 07 1999 - 13:38:47 PDT


Content-Type: text/plain; charset="us-ascii"
X-Sun-Content-Length: 210

Team,

Please review the enclosed proposal for BE92 - Relational and Equality Operations on Ambiguous
Operands.
Please vote by sending an email to the btf reflector before July 14.

Thanks,

            Anders
Content-Type: text/html; charset="us-ascii"; name="BE92.html"
Content-Disposition: inline;
 filename="BE92.html"
X-Sun-Content-Length: 6161

<x-html>
<HTML>
<HEAD>
<TITLE> BE92 </TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
 
<BR>
<HR SIZE=5 NOSHADE>
 
<H2> BE92 - Relational and Equality Operations on Ambiguous Operands </H2>

<TABLE BORDER COLS=2 WIDTH="75%" >
<TR><TD>
Section: </TD><TD> 4.1.7 & 4.1.8
</TD></TR><TR><TD>
Date Submitted: </TD><TD> 990625
</TD></TR><TR><TD>
Requestor: </TD><TD> Paul Campbell (paul@chromatic.com)
</TD></TR><TR><TD>
Status: </TD><TD> Proposal
</TD></TR><TR><TD>
Analyzed by: </TD><TD> Mike McNamara
</TD></TR>
</TABLE>

<H3> Details </H3>

On Wed, 30 Jun 1999, Michael McNamara wrote:
<PRE>
         The current 1364 specification has incorrect specification of
 the operation of the relational operators (<, <=, > and >=) when an
 operand is ambiguous, and of the operation of the logical equivalence
 operators (== and !=) when an operand is ambiguous.
 
 .....

     For the logical equality and logical inequality operators (== and
     !=), if, due to unknown or high-impedance bits in the operands, the
     relation is ambiguous, then the result shall be a one bit unknown
     value (x).
</PRE>
In fact after I sent you that last mail I realized a very simple way to explain
the current verilog/vcs behavior is:
<PRE>
        a != b is exactly the same as |(a^b)

        a == b is exactly the same a &(a~^b)
</PRE>
this gets the some-what non-intuitive x behavior exactly

I also still think you should explain in the spec how
this behavior relates to the !, && and || operators,
and the first operand of the ?: operator
since multiple bit values are converted to single bit
logical values using '!= 0' with the x behavior shown above.

Looking through 4.1.9 in the 2.0 draft I don't see any explicit
explanation that C-style (!=0 means true) logical values are
used - but I only looked at the spec for the first time last week
so it may say this elsewhere

        Paul

        The current 1364 specification has incorrect specification of
the operation of the relational operators (<, <=, > and >=) when an
operand is ambiguous, and of the operation of the logical equivalence
operators (== and !=) when an operand is ambiguous.

        In fact, the descriptions are reversed.

        The relational operators should be defined to return an
unknown (x) value if any operand contains an X or Z value.

        The logical equivalence operators should be defined to return
an unknown (x) value only if the value of the equivalence is ambiguous
due to an unknown.

Consider:
<PRE>
module foo2;

   initial begin
      $display ("2'b10 > 2'b0x is %b ", 2'b10 > 2'b0x);
      $display ("2'b00 > 2'b0x is %b ", 2'b00 > 2'b0x);
      $display ("2'b10 > 2'b0z is %b ", 2'b10 > 2'b0z);
      $display ("2'b00 > 2'b0z is %b ", 2'b00 > 2'b0z);
      $display ("2'b1x > 2'b01 is %b ", 2'b1x > 2'b01);
      $display ("2'b0x > 2'b01 is %b ", 2'b0x > 2'b01);
      
      $display ("2'b10 >= 2'b0x is %b ", 2'b10 >= 2'b0x );
      $display ("2'b00 >= 2'b0x is %b ", 2'b00 >= 2'b0x );
      $display ("2'b1x >= 2'b01 is %b ", 2'b1x >= 2'b01 );
      $display ("2'b0x >= 2'b01 is %b ", 2'b0x >= 2'b01 );

      $display ("2'b10 < 2'b0x is %b ", 2'b10 < 2'b0x);
      $display ("2'b00 < 2'b0x is %b ", 2'b00 < 2'b0x);

      $display ("2'b10 <= 2'b0x is %b ", 2'b10 <= 2'b0x);
      $display ("2'b00 <= 2'b0x is %b ", 2'b00 <= 2'b0x);

      $display ("2'b10 == 2'b0x is %b ", 2'b10 == 2'b0x);
      $display ("2'b00 == 2'b0x is %b ", 2'b00 == 2'b0x);
      $display ("2'b10 == 2'b0z is %b ", 2'b10 == 2'b0z);
      $display ("2'b00 == 2'b0z is %b ", 2'b00 == 2'b0z);

      $display ("2'b10 != 2'b0x is %b ", 2'b10 != 2'b0x);
      $display ("2'b00 != 2'b0x is %b ", 2'b00 != 2'b0x);
      $display ("2'b10 != 2'b0z is %b ", 2'b10 != 2'b0z);
      $display ("2'b00 != 2'b0z is %b ", 2'b00 != 2'b0z);

   end // initial begin
endmodule // foo2

XL says:

2'b10 > 2'b0x is x
2'b00 > 2'b0x is x
2'b10 > 2'b0z is x
2'b00 > 2'b0z is x
2'b1x > 2'b01 is x
2'b0x > 2'b01 is x
2'b10 >= 2'b0x is x
2'b00 >= 2'b0x is x
2'b1x >= 2'b01 is x
2'b0x >= 2'b01 is x
2'b10 < 2'b0x is x
2'b00 < 2'b0x is x
2'b10 <= 2'b0x is x
2'b00 <= 2'b0x is x
2'b10 == 2'b0x is 0
2'b00 == 2'b0x is x
2'b10 == 2'b0z is 0
2'b00 == 2'b0z is x
2'b10 != 2'b0x is 1
2'b00 != 2'b0x is x
2'b10 != 2'b0z is 1
2'b00 != 2'b0z is x
</PRE>

<H2> Proposal </H2>

Change the second paragraph of section 4.1.7 from:

   An expression using these relational operators shall yeild the
   scalar value 0 if the specified relation is false, or the value 1
   if it is true. If, due to unknown or high impedance bits in the
   operands, the relation is ambiguous, than the result shall be a
   1-bit unknown value (x).

To:

   An expression using these relational operators shall yeild the
   scalar value 0 if the specified relation is false, or the value 1
   if it is true. If either operand of a relational operator contains
   an unknown (x) or high impedance (z) value, then the result shall
   be a 1-bit unknown value (x).

Change the second and third paragraphs of section 4.1.8 from:

    All four equality operators shall have the same precedence. These
    four operators compare operands bit for bit, with zero filling if
    the two operands are of unequal bit length. As with the relational
    operators, the result shall be zero if the comparison fails, 1 if
    it succeeds.

 
    For the logical equality and logical inequality operators (== and
    !=), if either operand contains an x or a z, then the result shall
    be the unknown value (x).

To:

    All four equality operators shall have the same precedence. These
    four operators compare operands bit for bit, with zero filling if
    the two operands are of unequal bit length. As with the relational
    operators, the result shall be zero if the comparison fails, 1 if
    it succeeds.

    For the logical equality and logical inequality operators (== and
    !=), if, due to unknown or high-impedance bits in the operands, the
    relation is ambiguous, then the result shall be a one bit unknown
    value (x).

<HR SIZE=5 NOSHADE>
</BODY>
</HTML>
                                     

<p></x-html>
Content-Type: text/x-vcard; charset="us-ascii"; name="andersn.vcf"
Content-Description: Card for Nordstrom, Anders [SKY:1V29-I:EXCH]
Content-Disposition: attachment;
 filename="andersn.vcf"
X-Sun-Content-Length: 313

Attachment Converted: "C:\Documents and Settings\stefen\Application Data\Qualcomm\Eudora\andersn5.vcf"



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:53:28 PDT and
sponsored by Boyd Technology, Inc.