[sv-bc] Partial proposal for issue #091- take #2

From: Jacobi, Dan <dan.jacobi@intel.com>
Date: Mon Aug 23 2004 - 07:22:23 PDT

I enhanced the original proposal to capture Shalom's remarks.
This should prevent the generation of compilation loops and other
pathological cases.
The general idea is to prevent the use of hierarchical references (by
adding a footnote to the BNF)
 
Following is the enhanced proposal :

This proposal intends to solve the first part of the problem described
in
    http://www.eda.org/svdb/bug_view_page.php?bug_id=0000091
<http://www.eda.org/svdb/bug_view_page.php?bug_id=0000091>
"$typeof function as used in 23.2 is not fully supported in the BNF"

Motivation
========
The example in section 23.2 in the (original) SV 3.1a LRM uses the
$typeof system function to set the default type of a type parameter:
    Example 1:
    bit [12:0] A_bus, B_bus;
    parameter type bus_t = $typeof(A_bus);
 
Also we would like to enable the override of type parameters using the
$typeof system function such as:
    Example 2:
    son #( .son_type_param($typeof(A_bus) ) myson (...);
 
Section 23.2 also reads:
"The $typeof system function returns a type derived from its argument.
The data type returned by the
$typeof system function may be used to assign or override a type
parameter, or in a comparison with another
$typeof, evaluated during elaboration."
 
However the BNF does not enable the usage of the $typeof system function
to assign a type parameter value as shown in example 1 (Note that it
does permit the overriding of the type parameters as shown in example 2)
 
The type parameter type declaration BNF reads :
 
A.2.2.1
    parameter_declaration ::=
        parameter data_type_or_implicit list_of_param_assignments
        | parameter type list_of_type_assignments
A.2.3
    list_of_type_assignments ::= type_assignment { , type_assignment }
A.2.4
    type_assignment ::= type_identifier = data_type

 
Note that the parameter override as shown in example 2 is enabled using
the following rules from the BNF
 
A.4.1.1
    ordered_parameter_assignment ::= param_expression
    named_parameter_assignment ::= . parameter_identifier ( [
param_expression ] )
A.8.3
    param_expression ::= mintypmax_expression | data_type
the mintypmax_expression token eventually reduces the system function
call rule
 
 
Proposal
=======
 
Under section A.2.4
 
REPLACE
    type_assignment ::= type_identifier = data_type
WITH
    type_assignment ::= type_identifier = data_type
        | type_identifier = $typeof ( expression 28 )
        | type_identifier = $typeof ( data_type )
 
* Equal signs = parentheses () and the sequences $typeof or all in bold
** the number 28 is in supper script indicating a reference to a
footnote
 
Under Annex A Footnote sections
ADD
28) The expression that was is used as the argument to the $typeof
system function shall contain no hierarchical references.
 
Notes
=====
this proposal will also enable V2K style module declarations with type
parameters such as
    module m1 #( $typeof(A_bus) ) (input ....)
 
and the usage of the $typeof system function to declare type parameters
in class, program and interface declarations as well.
 
 
 
Thanks,
Dan Jacobi, Intel Corporation
972-4-8655855
Received on Mon Aug 23 07:22:31 2004

This archive was generated by hypermail 2.1.8 : Mon Aug 23 2004 - 07:22:43 PDT