RE: [sv-bc] Mantis 1571: Add default values for macro arguments

From: Rich, Dave <Dave_Rich_at_.....>
Date: Tue Oct 10 2006 - 14:24:51 PDT
  

Shalom,

 

Someone forwarded me a list of enhancements that are being talked about
in the OVL and possibly the SV-AC committees. I don't know if this is
related to your request, but it seems to me they are creating a whole
new language using macro syntax, and I find it horrible that someone
would propose different macro functionality for different parts of the
language.

 

My basic objection to macros is that they are very difficult to debug,
and they are usually there as a hack to cover up a language deficiency.
I'd rather spend the effort addressing the original need, and staying
away from the use of macros. One other point for this particular
enhancement is with defaults values is that it is not very readable
without pass by name. I think we have already shown that the pass by
name syntax is not backward compatible with existing Verilog code.

Dave

Attached:

From: Korchemny, Dmitry [mailto:dmitry.korchemny@intel.com] 
Sent: Monday, October 09, 2006 12:18 AM
To: ovl-vsva@lists.accellera.org
Subject: [ovl-vsva] SVA extensions compatible with module packaging

Hi all,

 

I was asked to send a list of proposed SVA extension features that OVL
may benefit when OVL checkers are still packaged into
modules/interfaces. I would like to mention, however, that using
modules/interfaces for this purpose leads to the flexibility loss - no
context inference, no possibility to pass a property/sequence as an
argument. Therefore most of the proposed extensions are not relevant for
modules, and the list is very poor.

 

Cosmetic changes in the OVL checker invocation may be done using
enhancements in the compiler directives:

*	Default argument values in a macro 
*	Passing macro argument by name 
*	Repeatable macro arguments 

 

E.g., the invocation of the checker assert_delta

 

assert_delta

    #(OVL_ERROR, 16, 0, 8, OVL_ASSERT,

            "Error: y values not smooth", OVL_COVER_ALL)

    valid_smooth ( clk, reset_n, y );

 

may the look like:

 

`ASSERT_DELTA(valid_smooth, y, .width(16), .max(8), .msg("Error: y
values not smooth"));

 

 

A very important feature is an ability to specify user-defined
compile-time messages:

 

Compare:

 

// Compile-time message when module parameter is wrong

if (num_cks < 2)

                        $error("Illegal value set for
action_on_new_start");

 

instead of a run-time message as now:

 

initial begin

            if (num_cks < 2)

                        ovl_error_t("Illegal value set for
action_on_new_start");

end

 

A proposal concerning property modeling is also beneficial for OVL,
since it eliminates races which occur when RTL is used for the modeling.
The problem is that in my proposal the modeling code may be specified
inside checkers (new construct for property packaging)  only, and not
within modules.

 

Regards,

Dmitry

 

________________________________

From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org] On
Behalf Of Bresticker, Shalom
Sent: Tuesday, October 10, 2006 6:29 AM
To: sv-bc@server.eda.org
Subject: FW: [sv-bc] Mantis 1571: Add default values for macro arguments

 

Resend.

Comments?

Shalom

 

________________________________

From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org] On
Behalf Of Bresticker, Shalom
Sent: Sunday, September 17, 2006 2:53 PM
To: sv-bc@server.eda-stds.org
Cc: Korchemny, Dmitry
Subject: [sv-bc] Mantis 1571: Add default values for macro arguments

 

This is a draft proposal for Mantis 1571, to add default values for
macro arguments.

The obvious advantage of default values for macro arguments is not
having to specify them, making their usage shorter and more readable.

A second advantage is being able to change the default by a single
change instead of having to change the argument value in every usage of
the macro.

Syntax change:

Change the syntax in Syntax 19-2 in 1364-2005 from 

list_of_formal_arguments ::= 
    formal_argument_identifier { , formal_argument_identifier }

formal_argument_identifier ::= 
    simple_identifier

to 

list_of_formal_arguments ::= 
    formal_argument { , formal_argument }

formal_argument ::= 
    simple_identifier [ = default_value ]

(Note that the default value does not have to be an expression
syntactically. This is noted in Mantis 1333.) 

Add the following text:

A formal macro argument may have a default value. If a default value is
not explicitly specified, then the macro argument is considered to have
a null default value. The default value is substituted for the formal
argument if no corresponding actual argument is specified. If fewer
actual arguments are specified than the number of formal arguments, then
the default values are substituted for the additional formal arguments.
It shall be an error to specify more actual arguments than the number of
formal arguments in the macro.

Examples:

`define MACRO(a=5,b="B",c) $display(  a ,, b ,, c ) ; // c has no
explicit default, implicit null default

`MACRO ( , 2, 3 )  // argument a omitted

`MACRO ( 1 , , 3 ) // argument b omitted

`MACRO ( , 2, ) // arguments a and c omitted

`MACRO ( 1 )  // arguments b and c omitted

`MACRO () // all three arguments omitted

 

Shalom

Shalom Bresticker

Intel Jerusalem LAD DA

+972 2 589-6852

+972 54 721-1033

I don't represent Intel 

 



image001.gif
Received on Tue Oct 10 14:25:15 2006

This archive was generated by hypermail 2.1.8 : Tue Oct 10 2006 - 14:25:36 PDT