[sv-cc] Import fn return value datatype: default issue

From: Duncan, Ralph <ralph_duncan@mentorg.com>
Date: Tue Jul 20 2004 - 17:11:02 PDT

First, my apologies for sending this the day before the meeting.
However, I wanted to at least mention this matter, since it has
already affected several DPI users.

SUMMARY:
The current LRM grammmar appears to require DPI import function
declarations to specify function return value data types (see below).

If this is what we prefer, it would be helpful to state this in
section 27.4.5 'Function Result.'

Otherwise, we would need to:
. pick a reasonable type to which the return value would default,
. alter the grammar in 27.4.4, A.2.6, etc.
. (optional) state this in 27.4.5.

DISCUSSION:
Requiring users to specify an imported function's return value
data type seems reasonable, since C and System Verilog users are
likely to expect different defaults (e.g., to 4-state logic vs. 2-state
int).

Whatever the decision, however, we should at least state the whether
defaults are forbidden or legal in the Function Return section (27.4.5).

Regardless, thanks for considering this one.

Ralph
  
---------------------
  
GRAMMAR DETAILS:

In A.2.6 we have
dpi_function_proto => function_prototype
function_prototype => 'function' function_data_type function_identifier
                      '('[tf_port_list]')'
function_data_type => data_type
                   | 'void'

Since data_type does not derive any RHS that consists of the empty
string or
that can be replaced by it, default fn return types are effectively
forbidden.
The productions involving data_type in A.2.2.1 are:

data_type =>
        integer_vector_type ...
        | integer_atom_type ...
        | non_integer_type
        | struct_union ....
        | 'enum' ...
        | 'string'
        | 'chandle'
        | 'virtual'...
        | [class_scope | package_scope] type_identifier ...
        | class_type
        | 'event'
        | ps_covergroup_identifier
Received on Tue Jul 20 17:11:12 2004

This archive was generated by hypermail 2.1.8 : Tue Jul 20 2004 - 17:11:25 PDT