RE: port dependence on localparams

From: Michael McNamara (mac@verisity.com)
Date: Thu Jul 26 2001 - 11:08:40 PDT


Steven Sharp writes:
> Precedence: bulk
>
> However, if the new "ANSI-C style" module declarations are used, port
> declarations cannot depend on localparams. The "ANSI-C style" declarations
> put the parameter declarations ahead of the port declarations, which allows
> them to be used in the port declarations. However, localparams cannot be
> declared until after the module port list, and therefore cannot be used in
> them. This was presumably not deliberate, but it is in the standard.
>
> Steven Sharp
> sharp@cadence.com
>
>

*sigh* You are correct. As stated in 1364-2001, use of parameterized
ports and ANSI declarations is not possible.

We did discuss this, and at one point there was a proposal that one
could have parameter declarations inside the port list, and that these
parameters would be the only ones that were overridable:

module foo (
  parameter width=8,
  parameter span=4,
  input inbus[width-1:0],
  output reg outbus[(width*span)-1:0],
  input clk);

  integer count = 1;

  parameter pi = 3.1415926459045; // not overrideable (excepting in Ohio)
  
  always @(clk) begin
    outbus[count*width :- width] = inbus;
    count = count = span ? 1 : count + 1;
  end
endmodule

While quite clean, as basically the entire interface for the module is
encapsulated in the parens after the module name, the downside is that
existing designs would break.

Against that fairly major downside, and with the other proposal to
introduce localparms, the parameters in the port list amendment died.

Of course if Cadence chose to allow parameter declarations in the port
list...

-mac



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