Trying to write a driver class which can drive signals in an different interfaces (using the corresponding virtual interface).
The driver class will be used to communicate with different designs, and the interfaces will be different.
I am trying to do this by having a base class called driver, then an extended class called driver_struct. The base class will talk to an interface with logic signals, the extended class will drive structs.
A task in my base class method looks like this:
virtual task initPktIf();
begin
log.logInfo(5,"[running initPktIf]");
vif.ingress_cb.data <= 0;
vif.ingress_cb.data <= 0;
vif.ingress_cb.last <= 0;
vif.ingress_cb.valid <= 0;
end
endtask :initPktIf
The method in the extended class looks like this (changed names for web post):
virtual task initPktIf();
begin
log.logInfo(5,"[running initPktIf]");
vif.ingress_cb.foo2bar_struct.data <= 0;
vif.ingress_cb.foo2bar_struct.first <= 0;
vif.ingress_cb.foo2bar_struct.last <= 0;
vif.ingress_cb.foo2bar_struct.valid <= 0;
end
endtask :initPktIf
I instantiate the extended class driver in an environment class, for this particular test suite
the interface (and the DUT) has the structs.
At compile time I get errors, this is the first:
ncelab: *E,CUVUNF (./driver/driver.svh,77|21): Hierarchical name component lookup failed at ‘data’.
vif.ingress_cb.first <= 0;
The tool is unhappy because it can’t find the path of the method in the base class, however I am not instantiating the base class.
What is the way around this, which would allow me to have different implementations of the methods in base
and extended classes where some of the classes hierarchical paths do not make sense to the current
design (which should be ok because I am not calling those methods)?
Would an abstract class and pure virtual methods solve this?
This is not a UVM design, the organization i work for has not yet adopted UVM, this is straight SV.