Enhancement request: Specification of sized constants

From: Adam Krolnik (adamk@cyrix.com)
Date: Mon Apr 06 1998 - 21:51:02 PDT


Good morning:

I am including the BNF and text changes for consideration of this enhancement.

Motivation:
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.

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

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

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

ize ::=
   unsigned_number
 | parameter_identifier

<p> Adam Krolnik
         Verification Engineer
         Cyrix - NSM.
         Richardson TX 75085



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:52:47 PDT and
sponsored by Boyd Technology, Inc.