RE: [sv-ec] virtual methods with static lifetime

From: danielm <danielm_at_.....>
Date: Mon Apr 07 2008 - 03:12:03 PDT
Yes but I have to perform the assignent to ports just before calling the
function.... so they became  smth like virtual variables.
 
DANiel

  _____  

From: Rich, Dave [mailto:Dave_Rich@mentor.com] 
Sent: Friday, April 04, 2008 10:17 AM
To: danielm; sv-ec@server.eda.org
Cc: Piotr Winter
Subject: RE: [sv-ec] virtual methods with static lifetime



Yes, but you are calling with the handle the object was constructed with, so
there is no difference.

 

  _____  

From: danielm [mailto:danielm@aldec.com.pl] 
Sent: Friday, April 04, 2008 1:12 AM
To: Rich, Dave; sv-ec@server.eda.org
Cc: 'Piotr Winter'
Subject: RE: [sv-ec] virtual methods with static lifetime

 

disp function is not virtual at alll!!!

 

 

DANiel

 

  _____  

From: Rich, Dave [mailto:Dave_Rich@mentor.com] 
Sent: Friday, April 04, 2008 10:07 AM
To: danielm; sv-ec@server.eda.org
Subject: RE: [sv-ec] virtual methods with static lifetime

Mantis 2035 already requests to deprecate all class methods with static
lifetimes, but there is no ambiguity here. You have created three static
class properties: B::f.i, C1::f.i, and C2::f.i, and only method calls are
virtual, Once the method has been chosen, normal name resolution rules apply
to select the class property.

 

So the results are as you suggest - not because i appears virtual, but
because disp is virtual.

 

Dave

 

 

  _____  

From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On
Behalf Of danielm
Sent: Friday, April 04, 2008 12:45 AM
To: sv-ec@server.eda.org
Subject: [sv-ec] virtual methods with static lifetime

 

LRM doesn't say a word about virtual methods with static lifetime consider
the below example:

 

module top;
        class B;
                virtual function   static void f(input int i);
                endfunction
        endclass

 

        class C1 extends B;
                function  static void f(input int i);
                endfunction
                function   void disp();
                        $display(f.i);
                endfunction

 

        endclass

 

        class C2 extends B;
                function   static void f(input int i);
                endfunction
                function   void disp();
                        $display(f.i);
                endfunction
        endclass

 

        C1 c1=new;
        C2 c2=new;
        B b;
        initial begin
                b=c1;
                b.f(1);//1 should be assigned to static input variable i
from C1 - polymorphyzm for variables????
                c1.disp(); //it should display 1????
                b=c2;                

                b.f(2); //1 should be assigned to static input variable i
from C2 - polymorphyzm for variables????
                c2.disp();//it should display 2????
        end
endmodule

 

This case introduce completely new feature - which we may call virtual
static variables. 

It is allowed on purpose - or IEEE just forget to forbid explicitly that
methods with static lifetime cannot be virtual.

 

(NOTE: please note that static virtual methods are explicitly forbidden by
LRM, and dynamic methods with static lifetime are different)

 

 

DANiel


-- 
This message has been scanned for viruses and 
dangerous content by  <http://www.mailscanner.info/> 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 Mon Apr 7 03:14:00 2008

This archive was generated by hypermail 2.1.8 : Mon Apr 07 2008 - 03:14:34 PDT