ISSUE 547

Number 547
Category enhancement
Synopsis define size zero replication constant
State lrmdraft
Class enhancement
Arrival-DateFeb 19 2004
Originator Shalom.Bresticker@motorola.com
Release 2001c: 4.1.14
Description
In 1364-2001, we have defined a replication constant of zero to be illegal.

In my company, using parameters for various values, we have repeatedly
found that it would be useful for a replication constant of zero to be
defined. Typically it is used as part of a larger concatenation.

I would expect a zero replication to be null, that is,
{1'b1, {0{1'b0}}, 1'b1} would give me 2'b11.


--
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

[x]Motorola General Business Information
[ ]Motorola Internal Use Only
[ ]Motorola Confidential Proprietary

Fix
In 4.1.14 (Concatenations):

CHANGE

"An operator that can be applied only to concatenations is replication, which is
expressed by a concatenation preceded by a positive, non-x and non-z constant
expression, enclosed together within brace characters, and which indicates a
joining together of that many copies of the concatenation."

TO

"An operator that can be applied only to concatenations is replication, which is
expressed by a concatenation preceded by a non-negative, non-x and non-z
constant expression, called a replication constant, enclosed together
within brace characters, and which indicates a joining together of that many
copies of the concatenation."

DELETE the example

{0{1'b0}} // illegal

At the end of 4.1.14, ADD the following:

A replication operation may have a replication constant with a value of
zero. This is useful in parameterized code. A replication with a zero
replication constant is considered to have a size of zero and is ignored.
Such a replication shall appear only within a concatenation in which at
least one of the operands of the concatenation has a positive size.


Examples:

parameter P = 32;

// The following is legal for all P from 1 to 32

assign b[31:0] = { {32-P{1'b1}}, a[P-1:0] } ;

// The following is illegal for P=32,
// because the zero replication appears alone within a concatenation

assign c[31:0] = { {{32-P{1'b1}}}, a[P-1:0] } ;

// The following is illegal for P=32

initial
$displayb({32-P{1'b1}}, a[P-1:0]);
Audit-Trail
From: Shalom.Bresticker@freescale.com
To: btf-bugs@boyd.com
Cc:
Subject: Re: enhancement/547: define size zero replication constant
Date: Sun, 30 May 2004 08:24:43 +0300 (IDT)

An independent development of the same enhancement:

---------- Forwarded message ----------
Date: 28 May 2004 23:03:05 GMT
From: Steve Meyer <sjmeyer@www.tdl.com>
Reply-To: sjmeyer@pragmatic-c.com
Newsgroups: comp.lang.verilog
Subject: Re: Repeat concatenation and Modelsim

GPL Cver allows 0 width concats because a user we were not matching XL.
The algorithm is that a 0 repeat count removes the element. It is then
an error if the entire concatenate disappers (i.e. becomes zero width).
Here is the bug report test:

============

module top;
reg [10:0] rf_addr_ext;
reg [10:0] rf_addr;
parameter AW = 5;
parameter DW = 5;
initial begin
rf_addr_ext = {{AW - DW{1'b0}}, rf_addr};
end

endmodule

============

On Tue, 25 May 2004 16:18:38 +0100, DW <dave_wooff@hotmail.com> wrote:
> Hello,
> Can anyone confirm that the Verilog language definition rules out a repeat
> concatenation of 0. i.e.
> {0{1'b1}} is NOT allowed.
>
> Modelsim Altera v5.7e seems to let this pass and produces invalid code.
> Quartus II version 3.0 seems to reject the use of this, although I have been
> informed that a later release (version 4.0 I believe) allows it (when it
> apparently should not).
>
> Although the example given is simplistic, I had used a combination of
> defparam'd parameters which produced the 0 repeat. I do not have a complete
> language reference (could be a good investment).



From: Shalom.Bresticker@freescale.com
To: etf-bugs@boyd.com
Cc:
Subject: Re: enhancement/547: define size zero replication constant
Date: Fri, 22 Oct 2004 11:44:11 +0200 (IST)

On Thu, 19 Feb 2004, Shalom Bresticker wrote:

> In 1364-2001, we have defined a replication constant of zero to be illegal.
>
> In my company, using parameters for various values, we have repeatedly
> found that it would be useful for a replication constant of zero to be
> defined. Typically it is used as part of a larger concatenation.
>
> I would expect a zero replication to be null, that is,
> {1'b1, {0{1'b0}}, 1'b1} would give me 2'b11.

PROPOSAL:

In 4.1.14 (Concatenations):

In the paragraph beginning,
"Another form of concatenation is the replication operation. The first
expression shall be a constant expression with a positive integral value,"

CHANGE "positive" to "non-negative".

At the end of 4.1.14, ADD the following:

A replication operation may have a replication constant with a value of
zero. This is useful in parameterized code. A replication with a zero
replication constant is considered to have a size of zero and is ignored.
A zero replication shall appear only within a concatenation in which at
least one of the operands of the concatenation has a positive size.

Examples:

parameter P = 8;

reg[31:0] r ;
reg[P-1:0] a ;

r = { {16{1'b1}}, 16-P{1'b0}, a[P-1:0]} ;
// legal - For P=8, this is {16{1'b1}}, 8{1'b0}, a[7:0]}

// legal - For P=16, this is {16{1'b1}}, a[15:0]}
--
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

From: Shalom.Bresticker@freescale.com
To: etf-bugs@boyd.com
Cc:
Subject: Re: enhancement/547: define size zero replication constant
Date: Fri, 22 Oct 2004 11:47:32 +0200 (IST)

Sorry, did not mean to send that yet.
I was working on a draft of a proposal.

--
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 Mon Oct 25 00:54:45 2004

In 4.1.14 (Concatenations):

CHANGE

"An operator that can be applied only to concatenations is replication, which is
expressed by a concatenation preceded by a positive, non-x and non-z constant
expression, enclosed together within brace characters, and which indicates a
joining together of that many copies of the concatenation."

TO

"An operator that can be applied only to concatenations is replication, which is
expressed by a concatenation preceded by a non-negative, non-x and non-z
constant expression, called a replication constant, enclosed together
within brace characters, and which indicates a joining together of that many
copies of the concatenation."

DELETE the example

{0{1'b0}} // illegal

At the end of 4.1.14, ADD the following:

A replication operation may have a replication constant with a value of
zero. This is useful in parameterized code. A replication with a zero
replication constant is considered to have a size of zero and is ignored.
Such a replication shall appear only within a concatenation in which at
least one of the operands of the concatenation has a positive size.


Examples:

parameter P = 32;

// The following is legal for all P from 1 to 32

assign b[31:0] = { {32-P{1'b1}}, a[P-1:0] } ;

// The following is illegal for P=32,
// because the zero replication appears alone within a concatenation

assign c[31:0] = { {{32-P{1'b1}}}, a[P-1:0] } ;

// The following is illegal for P=32

initial
$displayb({32-P{1'b1}}, a[P-1:0]);

Unformatted


Hosted by Boyd Technology