ISSUE 594

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 594
Category enhancement
Synopsis Allowing parameters to define the length of a constant
State open
Class enhancement
Arrival-DateJul 19 2004
Originator Shalom Bresticker <Shalom.Bresticker@freescale.com>
Release 2001b
Description
This comes from B31 of the old enhancement request list for 1364-2001, by Adam
Krolnik.

The original request was as follows:

Currently the only acceptable way to define the size of a constant is with a
constant number, or a preprocessor substitution. Allowing parameters would at
least bring numbers to the abilities of ports and other sized data types.

Please consider allowing parameters (at the least) to define the length of a
constant. Should there be other ways to specify the size of a value? Should
there
be a restriction that the size be constant?

An Example

module tst;

`define length 4
`define width 6
parameter size = `len * `wid;

reg[`width:1] a, out;
reg[`length*`width:1] b;

initial begin
$display("Size is %0d.", size);
b = size 'b0; // Using parameter to specify size.
end

always @(clk) begin
{out, b} = {b, a};
end
endmodule

Proposed text:

To section 2.5.1 "Integer constants" third paragraph, second sentence, which
reads:
"It [size constant] shall be specified as an unsigned decimal number."

Replace it with:

"It [size constant] shall be specified as an unsigned decimal number or a
parameter."

BNF:

size ::=
unsigned_number
| parameter_identifier

-----------------------------------------------------

SV has casting operation, but apparently does not have ability to cast to
a parametric length.

Discussion:

Shalom: This would be useful.
Steven: There could be order dependencies, since parameter values
are only determined at elaboration time. Need restrictions.
If we did this as a conversion function instead of as part of the
syntax for specifying a constant, it would be better.
Shalom: OK
MEDIUM-HIGH priority.

Fix

Unknown
Unformatted



Hosted by Boyd Technology