[sv-bc] Partial proposal for issue #091

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

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 )
        | type_identifier = $typeof ( data_type )
 
* Equal signs = parentheses () and the sequences $typeof or all in bold
 
 
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 05:28:15 2004

This archive was generated by hypermail 2.1.8 : Mon Aug 23 2004 - 05:28:52 PDT