Daniel, SV allows for a limited form of operator overloading. You can only "overload" an operator in cases where the operation is not already defined the data type(s) of its operands. In fact it even limits the set of operators that can be overloaded. This was primarily intended as a feature for data-path synthesis so that you could create math packages for complex data types as well as create more generic modules with parameterized types. This was never extended to work like C++ operator overloading with classes. However there is nothing preventing you from using class types in SV operator overloading: class A; int X; endclass class B; byte Y; function A toA; toA = new(); toA.X = Y; endfunction endclass function A BtoA(B b); BtoA = b.toA(); endfunction function int AplusB(A a, B b); return (a.X + b.Y): endfunction bind = function A BtoA(B); bind + function int AplusB(A,B); Dave > -----Original Message----- > From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On > Behalf Of Neil Korpusik > Sent: Friday, September 21, 2007 3:34 PM > To: SV_EC List > Cc: danielm@aldec.com.pl > Subject: [sv-ec] class methods, constructor overloading > > <forwarding email that want to the wrong email address> > > > -------- Original Message -------- > Subject: FW: class methods, constructor overloading > Date: Wed, 19 Sep 2007 08:41:09 +0200 > From: danielm <danielm@aldec.com.pl> > To: owner-sv-ec@eda.org > > > > > > LRM doesn't explicitly explain if class method/constructor overloading > is allowed or forbidden. This feature is very usefull in other object > oriented languages like c++, so I wonder if SV will in future allow to > overload methods and constructors. > > example: > class C; > function void foo(int i); > function void foo(byte i);//overloaded method > function new (int i); > function new (byte i);//ovrload constructor > endclass > > > Regards, > > DANiel Mlynek > > -- > This message has been scanned for viruses and > dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is > believed to be clean. > > > > > -- > 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 Fri Sep 21 17:00:19 2007
This archive was generated by hypermail 2.1.8 : Fri Sep 21 2007 - 17:00:39 PDT