RE: [sv-bc] RE: [sv-ec] Question about TF arg lifetime

From: Steven Sharp <sharp_at_.....>
Date: Tue Dec 18 2007 - 12:33:56 PST
>From: "Bresticker, Shalom" <shalom.bresticker@intel.com>

>Why is having an automatic output argument different from an automatic
>internal variable?

It is indeed similar.  Declaring a local variable to be explicitly
automatic in an otherwise static context is almost as useless as
declaring an output argument to be explicitly automatic.  But not
quite.

In most languages, including Verilog, the only constructs that might
need to be re-entrant are subroutines.  Either a subroutine is intended
to be re-entrant or not, and if it is, then its data needs to be
automatic.  If a subroutine is not intended to be re-entrant, then there
is no need for its data to be automatic.  Making a variable automatic
might be convenient to get re-initialization on scope entry, but is not
necessary.  A static variable can be used, with an explicit assignment
to initialize it on scope entry.

But SystemVerilog has added another way to re-enter a scope while
execution is still active in it, aside from subroutines.  It has added
the join_none and join_any constructs.  These allow leaving behind
subprocesses that have access to a scope, while the parent process
exits and then loops back to re-enter the scope.  A scope that contains
a fork..join_none and is contained in a loop is now re-entrant.  This
means that the variables of the scope may need to be automatic, even
though they are not in a subroutine.

This creates a need for declaring local automatic variables in such
scopes.  These scopes could be inside a subroutine that is not itself
re-entrant, and can therefore be static.  Or they could be inside an
initial or always block.

This does not create any similar need for declaring individual output
arguments to be automatic.  If the scope of the output argument is
re-entrant, then the subroutine itself is re-entrant, because the
subroutine is the scope.  One output argument cannot be in a re-entrant
scope without the other arguments also being in a re-entrant scope.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Dec 18 13:03:59 2007

This archive was generated by hypermail 2.1.8 : Tue Dec 18 2007 - 13:04:48 PST