RE: [sv-ec] class methods, constructor overloading

From: danielm <danielm_at_.....>
Date: Mon Sep 24 2007 - 01:24:35 PDT
Apart from hardware oriented features SV introduce a lot of higher level
verification stuff for building OO envitonments. Function overloading is a
feature which is heavy used in languages like c++ - so for users knowing c++
lack of function overloading  in  SV will be an unplesant suprise.

DANiel 

-----Original Message-----
From: Rich, Dave [mailto:Dave_Rich@mentor.com] 
Sent: Saturday, September 22, 2007 2:00 AM
To: SV_EC List
Cc: danielm@aldec.com.pl
Subject: RE: [sv-ec] class methods, constructor overloading

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 Mon Sep 24 01:25:19 2007

This archive was generated by hypermail 2.1.8 : Mon Sep 24 2007 - 01:25:58 PDT