Error regarding factory.print()

I use the following function in the test for view the structural composition of the testbench classes and the factory setup:
function void end_of_elaboration_phase(uvm_phase phase);
super.end_of_elaboration_phase(phase);
this.print();
factory.print();
endfunction

I got the following error:

** Error (suppressible): axi_test.sv(23): (vlog-7027) The name ('factory.print

‘) was not found in the current scope. Please verify the spelling of the name ’
factory.print’.

**I included “uvm_macros.svh”.

In reply to saritr:

Declare and get factory using,


class axi_test extends uvm_test;

uvm_factory factory;
uvm_coreservice_t cs = uvm_coreservice_t::get();

function void end_of_elaboration_phase(uvm_phase phase);
  super.end_of_elaboration_phase(phase);
  this.print();

  factory = cs.get_factory();
  factory.print();
endfunction

In reply to mayurkubavat:

What is different in log result of this.print and factory.print ?

In reply to RonakShah:

print() method call on factory prints the state of the uvm_factory, including registered types, instance overrides, and type overrides. While this.print() prints component hierarchy.

In reply to RonakShah:

  • this.print display the test structure printout
  • test.factory display the types registered in the factory for test

Check http://www.sunburst-design.com/papers/CummingsSNUG2012SV_UVM_Factories.pdf

In reply to mayurkubavat:

What is uvm_coreservice_t ?

In reply to saritr:

Thanks Saritr

In reply to saritr:

uvm_coreservice_t is a common point for all central uvm services such as uvm_factory, uvm_report_server, etc. Look into base/uvm_coreservice.svh for more.

Note that uvm_coreservice_t is applicable ONLY to UVM 1.2.

Since UVM 1.2 is still not an official release of UVM, it is recommended to use UVM 1.1d which is shipped pre-compiled with Questa. UVM 1.2 should be used only for testing.

To display the current factory status in UVM 1.1d, you can use factory.print() from your test, typically in the end_of_elaboration_phase().

In reply to cgales:

As I wrote, I use factory.print() typically in the end_of_elaboration_phase(), but I got error…

In reply to saritr:

Does your test extend uvm_test? Can you post the entire test code?

In reply to cgales:

class axi_test extends uvm_test;
//factory registration
`uvm_component_utils(axi_test)

//constructor
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction: new

//build phase
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction: build_phase

//view the structural composition of the testbench classes and the
//factory setup
function void end_of_elaboration_phase(uvm_phase phase);
super.end_of_elaboration_phase(phase);
this.print();
factory.print();
endfunction

//run phase
task run_phase(uvm_phase phase);
super.run_phase(phase);
endtask: run_phase

endclass: axi_test

I included the macros in other files, so the macros are not an issue.

In reply to saritr:

This self contained test works fine for me in Questa:

You can run with ‘qverilog top.sv’

top.sv


import uvm_pkg::*;
`include "uvm_macros.svh"

class axi_test extends uvm_test;
//factory registration
`uvm_component_utils(axi_test)


//constructor
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction: new

//build phase
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction: build_phase

//view the structural composition of the testbench classes and the
//factory setup
function void end_of_elaboration_phase(uvm_phase phase);
super.end_of_elaboration_phase(phase);
this.print();
factory.print();
endfunction

//run phase
task run_phase(uvm_phase phase);
super.run_phase(phase);
endtask: run_phase

endclass: axi_test

module top;
  initial begin
    run_test("axi_test");
  end
endmodule