[sv-bc] RE: Mantis 3230: static and automatic tasks and functions

From: Arturo Salz <Arturo.Salz@synopsys.com>
Date: Sun Nov 07 2010 - 08:06:57 PST

Shalom,

The terminology was inherited from C++, which has a very similar definition for static methods, and also overloads the use of the static keyword for regular functions and class methods, but with slightly different semantics. While the difference in SV is more pronounced than in C/C++, people accustomed to C++ should have little confusion. Incidentally, the committee came to the conclusion that methods with static lifetime are worthless and made them illegal. I believe the same is true for regular static functions where they can even cause simulation/synthesis mismatches. Perhaps a note explaining the difference between static function and static method may help.

                Arturo

From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Bresticker, Shalom
Sent: Sunday, November 07, 2010 4:03 AM
To: sv-bc@eda.org
Subject: [sv-bc] Mantis 3230: static and automatic tasks and functions

Way back in Verilog-2001, almost a decade ago, the LRM talked about "static" and "automatic" tasks and functions. For example, 1364-2001 section 10.2.1 says,

"Tasks without the optional keyword automatic are static tasks, with all declared items being statically allocated. These items shall be shared across all uses of the task executing concurrently. Task with the optional keyword automatic are automatic tasks. All items declared inside automatic tasks are allocated dynamically for each invocation. Automatic task items can not be accessed by hierarchical references. Automatic tasks can be invoked through use of their hierarchical name."

Many people got used to that terminology.

Then the SystemVerilog LRM hijacked the terminology to classes with a different meeting and was even brazen enough to accuse the older parts of the LRM of misusing the terminology.

8.9 in 1800-2009, for example, now says,

"A static method is different from a task with static lifetime. The former refers to the lifetime of the method within the class, while the latter refers to the lifetime of the arguments and variables within the task.

class TwoTasks;
static task t1(); ... endtask // static class method with automatic variable lifetime
task static t2(); ... endtask // ILLEGAL: nonstatic class method with static variable lifetime
endclass"

The similarity of the two syntaxes increases the confusion, and was a bad choice in my opinion.

It is probably too late to change the syntax or the terminology in the clause on Classes, but it will require a lot of rewriting to change the terminology everywhere else, and "static task" is certainly much more convenient to say than "task with static variable lifetime".

Shalom

Shalom Bresticker
Intel LAD DA, Jerusalem, Israel
+972 2 589 6582 (office)
+972 54 721 1033 (cell)
http://www.linkedin.com/in/shalombresticker

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
This message has been scanned for viruses and
dangerous content by MailScanner<http://www.mailscanner.info/>, and is
believed to be clean.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sun Nov 7 08:07:31 2010

This archive was generated by hypermail 2.1.8 : Sun Nov 07 2010 - 08:10:18 PST