Scott,
"Functions shall have no side effects" should be sufficient. Restricting
them to automatic would be great (see mantis 2035 and the supporting
discussions). But just making a function automatic is not enough be it
may contain local static variables.
You can have a static function with no locally declared variables be the
return value is static.
function int foo(int A, bit B);
if (B) foo=A;
endfunction
If B is 0, foo returns the value from the previous call to foo. That is
a side effect.
Dave Rich
Verification Technologist
Mentor Graphics Corporation
> -----Original Message-----
> From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of
> Little Scott-B11206
> Sent: Friday, November 05, 2010 5:58 AM
> To: sv-ac@eda.org
> Subject: [sv-ac] Preserve no state information?
>
> Hi all:
>
> In looking at modifications for 2328, I came across the following
> restriction in section 16.6.
>
> -Functions shall be automatic (or preserve no state information) and
> have no side effects.
>
> My question is what types of additional functions does the
parenthetical
> statement allow? My understanding is that this statement allows
static
> functions that don't have any locally declared variables. It seems to
> me that these functions can be declared automatic to meet the
> requirement without the parenthetical statement. Is this correct? Is
> there anything else the parenthetical statement allows?
>
> I would like to remove the parenthetical statement as I believe it
> simplifies the restriction. If my understanding above is correct, any
> code that becomes noncompliant because of the change could become
> compliant by adding automatic to the function declaration.
>
> Thanks,
> Scott
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, 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 Fri Nov 5 11:24:24 2010
This archive was generated by hypermail 2.1.8 : Fri Nov 05 2010 - 11:24:34 PDT