[sv-ec] Casting references of Interface Classes

From: Alsop, Thomas R <thomas.r.alsop@intel.com>
Date: Mon Nov 08 2010 - 11:14:00 PST

Also up for discussion/clarification today. -Tom

8.25.3 Casting and Object reference assignment

There are a handful of relationships that must be clearly defined in order for interface classes to work properly with SystemVerilog. In order to maintain the OOP and polymorphism semantics, it shall be legal to assign an interface class handle to a child object that implements it.

    PutImp #() put_ref;
    Fifo#() fifo_obj = new;
    put_ref = fifo_obj;

It shall also be possible to have multiple references of an interface class and use them to cast from one to other.

     PutImp #() put_ref;
    GetImp #() get_ref;
    Fifo#() fifo_obj = new;
    put_ref = fifo_obj;
    get_ref = put_ref;

What about the Fifo implementing two interface types. Can you have two references of the interface class and cast it from one to the other? We think, yes. Give an example of put_ref and get_ref that does this assignment. Both have to be fully implemented (but this would compile fail when the class did not implement)

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Nov 8 11:14:22 2010

This archive was generated by hypermail 2.1.8 : Mon Nov 08 2010 - 11:14:25 PST