Mark, It should print nothing.:-( 13.4.3 says: " - All system task calls within a constant function shall be ignored." In any case, why is this different than a module with parameters? Only the (implicitly or explicitly) instantiated modules exist with their default or overridden parameters. That is the meaning of a generic class, it is not a type, and therefore does not exist in any user visible fashion until someone creates a specialization. Dave ________________________________ From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On Behalf Of Mark Hartoog Sent: Thursday, October 30, 2008 11:42 AM To: sv-ec@server.eda.org Subject: [sv-ec] Class static memember initialization The LRM does say "A generic class is not a type; only a concrete specialization represents a type," but it is very unclear what the rules are about initialization of static members . Consider this simple example: module test; class C #(p = 1); static function int f(); $display("Init value = ", p); return p; endfunction static int value = f(); endclass C #(2) c = new(); endmodule Should this print: Init value = 1 Init value = 2 Or should it just print: Init value = 2 Do the static members of class 'C' get initialized for the default parameter values of the class, even though the default parameter values are never used in the design? If you think the static members should always be initialized for default values, even though they are not used, then what about the case where the parameter has no default value? class C #(p); static function int f(); $display("Init value = ", p); return p; endfunction static int value = f(); endclass C #(2) c = new(); endmodule What about the case where the parameterized class is never used in the design at all? What about a non-parameterized class that is never used in the design? If parameterized classes are like C++ templates, then the static members should only be initialized for classes that are used in the design, but the LRM does not seem clear about this. -- 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 Thu Oct 30 12:32:07 2008
This archive was generated by hypermail 2.1.8 : Thu Oct 30 2008 - 12:32:44 PDT