errata/428: Re: errata/428: PROPOSAL - 2.5.1, value of 16'shc, request for clarification

From: Shalom Bresticker (Shalom.Bresticker@motorola.com)
Date: Mon Nov 03 2003 - 02:10:00 PST

  • Next message: Shalom Bresticker: "errata/211: Re: errata/211: PROPOSAL - 3.11.2: localparam behavior not clear"

    The following reply was made to PR errata/428; it has been noted by GNATS.

    From: Shalom Bresticker <Shalom.Bresticker@motorola.com>
    To: Brad.Pierce@synopsys.com
    Cc: etf-bugs@boyd.com
    Subject: Re: errata/428: PROPOSAL - 2.5.1, value of 16'shc, request for
     clarification
    Date: Mon, 03 Nov 2003 12:12:26 +0200

     Ouch, this is getting hard to follow, but :
     
     Brad.Pierce@synopsys.com wrote:
     
    > In 2.5.1, at the end of the first paragraph, append
    > the following sentence --
    >
    > "It shall be legal to macro substitute these
    > three tokens."
     
     Should be "end of the second paragraph".
     
     
    > In 2.5.1, REPLACE
    >
    > "The first token, a size constant, shall specify
    > the size of the constant in terms of its exact
    > number of bits. It shall be specified as a
    > non-zero unsigned decimal number. For example,
    > the size specification for two hexadecimal
    > digits is 8, because one hexidecimal digit
    > requires 4 bits. Unsized unsigned constants
    > where the high order bit is unknown (X or x)
    > or three-state (Z or z) shall be extended to
    > the size of the expression containing the
    > constant.
    >
    > WITH
    >
    > "The first token, a size constant, shall specify
    > the size of the constant in terms of its exact
    > number of bits. It shall be specified as a
    > non-zero unsigned decimal number. For example,
    > the size specification for two hexadecimal
    > digits is 8, because one hexidecimal digit
    > requires 4 bits. The number of bits that
    > make up an unsized integer constant (which is
    > a simple decimal number or a based constant
    > without a size constant) shall be at least 32.
    > An unsized integer constant shall be extended to
    > the size of the expression that contains it by
    > padding to the left with the leftmost bit of the
    > constant, unless the constant is unsigned and its
    > leftmost bit is 1, in which case it shall be padded
    > to the left with zero. If a sized integer constant
    > is signed, it shall be sign-extended when assigned
    > to a reg data type, regardless of whether the reg
    > itself is signed."
     
     I propose to change the phrase "size constant" to "size specification" everywhere
     in this section, to distinguish it more clearly from "sized constant" and in
     general the term "constant", which in this section refers to the entire number,
     including all its three tokens.
     
     I don't like the second half of this, after "at least 32".
     I don't think it belongs here, because this section of the text is briefly
     describing the three tokens, and this is diverting the discussion elsewhere.
     I also think it makes the paragraph too long.
     
     Furthermore, I am not sure that the rule here "An unsized integer constant ..." is
     always true, because there are operators which treat all their operands as unsigned
     even if they are signed (e.g., bit-wise &). As far as I can tell, this is new text
     from Brad. Also the wording is awkward.
     
     Two more comments below, after the examples:
     
     
    > In 2.5.1, REPLACE
    >
    > "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."
    >
    > WITH
    >
    > "If a sized constant has an unsigned number
    > (i.e., third token) with a value that has
    > fewer bits than are specified by its size constant
    > (i.e., first token), the value of the unsigned
    > number shall be extended to the specified number
    > of bits by padding it to the left with zero (even
    > if the constant is signed), unless the leftmost bit
    > in the unsigned number is x or z, in which case
    > it shall be padded to the left with x or z
    > respectively."
    >
    >
    > In Example 4 of 2.5.1
    >
    > REPLACE
    >
    > reg[11:0] a, b, c, d;
    > initial begin
    > a = 'h x; // yields xxx
    > b = 'h 3x; // yields 03x
    > c = 'h z3; // yields zz3
    > d = 'h 0z3; // yields 0z3
    > end
    > reg [84:0] e, f, g;
    >
    > e = 'h5; // yields {82{1'b0}, 3'b101}
    > f = 'hx; // yields {85{1'hx}}
    > g = 'hz; // yields {85{1'hz}}
    >
    > WITH
    >
    > reg[11:0] a, b, c, d;
    > initial begin
    > a = 'h x; // yields 12'h xxx
    > b = 'h 3x; // yields 12'h 03x
    > c = 'h z3; // yields 12'h zz3
    > d = 'h 0z3; // yields 12'h 0z3
    > end
    > reg [84:0] e, f, g, h, i;
    > reg signed [84:0] j, k;
    >
    > e = 'h5; // yields {{82{1'b0}}, 3'b101}
    > f = 'hx; // yields {85{1'bx}}
    > g = 'hz; // yields {85{1'bz}}
    > h = 4'hx; // yields {{81{1'b0}}, 4'hx}
    > i = 16'ox; // yields {{69{1'b0}}, {16{1'bx}}}
    > j = 16'sb110; // yields {{82{1'b0}}, 3'b110}
    > k = 3'sb110; // yields {{82{1'b1}}, 3'b110}
     
     I propose to write j as:
     
     j = 16'sb110 // yields {{69{1'b0}, {13{1'b0}, 3'b110}}
     
     However, now I have a new concern, that we are in 2.5.1, before the concatenation
     and replication operators have even been introduced.
     
     
    > and
    >
    > REMOVE
    >
    > NOTES:
    >
    > 1) Sized negative constant numbers and sized unsigned
    > constant numbers are sign-extended when assigned to a
    > reg data type, regardless of whether the reg itself is
    > signed or not.
    >
    > 2) Each of the three tokens for specifying a number
    > may be macro substituted.
    >
    > 3) The number of bits that make up an unsized number
    > (which is a simple decimal number or a number without
    > the size specification) shall be at least 32.
    >
    > http://boydtechinc.com/cgi-bin/issueproposal.pl?cmd=view&database=default&pr=428
     
     --
     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
     
     
     



    This archive was generated by hypermail 2.1.4 : Mon Nov 03 2003 - 02:10:05 PST and
    sponsored by Boyd Technology, Inc.