RE: [sv-bc] Is an unnamed block with declarations a scope?

From: Steven Sharp <sharp_at_.....>
Date: Mon Aug 15 2005 - 11:06:19 PDT
>From: "Michael McNamara" <mcnamara@cadence.com>
>
>A task call creates a scope in the region within which it is called, and in1364 
you can refer to the variables of that task call (most usefully by examining the 
values in a waveform display).

Sorry Mac, but this is not the way the language is defined.  Some tools,
such as synthesis tools, may implement task calls by inlining the code
and declarations of the task at the call site, but that is non-compliant
with the standard.

The task declaration creates a scope in the region where it is declared,
and all its variables are in that scope.  All calls to the same task
instance will share the same variables.  There are not different ones
for different calls.

For example, in

module m;

task t;
  input integer v;
  $display(v);
endtask

initial begin:foo
  t(1);
  begin: bar
    t(2);
  end
end

endmodule

In a given instance of module m, there is one scope t containing the
variable v.  The value of m.t.v becomes 1 at the first call, and 2 at
the second call.  There is no such declaration as m.foo.t.v or m.bar.t.v,
because a call does not create a scope.

So the issue you described with calls in unnamed scopes does not arise.  

Steven Sharp
sharp@cadence.com
Received on Mon Aug 15 11:06:43 2005

This archive was generated by hypermail 2.1.8 : Mon Aug 15 2005 - 11:09:25 PDT