Re: [sv-bc] Forward reference of baseclass

From: Alok Kumar Sinha <aksinha_at_.....>
Date: Thu Feb 14 2008 - 06:51:07 PST
Thanks Gord,

Actually my querry came in the context of the mail conversation between 
you, Surya and shweta with subject line
"Forward typedef of parameterized class" . In this context, I want to 
extend my querry that is it legal to
have parameter assignment list with a forward reference of class?
For e.g.

typedef C;
C #(3) x = new; // <---- Is it legal with #()
class D extends C #(1); // <--- Is it legal with #()
endclass
class C #(parameter p = 2) ;
endclass

Is it legal ?
According to you "a non-type access has no special restrictions and 
should be legal, assuming of course that
the target of such a reference is a static property or method."

Regards
Alok

Gordon Vreugdenhil wrote:

> I've been gone for a week and in looking through my
> backlog of email, I haven't seen a response to this,
> so I'll take a shot at this one.
>
> I consider this example to be illegal.  "T" in
> the "extends T#(3)"  is the **type** parameter
> to C.  There is no way to have a pass an unspecialized
> parameterized class reference as a type parameter --
> any type reference to a parameterized class denotes a
> specialized type.  So "T#(3)" here is illegal since
> "T" can't denote a parameterized class.
>
> You could have:
>
>    class C#(parameter type T = int) extends T;
>    endclass
>
> and then your example would be valid.
>
> Given:
>     C #( D #(2)) x = new;
> the type parameter "T" of C binds to the type
> specialized from D#(2) so the effective type
> could be thought of as having:
>      class C extends D#(2);
>         typedef D#(2) T;
>         ....
>      endclass
> This of course isn't exactly what happens, but it
> is a reasonable approximation of what results for
> this particular specialization of C.  Other
> specializations of C with different type bindings
> for "T" would produce other class derivations.
>
> Gord.
>
>
> Alok Kumar Sinha wrote:
>
>> Hi
>>
>> Consider the scenario :
>> module top;
>> class C #(parameter type T = int) extends T #(3);
>> endclass
>> class D #(parameter p = 1);
>> endclass
>>
>> C #( D #(2)) x = new;
>>
>> endmodule
>>
>> If this case is syntactically and semantically correct then what 
>> parameter value should be propagated to the class 'D'.
>> Whether it should be  '2'  from  'D  #(2)' or '3' from 'T #(3)' ?
>>
>> Regards
>> Alok
>>
>>
>>
>




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Feb 14 06:58:48 2008

This archive was generated by hypermail 2.1.8 : Thu Feb 14 2008 - 07:00:29 PST