Number | 454
|
Category | errata
|
Synopsis | 2.5.1: 2'sb0000000_10 == 2'sb10 ?
|
State | lrmdraft
|
Class | errata-simple
|
Arrival-Date | Aug 29 2003
|
Originator | "Brad Pierce" <Brad.Pierce@synopsys.com>
|
Release | 2001b: 2.5.1
|
Environment |
|
Description |
In a numerical constant, if the unsigned number is larger than the size specified for the constant, is the unsized number truncated, losing the bits on the left? For example, should o be assigned 1111111110 below? -- module m ( output reg signed [9:0] o ) ; always begin o = 2'sb00000000_10 ; $display("|%b|", o) ; end endmodule -- Brad |
Fix |
In 2.5.1, at the end of the paragraph If the size of the unsigned number is smaller than the size specified for the constant, the unsigned number shall be padded to the left with zeros. If the leftmost bit in the unsigned number is an x or a z, then an x or a z shall be used to pad to the left respectively. ADD the following sentence If the size of the unsigned number is larger than the size specifed for the constant, the unsigned number shall be truncated from the left. |
Audit-Trail |
From: Steven Sharp <sharp@cadence.com> To: etf-bugs@boyd.com Cc: Subject: Re: errata/454: 2.3.1: 2'sb0000000_10 == 2'sb10 ? Date: Sat, 30 Aug 2003 19:10:10 -0400 (EDT) >In a numerical constant, if the unsigned number is larger than >the size specified for the constant, is the unsized number >truncated, losing the bits on the left? Well, the size of the resulting constant definitely has to be the size that was specified. That much is clear in the LRM. How the value of those bits are determined in this situation is not clear. Truncation would be consistent with all other related situations in the language. I would expect a tool to at least provide a warning in this situation. It would not be unreasonable to consider this to be illegal syntax and produce an error. However, Verilog-XL just produces a warning and truncates. The result is as you suggested. Steven Sharp sharp@cadence.com From: Shalom Bresticker <Shalom.Bresticker@motorola.com> To: Steven Sharp <sharp@cadence.com> Cc: etf-bugs@boyd.com Subject: Re: errata/454: 2.3.1: 2'sb0000000_10 == 2'sb10 ? Date: Sun, 31 Aug 2003 11:49:09 +0300 Actually, by IEEE standard rules, anything not forbidden is permitted. (That's not exactly what the rules say, but that's approximately the meaning.) So a tool should not produce an error. Especially because it is explicitly permitted that the unsigned number be smaller than the size constant. Shalom > >In a numerical constant, if the unsigned number is larger than > >the size specified for the constant, is the unsized number > >truncated, losing the bits on the left? > > Well, the size of the resulting constant definitely has to be the size > that was specified. That much is clear in the LRM. How the value of > those bits are determined in this situation is not clear. Truncation > would be consistent with all other related situations in the language. > > I would expect a tool to at least provide a warning in this situation. > It would not be unreasonable to consider this to be illegal syntax and > produce an error. However, Verilog-XL just produces a warning and > truncates. The result is as you suggested. -- Shalom Bresticker Shalom.Bresticker@motorola.com Design & Reuse Methodology Tel: +972 9 9522268 Motorola Semiconductor Israel, Ltd. Fax: +972 9 9522890 POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 441478 Fix replaced by brad.pierce@synopsys.com on Sat Nov 13 14:55:36 2004 In 2.5.1, at the end of the paragraph If the size of the unsigned number is smaller than the size specified for the constant, the unsigned number shall be padded to the left with zeros. If the leftmost bit in the unsigned number is an x or a z, then an x or a z shall be used to pad to the left respectively. ADD the following sentence If the size of the unsigned number is larger than the size specifed for the constant, the unsigned number shall be truncated from the left and a warning message shall be issued. From: Shalom Bresticker <Shalom.Bresticker@freescale.com> To: brad.pierce@synopsys.com Cc: etf-bugs@boyd.com Subject: Re: errata/454: PROPOSAL - 2.5.1: 2'sb0000000_10 == 2'sb10 ? Date: Sun, 14 Nov 2004 10:06:23 +0200 Brad, This is still ambiguous. What is "the size of the unsigned number"? In your example, 2'sb0000000_10, I might interpret that the size of the unsigned number is 2 bits, since all the extra bits are 0. Another ambiguous case: 2'h3: Do I look at it as 2'b11 or as 2'b0011? Shalom > If the size of the unsigned number is larger than the size specifed for the constant, the unsigned number shall be truncated from the left and a warning message shall be issued. -- Shalom Bresticker Shalom.Bresticker @freescale.com Design & Verification Methodology Tel: +972 9 9522268 Freescale Semiconductor Israel, Ltd. Fax: +972 9 9522890 POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 5441478 [ ]Freescale Internal Use Only [ ]Freescale Confidential Proprietary Fix replaced by brad.pierce@synopsys.com on Sun Nov 14 18:06:48 2004 In 2.5.1, at the end of the paragraph If the size of the unsigned number is smaller than the size specified for the constant, the unsigned number shall be padded to the left with zeros. If the leftmost bit in the unsigned number is an x or a z, then an x or a z shall be used to pad to the left respectively. ADD the following sentence If the size of the unsigned number is larger than the size specifed for the constant, the unsigned number shall be truncated from the left and, unless each of the truncated bits is zero, a warning message shall be issued. From: Shalom.Bresticker@freescale.com To: brad.pierce@synopsys.com Cc: etf-bugs@boyd.com Subject: Re: errata/454: PROPOSAL - 2.5.1: 2'sb0000000_10 == 2'sb10 ? Date: Mon, 15 Nov 2004 05:19:31 +0200 (IST) This is fine. Thanks, Shalom > If the size of the unsigned number is larger than the size specifed for the constant, the unsigned number shall be truncated from the left and, unless each of the truncated bits is zero, a warning message shall be issued. Fix replaced by brad.pierce@synopsys.com on Mon Nov 15 09:17:55 2004 In 2.5.1, at the end of the paragraph If the size of the unsigned number is smaller than the size specified for the constant, the unsigned number shall be padded to the left with zeros. If the leftmost bit in the unsigned number is an x or a z, then an x or a z shall be used to pad to the left respectively. ADD the following sentence If the size of the unsigned number is larger than the size specifed for the constant, the unsigned number shall be truncated from the left. |
Unformatted |
|
Hosted by Boyd Technology