Re: [sv-ec] virtual methods issues - disable on virtual, virtual method with static life time

From: Steven Sharp <sharp_at_.....>
Date: Tue May 27 2008 - 13:06:20 PDT
>From: "Daniel Mlynek" <daniel.mlynek@aldec.com>

>Below code presents two issues of virtual methods - LRM does not define how
>it they should work . Description in comments
> 
>class B;
>     virtual task static   t(input i, output o);
>        int y;
>        o = i;
>    endtask
>endclass
> 
>class A extends B;
>     virtual  task static  t(input i, output o);
>        int y;
>        o = 2*i;
>    endtask
>endclass
> 
>module top;
>        B b;A a=new;
>        initial  begin
>            b=a;
>            disable b.t; //which method would be disabled, does disable take
>polimorphism into account?
>            b.t.i=10; //which method port would be assigned - does such
>assignment take polimorphism into account? ()
>            b.t.y=10; //which method port would be assigned - does such
>assignment take polimorphism into account? ()
>        end
>endmodule


I think the answer is that none of these 3 lines of code is legal,
so the question does not arise.

The later two are attempts to do hierarchical references to variables
in a scope.  Hierarchical references cannot be started with class
handles.  They must start with static hierarchy: an instance, block
name or class scope.  You cannot refer to b.t.i; you must refer to
B::t.i or A::t.i.  Since you cannot use a class handle, the issue of
polymorphism does not arise.  You must use a static class scope, which
specifies exactly which task you are referring to.

The disable statement also takes a hierarchical reference, to a scope.
So again, it cannot start with a class handle.  It must start with
static hierarchy.  You would have to use B::t or A::t instead.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue May 27 13:07:04 2008

This archive was generated by hypermail 2.1.8 : Tue May 27 2008 - 13:07:49 PDT