lrm error: sign of logical op

From: Paul Graham (pgraham@cadence.com)
Date: Tue Dec 11 2001 - 10:40:47 PST


Precedence: bulk

Consider this example:

    module m(q, d1, d2);
        output [7:0] q;
        input signed [7:0] d1, d2;

        assign q = d1 && d2;
    endmodule

Since operands d1 and d2 are signed, the result of (d1 && d2) should be
signed, correct? Furthermore the result is one bit wide. So it must be
sign extended before assignment to q. If the result is 1'b1, then with sign
extension it will be 8'b11111111.

Yet that is not how verilog-xl does it. verilog-xl apparently treats the
result of a logical operator as an unsigned bit. This makes perfect sense
to me, but it appears to violate the lrm. It seems that the result of a
logical operation should always be considered unsigned.

Any comments?

Paul



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