Re: [sv-ec] reference to class definition nested in module/program /interface

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Thu Oct 11 2007 - 06:48:02 PDT
Neither case is legal.

As you correctly note in (2), the "::" can't be used with module
design units.  (1) is illegal since the LRM explicitly disallows
hierarchical references to types (See 4.9 in P1800-2005 or
6.18 in 2008 draft 3).

There are two ways to address this in your example -- move class
C into the compilation unit or move it into a named package.

If "tb" was a child instance, you could also pass the type C as
a type parameter.

Gord.

danielm wrote:
> I wonder if it is legal to define variable based on class type nested in 
> other module  - example:
>  
> 
>     module top;
>         class C; int i; endclass
>     endmodule
>      
>      
>     module tb;
>         top.C c=new;  //1 declaration of C type object via '.'
>     //vs
>         top::C c=new; //2 declaration of C type object via '::'
>     endmodule
> 
>  
> 2nd is imho explicitly forbidden by LRM because :: can be used only on 
> class packages.
>  
> but what about 1st case? is it legal?
>  
>  
> DANiel
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Oct 11 06:48:18 2007

This archive was generated by hypermail 2.1.8 : Thu Oct 11 2007 - 06:48:42 PDT