[sv-bc] Disagreement with Closure of 19-66


Subject: [sv-bc] Disagreement with Closure of 19-66
From: Matt Maidment (mmaidmen@ichips.intel.com)
Date: Mon Feb 03 2003 - 15:46:15 PST


Hello All.

I would like to hear more about why 19-66 should be closed.
The minutes of the 1/29 BNF meeting do not give any indication.
Dan Jacobi clued me in on this (thanks, Dan) but I would like
a chance to represent 19-66 as I was the one who first raised it.
Morever, the wording of 19-66 looks like a very small BNF issue,
but by exposing my motivation maybe a solution will work for all.
I ended up with parameters in $root because I need to:

1. Establish a set of constants in view of many modules
(And not have to include them in every module!)

2. Allow these constants to be typed so that they can be
used in expressions (e.g. PARAM[3:2] - (4'b0011)[3:2] won't do!)

3. Present as many constants as possible to the tools by
the end of elaboration.

4. const variables are only defined at runtime

5. Not use localparams because the name and legacy idea didn't
match my intentions-- Why would I use a _local_param to do a
_global_ job? :-)

Finally, the reference simulator allowed parameters in $root,
so I went with those. It reads just fine and I get 1-5.

Here's some code to demonstrate:

parameter WIDTH = 3;
parameter logic [3:0] MASK = 3'b101101;

module example1 (input logic [2:0] afield);

logic [WIDTH-1:0] onefield;

always_comb
  goodfield = afield & MASK[5:3];

endmodule

module example1 (input logic [2:0] afield);

logic [WIDTH-1:0] twofield;

always_comb
  twofield = afield & MASK[2:0];

endmodule

The one problem with using parameters is that they can
be redefined at will. With localparams, once I've set
them there's no assignment. So maybe I should be satisfied
with localparam--- but I have a hard time getting over the
local name vs. global scope conflict.

The reference simulator supports the functionality I've coded and
the BNF from 1364-2001 seems to indicate a time when parameters
where treated equally so perhaps the 3.0 BNF is flawed. Here's the
1364-2001 BNF for a module_item:

module_item ::=
module_or_generate_item
| port_declaration ;
| { attribute_instance } generated_instantiation
| { attribute_instance } local_parameter_declaration
| { attribute_instance } parameter_declaration
| { attribute_instance } specify_block
| { attribute_instance } specparam_declaration

And in SV 3.0, parameters have been split up so I can't get
there from here!!!

source_text ::= [timeunits_declaration]{description}
description ::=
       module_declaration
      |udp_declaration
      |module_root_item <<< This is a subset of module_item
      |statement

module_root_item ::=
   {attribute_instance} module_instantiation
 | {attribute_instance} local_parameter_declaration
 | interface_declaration
 | module_common_item

Comments? Can someone explain the motivation for not including
parameters in $root?

TIA,

Matt



This archive was generated by hypermail 2b28 : Mon Feb 03 2003 - 15:47:15 PST