RE: [sv-bc] localparam declarations in V2K-style parameter port lists

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Wed Oct 26 2005 - 04:09:43 PDT
This is old 1364 BTF issue #191.

Shalom


>-----Original Message-----
>From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On
>Behalf Of Brad Pierce
>Sent: Monday, October 24, 2005 10:40 PM
>To: sv-bc@eda.org
>Subject: [sv-bc] localparam declarations in V2K-style parameter
>port lists
>
>As noted in V2K+5, subclause 12.2, "There are two different
>ways that
>parameters can be defined. The first is the
>module_parameter_port_list
>(see 12.1), and the second is as a module_item (see 4.10)."
>
>However, there is only one way to write a local parameter -- as
>an
>old-style module_item.
>
>This means that ANSI-style port declarations cannot refer to
>local
>parameters.
>
>For example, this is disallowed
>
>    module m #(parameter N = 16,
>               localparam myN = (N > 32) ? $clog2(32) :
>$clog2(N))
>           (input [myN-1:0] in, output [myN-1:0] out);
>
>so to get the effect one must either do
>
>    module m #(parameter N = 16)
>           (input [((N > 32) ? $clog2(32) : $clog2(N))-1:0] in,
>            output [((N > 32) ? $clog2(32) : $clog2(N))-1:0]
>out);
>
>or
>
>    module m (in, out);
>    parameter N = 16;
>    localparam myN = (N > 32) ? $clog2(32) : $clog2(N);
>    input [myN-1:0] in;
>    output [myN-1:0] out;
>
>-- Brad
>
Received on Wed Oct 26 04:10:04 2005

This archive was generated by hypermail 2.1.8 : Wed Oct 26 2005 - 04:11:21 PDT