Number | 106
|
Category | errata
|
Synopsis | 4.1.8: Incorrect zero-extend rules for equality operators
|
State | lrmdraft
|
Class | errata-discuss
|
Arrival-Date | Aug 26 2002
|
Originator | Paul Graham <pgraham@cadence.com>
|
Release | 2001c: 4.1.7, 4.1.8
|
Environment |
See #8. |
Description |
Continuation of issue #8 (4.1.8 needs to be addressed): Section 4.1.7 says that when a relational operator has two operands of different sizes, then the smaller operand is zero-extended. This makes no intuitive sense for signed operands, and it conflicts with the general rules for determining sign given at the end of chapter 4. It also conflicts with the behavior of Verilog-XL and NC-Verilog. Likewise, 4.1.8 says that the smaller operand to an equality operator is zero-extended, which I also believe is wrong. |
Fix |
In 4.1.7, CHANGE the paragraph order as follows: 1. "Table 4-9 lists and defines the relational operators." 2. "An expression using these relational operators shall yield the scalar ..." 3. The paragraphs discussing operand types and signedness (details below) 4. The paragraphs discussing operator precedence: - "All the relational operators shall have the same precedence ..." - "Examples:" - "The following examples.." - "When foo - (1 < a) evaluates..." REWORD the paragraphs discussing operand types and signedness as follows: "When one or both operands of a relational expression are unsigned, the expression shall be interpreted as a comparison between unsigned values. If the operands are of unequal bit lengths, the smaller operand shall be zero-extended to the size of the larger operand. When both operands are signed, the expression shall be interpreted as a comparison between signed values. If the operands are of unequal bit lengths, the smaller operand shall be sign-extended to the size of the larger operand. If either operand is a real operand, then the other operand shall be converted to an equivalent real value and the expression shall be interpreted as a comparison between real values." In 4.1.8, in paragraph 2, CHANGE the sentence "These four operators compare operands bit for bit, with zero filling if the two operands are of unequal length." TO "These four operators compare operands bit for bit." INSERT the following after paragraph 2: "If the operands are of unequal bit lengths, then if one or both operands are unsigned, the smaller operand shall be zero-extended to the size of the larger operand. If both operands are signed, the smaller operand shall be sign-extended to the size of the larger operand. If either operand is a real operand, then the other operand shall be converted to an equivalent real value and the expression shall be interpreted as a comparison between real values." |
Audit-Trail |
From: Shalom.Bresticker@freescale.com To: etf-bugs@boyd.com Cc: Subject: Re: errata/106: 4.1.8 Incorrect zero extend rules for equality operators Date: Sun, 31 Oct 2004 22:44:44 +0200 (IST) PROPOSAL: In 4.1.7, CHANGE the paragraph order as follows: 1. Table 4-9 lists and defines the relational operators. 2. An expression using these relational operators shall yield the scalar ... 3. The paragraphs discussing operand types and signedness (details below) 4. The paragraphs discussing operator precedence: - All the relational operators shall have the same precedence ... - Examples: - The following examples.. - When foo - (1 < a) evaluates... REWORD the paragraphs discussing operand types and signedness as follows: "When one or both operands of a relational expression are unsigned, the expression shall be interpreted as a comparison between unsigned values. If the operands are of unequal bit lengths, the smaller operand shall be zero-extended to the size of the larger operand. When both operands are signed, the expression shall be interpreted as a comparison between signed values. If the operands are of unequal bit lengths, the smaller operand shall be sign-extended to the size of the larger operand. If either operand is a real operand, then the other operand shall be converted to an equivalent real value and the expression shall be interpreted as a comparison between real values." In 4.1.8, in paragraph 2, CHANGE the sentence "These four operators compare operands bit for bit, with zero filling if the two operands are of unequal length." TO "These four operators compare operands bit for bit." INSERT the following after paragraph 2: "If the operands are of unequal bit lengths, then if one or both operands are unsigned, the smaller operand shall be zero-extended to the size of the larger operand. If both operands are signed, the smaller operand shall be sign-extended to the size of the larger operand. If either operand is a real operand, then the other operand shall be converted to an equivalent real value and the expression shall be interpreted as a comparison between real values." On Mon, 26 Aug 2002 stefen@boyd.com wrote: > Continuation of issue #8 (4.1.8 needs to be addressed): > > Section 4.1.7 says that when a relational operator has two operands of > different sizes, then the smaller operand is zero-extended. This makes no > intuitive sense for signed operands, and it conflicts with the general rules > for determining sign given at the end of chapter 4. It also conflicts with > the behavior of Verilog-XL and NC-Verilog. > > Likewise, 4.1.8 says that the smaller operand to an equality operator is > zero-extended, which I also believe is wrong. Shalom -- 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 Shalom.Bresticker@freescale.com on Sun Oct 31 23:40:41 2004 In 4.1.7, CHANGE the paragraph order as follows: 1. "Table 4-9 lists and defines the relational operators." 2. "An expression using these relational operators shall yield the scalar ..." 3. The paragraphs discussing operand types and signedness (details below) 4. The paragraphs discussing operator precedence: - "All the relational operators shall have the same precedence ..." - "Examples:" - "The following examples.." - "When foo - (1 < a) evaluates..." REWORD the paragraphs discussing operand types and signedness as follows: "When one or both operands of a relational expression are unsigned, the expression shall be interpreted as a comparison between unsigned values. If the operands are of unequal bit lengths, the smaller operand shall be zero-extended to the size of the larger operand. When both operands are signed, the expression shall be interpreted as a comparison between signed values. If the operands are of unequal bit lengths, the smaller operand shall be sign-extended to the size of the larger operand. If either operand is a real operand, then the other operand shall be converted to an equivalent real value and the expression shall be interpreted as a comparison between real values." In 4.1.8, in paragraph 2, CHANGE the sentence "These four operators compare operands bit for bit, with zero filling if the two operands are of unequal length." TO "These four operators compare operands bit for bit." INSERT the following after paragraph 2: "If the operands are of unequal bit lengths, then if one or both operands are unsigned, the smaller operand shall be zero-extended to the size of the larger operand. If both operands are signed, the smaller operand shall be sign-extended to the size of the larger operand. If either operand is a real operand, then the other operand shall be converted to an equivalent real value and the expression shall be interpreted as a comparison between real values." |
Unformatted |
|
Hosted by Boyd Technology