re: [sv-bc] Parameter types: question about scope


Subject: re: [sv-bc] Parameter types: question about scope
From: Mark Hartoog (Mark.Hartoog@synopsys.com)
Date: Fri Sep 12 2003 - 13:28:48 PDT


> Question/Issue:
>
> In a parameter list, can a type parameter be followed by another
> parameter of that type? e.g.,
>
> module foo #(parameter type T = int; parameter T x = 0;)
>
> For example, this would be useful to parameterize a module over a
> type (T) and an initial value (x) of that type.

I see no reason whey this should not be allowed, although the BNF is
a little vague.

parameter_declaration ::=
    parameter data_type list_of_param_assignments

data_type ::=
      integer_vector_type [ signing ] { packed_dimension } [ range ]
    | integer_atom_type [ signing ]
    | type_declaration_identifier { packed_dimension }
    | non_integer_type
    | struct packed [ signing ] { { struct_union_member } } { packed_dimension }
    | union packed [ signing ] { { struct_union_member } } { packed_dimension }
    | struct [ signing ] { { struct_union_member } }
    | union [ signing ] { { struct_union_member } }
    | enum [ integer_type [ signing ] { packed_dimension } ]
      { enum_identifier [ = constant_expression ] { , enum_identifier [ = constant_expression ] } }
    | string
    | event
    | chandle
    | class_scope_type_identifier

I have assumed that type_declaration_identifier included the names of
type parameters, but I don't think there is anything in the LRM that
indicates that. If it doesn't, then I don't seen any BNF rules that
allow variables of type parameter types.

By the way, the correct syntax for these parameters is comma separated.
It was a mistake on the V2k LRM BNF that had the ';' separator. The IEEE
errata committee has voted to correct this, and it is corrected in the
System Verilog LRM.

Mark Hartoog
700 E. Middlefield Road
Mountain View, CA 94043
650 584-5404
markh@synopsys.com



This archive was generated by hypermail 2b28 : Fri Sep 12 2003 - 13:37:43 PDT