Java interfaces (a form of MI where only one base class can define
data members, but all base classes can define virtual methods) is a
requirement to use almost any design pattern from the Gang of Four
book. This type of MI is also heavily used by TLM 1.0 and OVM.
Currently in SystemVerilog it is supported using adapters, but that's
clumsy.
C++ has a very complex MI model, where any of the base classes can
also define data members. C++ also has a feature called "virtual
inheritance" which solves the following issue (pseudo-SystemVerilog
syntax used):
class B;
class D1 extends B;
class D2 extends B;
class E extends D1, D2;
Now: strictly speaking, class E seems to have two instances of B - one
is in D1 and one in D2. But often that's not desired, so with virtual
inheritance, there is only one copy of B. In C++ this gets very messy
because C++ uses manual storage management - you must manage memory
yourself by writing appropriate constructors and destructors. In the
multiple virtual inheritance scenario, the constructors don't chain at
all, i.e. the constructor for E would not automatically call those for
B, D1 and D2. The programmer must do it manually, and that breaks the
abstraction models (e.g. you must know that ultimately you're deriving
from B, as you must explicitly call its constructor). There are other
restrictions on usage as well, mainly with casting.
SystemVerilog won't have all of these issues since it supports proper
garbage collection, and therefore places a lot fewer constraints on
constructors. However, if we want to go whole hog and define a C++
style of MI we must explicitly specify all of these issues. Java-style
interfaces are much simpler to specify and will likely satisfy 95% of
the users. The real power users are likely bridging to C++ through the
DPI anyway.
On Thu, Feb 25, 2010 at 9:19 AM, Puneet <sverilog@gmail.com> wrote:
> Greetings
>
>>
>> Is the request for true multiple inheritance (C++ style) or for
>>
>> something similar to Java interfaces?
>>
>
> I am posting a follow up tweet by the same poster.
>
> #DVCON SV Multiple Inheritance: Propose using C++ syntax to deliver Java
> style, possibly extending to full C++ capabilities later.
>
> So I believe we can live without virtual inheritance at least for the time
> being.
> Also, pardon my ignorance, but I see a lot of C++ guys shunning MI for being
> too complex to use. Is MI a requirement of the end-users or the vendors who
> deliver verification platforms (read VMM/OVM)?
> Regards
> - Puneet
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Thu Feb 25 06:39:26 2010
This archive was generated by hypermail 2.1.8 : Thu Feb 25 2010 - 06:39:31 PST