I took a stab at doing a non-functional conversion of ovm_*_imp's into interface classes (without ALL of OVM's functionality). It's a relatively simple real-world-like example of how multiple inheritance of interface classes might look, and I think that it illustrates a necessity to allow multiple inheritance for interface classes.
Some of the classes far below have a conflict over the parameter T, which I explicitly resolved with a typedef. For those examples, the type T isn't actually interesting to inherit.
Search down for ovm_put_imp and ovm_master_imp for the most interesting examples where I added extra code and comments.
-Brandon
interface class ovm_blocking_put_imp #(type T = int);
pure virtual task put(T arg);
endclass
interface class ovm_nonblocking_put_imp #(type T = int);
pure virtual function bit try_put(T arg);
pure virtual function bit can_put();
endclass
// T from ovm_blocking_put_imp and ovm_nonblocking_put_imp
// is already hidden by the parameter of ovm_put_imp
interface class ovm_put_imp #(type T = int)
extends ovm_blocking_put_imp#(T),
ovm_nonblocking_put_imp#(T);
endclass
interface class ovm_blocking_get_imp #(type T = int);
pure virtual task get(output T arg);
endclass
interface class ovm_nonblocking_get_imp #(type T = int);
pure virtual function bit try_get(output T arg);
pure virtual function bit can_get();
endclass
interface class ovm_get_imp #(type T = int)
extends ovm_blocking_get_imp#(T),
ovm_nonblocking_get_imp#(T);
endclass
interface class ovm_blocking_peek_imp #(type T = int);
pure virtual task peek(output T arg);
endclass
interface class ovm_nonblocking_peek_imp #(type T = int);
pure virtual function bit try_peek(output T arg);
pure virtual function bit can_peek();
endclass
interface class ovm_peek_imp #(type T = int)
extends ovm_blocking_get_imp#(T),
ovm_nonblocking_get_imp#(T);
endclass
interface class ovm_blocking_get_peek_imp #(type T = int)
extends ovm_blocking_get_imp#(T),
ovm_blocking_peek_imp#(T);
endclass
interface class ovm_nonblocking_get_peek_imp #(type T = int)
extends ovm_nonblocking_get_imp#(T),
ovm_nonblocking_peek_imp#(T);
endclass
interface class ovm_get_peek_imp #(type T = int)
extends ovm_blocking_get_peek_imp#(T),
ovm_nonblocking_get_peek_imp#(T);
endclass
interface class ovm_blocking_transport_imp #(type REQ = int, type RSP = REQ);
pure virtual task transport(REQ req_arg, output RSP rsp_arg);
endclass
interface class ovm_nonblocking_transport_imp #(type REQ = int, type RSP = REQ);
pure virtual function bit transport(REQ req_arg, output RSP rsp_arg);
endclass
interface class ovm_transport_imp #(type REQ = int, type RSP = REQ)
extends ovm_blocking_transport_imp#(REQ, RSP),
ovm_nonblocking_transport_imp#(REQ, RSP);
endclass
interface class ovm_blocking_master_imp#(type REQ = int, type RSP = REQ)
extends ovm_blocking_put_imp#(REQ),
ovm_blocking_get_peek_imp#(RSP);
typedef REQ T;
endclass
interface class ovm_nonblocking_master_imp#(type REQ = int, type RSP = REQ)
extends ovm_nonblocking_put_imp#(REQ),
ovm_nonblocking_get_peek_imp#(RSP);
typedef REQ T;
endclass
interface class ovm_master_imp#(type REQ = int, type RSP = REQ)
extends ovm_put_imp#(REQ),
ovm_get_peek_imp#(RSP);
// ovm_put_imp and ovm_get_peek_imp both have parameter T
typedef REQ T;
// not required by current proposal
// added to make prototype cut-and-paste easier
pure virtual task put(REQ arg);
pure virtual function bit try_put(REQ arg);
pure virtual function bit can_put();
pure virtual task get(output RSP arg);
pure virtual function bit try_get(output RSP arg);
pure virtual function bit can_get();
pure virtual task peek(output RSP arg);
pure virtual function bit try_peek(output RSP arg);
pure virtual function bit can_peek();
endclass
interface class ovm_blocking_slave_imp#(type REQ = int, type RSP = REQ)
extends ovm_blocking_put_imp#(REQ),
ovm_blocking_get_peek_imp#(RSP);
typedef REQ T;
endclass
interface class ovm_nonblocking_slave_imp#(type REQ = int, type RSP = REQ)
extends ovm_nonblocking_put_imp#(REQ),
ovm_nonblocking_get_peek_imp#(RSP);
typedef REQ T;
endclass
interface class ovm_slave_imp#(type REQ = int, type RSP = REQ)
extends ovm_put_imp#(REQ),
ovm_get_peek_imp#(RSP);
typedef REQ T;
endclass
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Jun 8 10:26:43 2011
This archive was generated by hypermail 2.1.8 : Wed Jun 08 2011 - 10:26:54 PDT