Re: [sv-bc] Is '1 allowed in a concatenation?

From: Clifford E. Cummings <cliffc@sunburst-design.com>
Date: Mon Mar 22 2010 - 07:39:40 PDT

Hi, Shalom -

There may be a wording problem in the standard, but adding '1 or '0
to a concatenation is the same as adding 1'b1 or 1'b0.

I point this out as an exception to '0 and '1 expansion in my training classes.

Rationale:
What would be expected if you had declared:
logic [15:0] data1 = {'1,8'hAA};
logic [15:0] data2 = {8'hAA, '1};
logic [15:0] data3 = {'0, 8'hAA,'0, '1};

There would have to be some rather interesting assumptions on the
part of the compiler to determine the intended size of the '0 or '1
expansion, including a number of special cases. The assumptions might
not be obvious to an end user and debugging these declarations might
be rather time-consuming.

It was just easier to say that in these self-determined contexts,
each '1 or '0 is just a single bit.

Regards - Cliff

At 05:46 AM 3/22/2010, Bresticker, Shalom wrote:
>Is a literal like '1 allowed in a concatenation?
>
>On the one hand, 11.4.12 says, "Unsized constant numbers shall not
>be allowed in concatenations. This is because the size of each operand in
>the concatenation is needed to calculate the complete size of the
>concatenation."
>
>On the other hand, 5.7.1 says, "An unsized single-bit value can be
>specified by preceding the single-bit value with an apostrophe ( '
>), but without the base specifier. All bits of the unsized value
>shall be set to the value of the specified bit. In a self-determined
>context, an unsized single-bit value shall have a width of 1 bit,
>and the value shall be treated as unsigned."
>
>I tend to the interpretation that they are not allowed.
>
>Shalom
>
>Shalom Bresticker
>Intel LAD DA, Jerusalem, Israel
>+972 2 589 6582 (office)
>+972 54 721 1033 (cell)
><http://www.linkedin.com/in/shalombresticker>http://www.linkedin.com/in/shalombresticker

----------------------------------------------------
Cliff Cummings - Sunburst Design, Inc.
14355 SW Allen Blvd., Suite #100, Beaverton, OR 97005
Phone: 503-641-8446 / FAX: 503-641-8486
cliffc@sunburst-design.com / www.sunburst-design.com
World Class Verilog & SystemVerilog Training

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Mar 22 07:40:05 2010

This archive was generated by hypermail 2.1.8 : Mon Mar 22 2010 - 07:40:14 PDT