RE: [sv-bc] Function declaration proposal


Subject: RE: [sv-bc] Function declaration proposal
From: Jacobi, Dan (dan.jacobi@intel.com)
Date: Thu Jan 30 2003 - 02:55:24 PST


I'm adjusting my original proposal to comply SV-BC-55
(packed integer arrays).

----- SV-BC Issues -----
This proposal replaces / overlaps / corrects the following SV-BC issues:
- SV-BC-50, A.2.6 signedness in function BNF, P-0290
- SV-BC-19-17a (A.2.6) signed function declarations P-0290

------ Motivation ------
The location of the signing of a function declaration is problematic
the following declarations comply with the currently BNF.
        function signed void foo1(...);
Can all function types be signed ?
        function signed bit unsigned foo2(...);
Is this function signed or not?

The following proposal will support the signing of a function by adding
the signing token BEFORE the range or type of the function
such as
        function signed reg foo; ....
        function unsigned [1:0] bar(...); ....

This proposal will also remove disable the declaration of a signal with a
void type (this will align the BNF with the language in 3.4.3 - page 7)
such as :
        void aVoid;...
        input void aVoidInput;
        

----- Verilog 2001 -----
In Verilog 2001 the signing is located before the function's type or
range. Also the Verilog 2001 BNF uses a different production to parse the
function type (the production range_or_type parses all the possible function
types - page 716).

-------- Proposal -------
1) Under A.2.6

1.1) REPLACE (adding a footnote)
   function_declaration ::=
   'function' [ 'automatic' ] [ signing ] [ range_or_type ]
   [ interface_identifier '.' ] function_identifier ';'
   { function_item_declaration }
   { function_statement }
   'endfunction' [ ':' function_identifier ]
   | 'function' [ 'automatic' ] [ signing ] [ range_or_type ]
   [ interface_identifier '.' ] function_identifier
   '(' function_port_list ')' ';'
   { block_item_declaration }
   { function_statement }
   'endfunction' [ ':' function_identifier ]
 WITH
   function_declaration10 ::= <superscript 10>
   'function' [ 'automatic' ] [ signing ] [ range_or_type ]
   [ interface_identifier '.' ] function_identifier ';'
   { function_item_declaration }
   { function_statement }
   'endfunction' [ ':' function_identifier ]
   | 'function' [ 'automatic' ] [ signing ] [ range_or_type ]
   [ interface_identifier '.' ] function_identifier
   '(' function_port_list ')' ';'
   { block_item_declaration }
   { function_statement }
   'endfunction' [ ':' function_identifier ]

1.2) REPLACE
      function_prototype ::= 'function' data_type
                  '(' list_of_function_proto_formals ')'
    WITH
      function_prototype ::= 'function' function_data_type
                  '(' list_of_function_proto_formals ')'

see my question at the end of this E-mail regarding this production.

1.3) REPLACE
      named_function_proto::= 'function' data_type function_identifier
             '(' list_of_function_proto_formals ')'
    WITH
      named_function_proto::= 'function' function_data_type
             function_identifier '(' list_of_function_proto_formals ')'

1.4) REPLACE
      range_or_type ::=
         { packed_dimension } range
         | data_type
    WITH
      range_or_type ::=
         { packed_dimension } range
         | function_data_type

1.5) ADD the following production:
  function_data_type ::=
  integer_vector_type { packed_dimension } [ range ]
  | integer_atom_type
  | type_declaration_identifier
  | non_integer_type
  | 'struct' [' packed' ] '{'{ struct_union_member } '}'
  | 'union' [ 'packed' ] '{' { struct_union_member } '}'
  | 'enum' [ integer_type { packed_dimension } ]
  '{' enum_identifier [ '=' constant_expression ]
  { ',' enum_identifier [ '=' constant_expression ] } '}'
  | 'void'

2) Under the foot note section at the end of the BNF:
2.1) Add the following footnote
        10 void functions, non integer type functions, and functions with a
         typedef type cannot have a signing declaration.

3) Under A.2.2.1:
3.1) REPLACE (removing the void type)
    data_type ::=
     integer_vector_type [ signing ] { packed_dimension } [ range ]
     | integer_atom_type [ signing ] { packed_dimension }
     | type_declaration_identifier
     | non_integer_type
     | 'struct' [' packed' ] [ signing ] '{'{ struct_union_member } '}'
     | 'union' [ 'packed' ] [ signing ] '{' { struct_union_member } '}'
     | 'enum' [ integer_type [ signing ] { packed_dimension } ]
     '{' enum_identifier [ '=' constant_expression ]
     { ',' enum_identifier [ '=' constant_expression ] } '}'
     | 'void'
   WITH
    data_type ::=
     integer_vector_type [ signing ] { packed_dimension } [ range ]
     | integer_atom_type [ signing ]
     | type_declaration_identifier
     | non_integer_type
     | 'struct' [' packed' ] [ signing ] '{'{ struct_union_member } '}'
     | 'union' [ 'packed' ] [ signing ] '{' { struct_union_member } '}'
     | 'enum' [ integer_type [ signing ] { packed_dimension } ]
     '{' enum_identifier [ '=' constant_expression ]
     { ',' enum_identifier [ '=' constant_expression ] } '}'

----- A Question ----
Does any body know where the terminal "function_prototype" is used
in the BNF?

Can we remove the following production from A.2.6 ?
        function_prototype ::= 'function' data_type
                  '(' list_of_function_proto_formals ')'
Dan Jacobi
Phone : (972)-4-8655855



This archive was generated by hypermail 2b28 : Thu Jan 30 2003 - 02:55:59 PST