Re: [sv-bc] Question about shortint'(8'hFF + 8'h01)

From: Paul Graham <pgraham@cadence.com>
Date: Fri Sep 17 2004 - 14:06:36 PDT

> And yes, this did reverse issue 147. People do make the wrong decisions.

So it seems that for packed data types at least, a type conversion has
almost no effect. With issue 147, a type conversion created a little
region of self-determination. Issue 111 removes that little region.
But this raises the question of whether the operand to a type
conversion affects the sign of the surrounding expression. For
instance:

    typedef logic [31:0] uint;
    typedef logic signed [31:0] sint;

    uint u;
    sint s;

    wire q = s > sint'(u);

If u were self-determined, then its unsignedness would not affect
the comparison. But now that u is not self-determined, then its
unsignedness should affect the sign of the comparison.

This is different from:

    wire q = s > $signed(u);

Also, does the type conversion itself count as an operand for sizing?
For instance:

    logic [7:0] x, y;
    logic [15:0] z;

    z = x + integer'(y);

Is this rhs of the assignment evaluated to 16 bits (from the lhs) or
32 bits (from the integer type conversion)? I guess in this case it
doesn't affect the result, but I wonder if there are cases where it
would make a difference.

Paul
Received on Fri Sep 17 14:06:43 2004

This archive was generated by hypermail 2.1.8 : Fri Sep 17 2004 - 14:06:56 PDT