I am trying to create a base driver for my UVM that is capable of doing drive and handling reset in an easy way that is easy for developers. This base driver shall also permit extension, I mean, adding new functionalities to it should be easy. What I thought is to have the class parameterized for the type of transaction it has to drive to the virtual interface. This is pretty easy. The first problem I faced is when I need an interface type that is valid for every possible interface that I want to implement on my driver when extending the base driver.
I have read this paper http://events.dvcon.org/2012/proceedings/papers/01P_3.pdf of Dave Rich and also this blog entry http://blog.verificationgentleman.com/2015/08/sv-if-polymorphism-extendability.html#comment-form of Tudor Timi, and when I read both I decided to use the proxy idea. Now is when my real problem comes across. I cannot access a class defined inside an interface from a class outside this scope.
Look at this to see how my idea looks like:
// Note that this does not compile, it's pseudocode
class base_driver #(type T) extends uvm_driver #(T);
T trans; // Transaction
base_if_proxy if_proxy; // Base class for interface proxy
function void run_phase(uvm_phase phase);
endfunction : run_phase
endtask : do_all
pure virtual task do_something();
endclass : base_driver
class specific_driver extends base_driver #(my_transaction_type);
specific_if_proxy s_if_proxy; // Proxy extending base_if_proxy
function void build_phase(uvm_phase phase);
if (!$cast(this.s_if_proxy, if_proxy)) begin // Get the specific proxy type!!!
endfunction : build_phase
virtual task do_something();
s_if_proxy.wait_for_clock(); // Tasks implemented in the extended class of the proxy!
endtask : do_something
endclass : specific_driver
As you can see the problem is that I want to do a $cast in the build_phase of the specific_driver to have the specific class of the proxy for the driver that I am implementing. The cast could work like a charm if the specific proxy class wasn't defined in the interface for the driver. How is it possible to solve this problem? Any approach?
Hope I made myself clear enough, thanks.