Re: ANSI-Parameter List Bug and Ambiguities

From: Clifford E. Cummings (cliffc@sunburst-design.com)
Date: Wed Jan 09 2002 - 10:02:00 PST


Precedence: bulk

Mac & Paul make good points; I had not thought of running the addition in
the port declarations themselves (duh!)

Let me pursue this a little further because I think there still may be
value in adding the localparam to the parameter-interface list.

The example I gave was a very simple one. If one or more calculated values
happen to be used in a large number of declarations, it will become quite
tedious, verbose and perhaps confusing to place the calculation(s) into all
of the required declarations.

Second, with the advent of constant functions, added to Verilog-2001 to
calculate more complex local parameter values from existing parameter
values, I could foresee the possible need to define a parameter based on a
constant function before making ANSI-port declarations. I don't see a clean
way to do this without defining the localparam in the parameter-interface.

More on parameter lists and localparams in a separate email (so the topics
do not get lost in this thread).

Regards - Cliff

At 08:57 AM 1/9/02 -0800, you wrote:

>I have to say I agree with Paul here.
>
>1) his point about limiting to the interface definition only interface
> issues is spot on;
>
>2) his proposed workaround is quite reasonable, and fits with #1
>
>3) with the two above points, IMHO, it is not worth opening up the
> standard for this.
>
>BTW: An alternative non syntactical change would be to allow use of
>localparams before definition; as the complier need only search the
>containing module to find the local param definition.
>
>Downside of this would be that in examining just the interface
>definition one would see this unexplained use of a localparam
>'YWIDTH':
>
> module multiplier #(parameter AWIDTH=8, BWIDTH=8)
> (output [YWIDTH-1:0] y,
> input [AWIDTH-1:0] a,
> input [BWIDTH-1:0] b);
> localparam YWIDTH=AWIDTH+BWIDTH;
> assign y = a * b;
> endmodule
>
>In any case, I agree with Paul that we should leave this as is.
>
>Paul Graham writes:
> > > Did we want to broach the issue of localparam being added to the ANSI-C
> > > parameter list? Below is a model that requires the ANSI-style
> localparam;
> > > otherwise, the model would have to be coded using the more verbose
> > > old-style parameters and ports.
> > >
> > > module multiplier #(parameter AWIDTH=8, BWIDTH=8;
> > > localparam YWIDTH=AWIDTH+BWIDTH)
> > > (output [YWIDTH-1:0] y,
> > > input [AWIDTH-1:0] a,
> > > input [BWIDTH-1:0] b);
> > > assign y = a * b;
> > > endmodule
> >
> > Can't you just code it like:
> >
> > module multiplier #(parameter AWIDTH=8, BWIDTH=8)
> > (output [AWIDTH+BWIDTH-1:0] y,
> > input [AWIDTH-1:0] a,
> > input [BWIDTH-1:0] b);
> > assign y = a * b;
> > endmodule
> >
> > I see that it's convenient to have a localparam in an interface list,
> > but then what's the point of having an interface list if it's going to
> > contain non-interface items?
> >
> > Paul

//*****************************************************************//
// Cliff Cummings Phone: 503-641-8446 //
// Sunburst Design, Inc. FAX: 503-641-8486 //
// 14314 SW Allen Blvd. E-mail: cliffc@sunburst-design.com //
// PMB 501 Web: www.sunburst-design.com //
// Beaverton, OR 97005 //
// //
// Expert Verilog, Synthesis and Verification Training //
//*****************************************************************//



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