.. _UVM Library Compilation Troubleshooting:

UVM Library Compilation Troubleshooting
=======================================


This application note covers several types of configuration issues you might encounter when working with the UVM library:

.. |err| image:: ../../images/icons/obj16/error_tsk.png
    :class: inline

.. |co| image:: ../../images/icons/act16/compile_order.png
    :class: inline

.. |cf| image:: ../../images/icons/act16/gui_filters_mini.png
    :class: inline

.. |types| image:: ../../images/icons/obj16/types.png
    :class: inline


**1) Error messages like:**

-  |err| *Error: SYSTEM_VERILOG_2012: Cannot open `include file "uvm_macros.svh"*
-  |err| *Error: SYSTEM_VERILOG_2012: Undefined macro name: `uvm_object_utils_begin*
-  |err| *Error: EXTEND_CLASS: Extending non existing class 'uvm_agent*

These errors indicate that the UVM library was not compiled or that the *uvm_pkg* has not been imported properly.
To check whether the UVM library was compiled:

-  disable the :ref:`Content Filters` using the toolbar button |cf|
-  search for the *uvm_pkg.sv* file in the :ref:`Compile Order View` |co| 
-  search for the *uvm_component* class in the :ref:`Types View` |types|

If the library is not compiled add the **-uvm** argument to your build file  or one of the :ref:`Compatibility Modes` specific flags.

Also make sure the uvm package is imported in the scope where the errors are reported.

**2) Error messages like:**

-   |err| *Error: METHOD_CALL_ARGUMENTS: Expecting maximum '0' arguments when calling 'new', found '1'*
-   |err| *Error: ILLEGAL_ASSIGNMENT: Illegal assignment of 'literal_string' to argument 'stream' of type 'uvm_tr_stream'*
-   |err| *Error: UNDECLARED_IDENTIFIER: Identifier 'factory' is not declared*

These errors can happen when there is a mismatch between the UVM version that is compiled by DVT and the one used by the project.

.. |macros| image:: ../../images/icons/act16/macros.png
    :class: inline

.. |buildfile| image:: ../../images/icons/obj16/buildfile.png
    :class: inline

For example there are two scenarios for the ''METHOD_CALL_ARGUMENTS'' error:

-  2a) The first one is the mismatch scenario.
    -  The error is thrown for classes that do not define a constructor with a string argument for the name.
    -  Although this is not an issue with older UVM versions such as ``uvm-1.1d``, it is an issue for ``uvm-1.2`` :
        
        - *(uvm-1.1d)* 
          
          .. figure:: ../../images/common/uvm_1_1_d_obj_utils_expansion.png
        - *(uvm-1.2)* 
          
          .. figure:: ../../images/common/uvm_1_2_obj_utils_expansion.png
    -  From the pictures above it can be observed that by default the ''uvm-1.2'' version enforces a constructor with a string argument.
    -  To quickly check which version was compiled by DVT, disable the :ref:`Content Filters` using the toolbar button |cf|, open the :ref:`Macros View` |macros| and search for *uvm_version*.
    -  To compile a different UVM version see :ref:`SystemVerilog OVM or UVM Library Compilation`.
-  2b) The second scenario is where the simulator CLI gets passed ``+define+UVM_OBJECT_DO_NOT_NEED_CONSTRUCTOR`` but the directive is missing from ``.dvt/default.build`` |buildfile|.

**3) Error messages like:**

- |err| *Error: SYSTEM_VERILOG_2012: Undefined macro name: `uvm_record_attribute* 
   
  This typically happens when compiling the *uvm-1.1c* version and not specifiying a compatibility mode. The solution is to specify a :ref:`Compatibility Modes`.
