[sv-ec] reference to outer scope name from nested class

From: danielm <danielm_at_.....>
Date: Fri Dec 14 2007 - 08:02:51 PST
1. Problem with classes declaration  nested in modules
 
module sub;
    reg a;
    parameter P=1;
    class C;
        bit [P:0] p;
        function new ();
            $display("test>>>>>>>>>>>>",a);  //reference to outter scope
variable a;
        endfunction
    endclass
    
    C c=new;
endmodule
 
In the LRM (chapter 7. classses) there is no single example of nesting
classes inside modules/programs/interfaces and resolving issues like above.
 
The main issues for above are:
    - how to deal with multi intantation of module sub - there will be multi
class declaration each with separate set of static variables? what about
parametrized p declaration in each instance?
    - what happen if we use a class from module which is not instantiated in
the project? is it possible
This should be clearly described in LRM.
 
 
2. Problem with classes declaration nested in classes:
 
 
    class C;
        int i;
        static int si;
        class CC;
                function new();
                    $display(i,,si);
                endfunction
        endclass
    endclass
    
    C:CC cc=new;
 
Should non-static properties and function declared in outer class be visible
in inner class? 
IMHO  in above only the static property 'si'  should be accesible (like i C
language) -  this should be clearly pointed out by LRM.
If we allow reference to 'i' what will be the value if C::i not exists?
 
 
 
Daniel Mlynek

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sat Dec 15 02:34:20 2007

This archive was generated by hypermail 2.1.8 : Sat Dec 15 2007 - 02:35:14 PST