RE: [sv-bc] Does importing a class type or class variable make the elements declared in the class also visible?

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Fri Nov 18 2005 - 14:00:04 PST
Francoise,

 

My expectation would be that all class members (properties and methods)
are available in the importing scope. I'm not sure if the term visible
is appropriate here since each variable or method of the class must
still be qualified by an object of that class, either by using the LHS
context for the new operator, or using the dot notation with the proper
handle, or by the class name when using the :: operator.

 

Note that "new" is a reserved keyword so your last example is illegal in
SystemVerilog: new can only be used in the context of a class, a dynamic
array, or a covergoup.

 

            Arturo

 

________________________________

From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
francoise martinolle
Sent: Friday, November 18, 2005 1:25 PM
To: sv-bc@eda.org
Subject: [sv-bc] Does importing a class type or class variable make the
elements declared in the class also visible?

 

Should an import of a class type or class variable declared in a package
make all members, methods and the constructor of that class

visible in the importing scope?

 

ex:

 

package p;

   class A;

       int m1;

       function new (input i);

       endfunction

 

       task t;

       endtask

 

   endclass

endpackage

 

module top;

 

  import p::A;

 

  A cp;

 

// Are the statements in the following initial block legal?

  initial begin

       cp = new;

       cp.t;

       cp.m1 = 1;

  end

 

endmodule

 

 

Is it illegal to redeclare a function new in the module scope while
importing the class A?

 

package p;

   class A;

       int m1;

       function new (input i);

       endfunction

 

       task t;

       endtask

 

   endclass

endpackage

 

module top;

 

  import p::A;

 

   function int new ;   

     return 0;    

   endfunction

 

 

  A cp;

 

  initial begin

       cp = new;

       cp.t;

       cp.m1 = 1;

  end

 

endmodule
Received on Fri Nov 18 14:00:20 2005

This archive was generated by hypermail 2.1.8 : Fri Nov 18 2005 - 14:01:19 PST