I want to access base class methods defined in ‘interface class’. I have a compilation error. I don’t know how to fix this error. I look forward your help.
interface class put_Q_class; // base class1
rand int Rdata;
int Qdata[$];
// pure virtual methods
pure virtual function put(int Rdata);
endfunction
endclass
interface class get_Q_class; // base class2
rand int Rdata;
int Qdata[$];
pure virtual function get(int Rdata);
endfunction
endclass
class fifo_class implements put_Q_class, get_Q_class;
virtual function put(int Rdata);
Qdata.push_back(Rdata);
endfunction
virtual function get(int Rdata);
Qdata.pop_front(Rdata);
endfunction
endclass
In my top file, I call the put method (just for the moment) to send random values into queue.
module top;
fifo_class fifo_h;
initial begin
fifo_h = new;
for (int i2=0; i2<10; i2++) begin // push into queue using interface class structure
fifo_h.randomize();
fifo_h.put(fifo_h.Rdata);
end
$display("elements in queue using interface class =%0p",fifo_h.Qdata);
end
endmodule
I have this compilation error: