-1

The below code is not working

class my_report_server extends uvm_default_report_server;
    `uvm_object_utils(my_report_server)

    function new(string name="my_report_server");
        super.new();
        $display( "Constructing report serevr %0s",name);
    endfunction : new

    virtual function string compose_message( uvm_severity severity,string    name,string id,string message,string filename,int line );

   //implemeted own code.

  endfunction 

endclass

In the build_phase of test_base.

function void build_phase(uvm_phase phase)
    my_report_server srv_h = new();
    uvm_report_server::set_server(srv_h);
endfunction
Greg
  • 18,111
  • 5
  • 46
  • 68

1 Answers1

1

I tried the same code and it prints messages from overridden class. There is no uvm_default_report_server class. Rather than it is simply uvm_report_server.

The following is my code snippet, which prints output as required:

   // User report server
   class my_report_server extends uvm_report_server;
      `uvm_object_utils(my_report_server)

     function new(string name="my_report_server");
       super.new();
       $display( "Constructing report serevr %0s",name);
     endfunction : new

  // Return type is string    
   virtual function string compose_message( uvm_severity severity,string name,string id,string message,string filename,int line );

    // DEBUG MESSAGE
    $display("From Super: \n %0s",super.compose_message(severity,name,id,message,filename,line));

     //This display comes.
      $display("This is from extended class");
   endfunction 

   class test extends uvm_test;
     // ... Some stuff here...
     // Declare handle here.
     my_report_server srv_h;

     function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      srv_h = new();
      uvm_report_server::set_server(srv_h);
     endfunction

   endclass

One thing I would like to point out is you have declared handle inside build_phase itself. This might create scoping issues (though it works fine with VCS).

Also, note that the return type of compose_message function is string. So, there must be some output coming from your overridden function. I have added a debug message for the same, this prints the default formatted message.

More information on uvm_report_server can be found out at this class reference link.

sharvil111
  • 4,301
  • 1
  • 14
  • 29
  • Are you using uvm1.2 library? I am returning a string. – Saravanan Shanmugavelu Feb 22 '16 at 04:01
  • It was on EdaPlayground. UVM1.1d Library. A working example is available on [this link](http://www.edaplayground.com/x/NzV). For **UVM1.2**, the function is `compose_report_message`, available on [this link](https://verificationacademy.com/verification-methodology-reference/uvm/docs_1.2/html/files/base/uvm_report_server-svh.html#uvm_report_server.compose_report_message). – sharvil111 Feb 22 '16 at 05:02