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

From: Mirek Forczek <mirekf_at_.....>
Date: Wed May 28 2008 - 04:37:48 PDT
What if we rewrite the code to:

module top;
        B b;A a=new;
        initial  begin
            b=a;
            disable top.b.t; //which method would be disabled, does disable
take polimorphism into account?
            top.b.t.i=10; //which method port would be assigned - does such
assignment take polimorphism into account? ()
            top.b.t.y=10; //which method port would be assigned - does such
assignment take polimorphism into account? ()
        end
endmodule 

The Hierarchical references starts with top-level instance (static
hierarchy) now.

Does this make the code legal ?
Does the polymorphism issue arise back ?

Is that rule: "Hierarchical references cannot be started with class
handles." expressed somewere in LRM text ?

Regards,
Mirek

-----Original Message-----
From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On
Behalf Of Steven Sharp
Sent: 27 maja 2008 22:06
To: sv-ec@server.eda.org; daniel.mlynek@aldec.com
Subject: Re: [sv-ec] virtual methods issues - disable on virtual, virtual
method with static life time


>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.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed May 28 04:39:53 2008

This archive was generated by hypermail 2.1.8 : Wed May 28 2008 - 04:40:34 PDT