Any one please resolve this code Error In UVM Subscriber write function

Hi,

when I am trying to send the data from monitor to subscriber IRUN tool gives me an error like below

function void write(my_transaction tr);

virtual method ‘my_subscriber::write’ formal argument name does not match base class uvm_subscriber

I have check with base Examples given in UVM-1.1d and UVM-cookbook also Iam practising pretty much same code i don’t know why it gives me error, can any one please resolve the error

regards
sriram

uvm_subscriber is a parameterized class. Please make sure you using the transaction type as a parameter.

class my_subscriber extends uvm_subscriber #(my_transaction); 
....
endclass : my_subscriber

HI

I am using the parametrized class only.

regards
sriram

Hi Sriram,

Share some sinppet of your code so we can able to see whats getting wrong.

The uvm_subscriber class defines the write function as a pure virtual function

pure virtual function void write(T t);


where T is the parameterized type (i.e, my_transaction in your case).

Since everything else seems to match with your declaration and it is complaining about the match of the names, I would suggest trying

function void write(my_transaction t);

Note I change the argument name from tr to t Let me know if this fixes your problem.

In reply to logie:

Hi Logie,

you are right. LRM(Section 8.19 & 8.20) says argument name shall match when you implement

pure virtual

method.

In reply to Vinay Jain:

Yes ,

This is absolutely working fine.But where is the problem , what makes the difference between

function void write(my_transaction tr);
and
function void write(my_transaction t);

Regards
sriram

In reply to logie:

Hello,

I am also facing the same issue. Somebody please tell me where I am going wrong

Please refer the example below


class my_coverage extends uvm_subscriber #(my_cov_item);
  `uvm_component_utils(my_coverage)
  
  function new (string name, uvm_component parent);
    super.new(name, parent);
  endfunction : new

  function void write (my_cov_item t);
    $display("my_cov_item obtained by my_coverage");
  endfunction : new

endclass : my_coverage

I tried using this in my env as follows


my_coverage my_cov;

function void build_phase(uvm_phase phase);
  super.build_phase(phase);
  my_cov = my_coverage::type_id::create("my_cov",this);
endfunction : build_phase


The error appears as: formal arguements of write method do not match with that of uvm_subscriber base class.

In reply to desaivs1994:
Your code works fine for me after I changed the ‘
endfunction : new
’ to ‘
endfunction : write
’ typo.

In reply to sriram pantla:

The write function is pure virtual function. Pure means there is no implementation and you have to provide an implementation. For this reason you have to follow the naming of the base class.

In reply to chr_sue:

In reply to sriram pantla:
The write function is pure virtual function. Pure means there is no implementation and you have to provide an implementation. For this reason you have to follow the naming of the base class.

Yes, this is right, in my example code above, I used “t” as argument to write() function, but was not doing so in my actual code. Thanks

In reply to Vinay Jain:

can you please share the LRM

In reply to Vickyvinayk:

IEEE 1800-2017 SystemVerilog LRM