Daniel, I believe all your concerns have been clarified in the 2008 LRM as part of our name resolution efforts. But using the 2005 LRM, a class is just another data type, and we don't show every data type being declared in every context. As far as I know, there are no restrictions on declaring particular data types in any context; only context restrictions on assigning and referencing certain types. Section 6.9 Type Compatibility says that the data types are local to their scope, and that the hierarchical path to that scope uniquely identifies that type. It has to be that way because parameterization. In your example, possible different values for P in each instance need to be represented in unique types for C. You cannot hierarchically refer to a type, so it is not possible to refer to a class type from outside a module, regardless of whether it is instantiated or not. See mantis 2109 for a list of name resolution issues. Dave ________________________________ From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On Behalf Of danielm Sent: Friday, December 14, 2007 8:03 AM To: sv-ec@server.eda.org Subject: [sv-ec] reference to outer scope name from nested class 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 <http://www.mailscanner.info/> , and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Sat Dec 15 05:42:15 2007
This archive was generated by hypermail 2.1.8 : Sat Dec 15 2007 - 05:42:49 PST