[sv-ec] scoping rules for classes

From: Francoise Martinolle <fm_at_.....>
Date: Fri Oct 20 2006 - 12:21:43 PDT
1) Have we settled the scoping rules for classes?
I have an example of a parameterized class extending from a base class
specialization. The base class specialization
uses a parameter declared in the derived class declaration. Is that
legal?
The main question is which scope is the parser currently in, when it
tries to resolve
symbols appearing in the extends. Are we in the scope of class d? or are
we in the scope of the module because
it has encountered the closing parenthesis of the parameter port list.
Is the scope of class d defined at that point even though
we have not reached the ;
 
 
module m;
class c (parameter int p = 1); 

endclass 

class d #(parameter int q = 2) extends c#(q); 

endclass 

d #(3) handle; 

endmodule

If that is legal, then it is like having the extends "inside the class
declaration immediately after the parameter port list?
That means that the symbol q is first attempted to be resolved inside
the class decl for d.
The parameter declaration of q would hide any previous parameter
declaration.
 
2)Can you use a scoped class parameter?
 
class d #(parameter int q = 2, int p = c#(q) :: p);
 
or class d #(parameter int q = 2, int p = d#(q)::q);  // refers to its
own specialization
Received on Fri Oct 20 12:21:46 2006

This archive was generated by hypermail 2.1.8 : Fri Oct 20 2006 - 12:22:01 PDT