BTF - B19- Cadence signed arithmetic proposal

From: Thomas Fitzpatrick (tfitz@cadence.com)
Date: Tue Sep 23 1997 - 15:29:11 PDT


BAD MSG:
Hi All,
-Lines: 68
Content-Type: text/plain; charset="us-ascii"
Content-Length: 2322
X-Status: $$$$
X-UID: 0000000226
Status: RO

Well, now that the BTF has agreed on using signed operands to implement signed
arithmetic instead of signed operators, there are only a couple of outstanding
issues remaining with the B19 proposal. I'd like to address them here so that
they can be discussed on Monday's conference call (even though I won't be able
to attend). The two issues are:

1) What happens when intermediate results "run out of bits"?
        This was brought up by Kurt. Consider:

module div;
 reg signed [3:0] a,b,c;
 initial begin
   a = -8;
   b = -1;
   c = a/b;
   $display("c = %b",c);
   end
endmodule

        The point was brought up that, since it really requires 5 bits to hold
the intermediate answer here, then the answer should somehow "saturate". Sorry
Kurt, but XL does what it has always done in similar situations, which is to
just truncate the answer to the appropriate number of bits.

2) Specifying signed negative constant literals.
        This was brought up by Mac.
The key section of the proposal is in section 3.0:

A based constant can be typed as being signed by preceding the base type
with an "s". If the base type is not preceded with an "s" the constant
will be unsigned.
        4'd1 // 4 bit unsigned decimal 1
        -4'd1 // 4 bit unsigned decimal -1
        4'sd1 // 4 bit signed decimal 1
        -4'sd1 // 4 bit signed decimal -1

I'd like to ammend the proposal slightly. The "-" will no longer be considered
part of the literal (it never has been in XL, as Mac pointed out). The 's'
preceding the base type will indicate that the literal will be considered
signed.
        4'hf // 4 bit unsigned '1111'
        4'shf // 4 bit signed -1
        4'd15 // 4 bit unsigned '1111'
        4'sd15 // 4 bit signed -1

        reg [7:0] a;
        initial begin
          a = 4'hf; // a gets '00001111' i.e. zero extended
          a = 4'shf; // a gets '11111111' i.e. sign extended
        end

I believe that the other parts of the proposal are sufficiently clear and
compatable with the way XL has always worked that there shouldn't be any other
issues.

Please let me (and the rest of the BTF) know if you have any comments or
questions.

Thanks,
-Tom

-- 
---------------
Tom Fitzpatrick

Cadence Design Systems Technical Marketing Manager Product Engineering Logic Design & Verification Business Unit (508)446-6438 x6438



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