[sv-bc] Task and function name binding

From: Mark Hartoog <Mark.Hartoog_at_.....>
Date: Thu Nov 20 2008 - 14:47:42 PST
I have been studying the language in 23.8.1 Task and Function name
resolution and 26.3 Referencing data in packages with regards to
task/function name resolution. Section 26.3 says:

 

<quote>

For a reference to an identifier other than function or task call, the
locally visible identifiers defined at the

point of the reference in the current scope shall be searched. If the
reference is a function or task call, all of

the locally visible identifiers to the end of the current scope shall be
searched. If a match is found the reference

shall be bound to that locally visible identifier.

 

If no locally visible identifiers match, then the potentially locally
visible identifiers defined prior to the point

of the reference in the current scope shall be searched. If a match is
found, that identifier from the package

shall be imported into the current scope, becoming a locally visible
identifier within the current scope, and

the reference shall be bound to that identifier.

</quote>

 

There is then this example in 23.8.1:

 

package p;

    function void f();

       $display("p::f");

    endfunction

endpackage

 

module top;

   import p::*;

   if (1) begin : b // generate block

       initial f(); // reference to "f"

       function void f();

            $display("top.b.f");

       endfunction

   end

endmodule

 

This example should print "top.b.f" which is consistent with text in
26.3, but suppose I change this to:

 

package p;

    function void f();

       $display("p::f");

    endfunction

endpackage

 

module top;

   import p::*;

   if (1) begin : b // generate block

       initial  begin : block

           f(); // reference to "f"

       end

       initial f();// reference to "f"

       function void f();

            $display("top.b.f");

       endfunction

   end

endmodule

 

There is now an additional  reference to 'f' in the named block 'block',
which is a scope. At the end of the scope 'block' there is no 'f'
defined locally. Does this now make 'p::f' locally visible in module top
and then bind the function call to 'p::f' so that this now print "p::f"?


 

Was the intent here that these two calls to f() should bind differently
without producing any error message?

 

 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Nov 20 14:48:49 2008

This archive was generated by hypermail 2.1.8 : Thu Nov 20 2008 - 14:49:22 PST