UVM Reuse

Author: Ramprasad Chandrasekaran, Principal Verification Consultant

How to use a non-UVM VIP in a UVM environment

What are we talking about?

We as a verification community like to talk about creating UVM VIP and its benefits, but do we know how to integrate a non-UVM VIP provided by FPGA vendors or other vendors written in System Verilog into a hierarchically structured UVM Test bench?  We are going to assume for this blog that the non-UVM VIP is written in System Verilog. Perhaps it is possible to create a native System Verilog VIP, but if we’d like to reuse it as well as take advantage of UVM benefits such as the OOP (Object-Oriented Programming) concepts to model the data structures, synchronizing/data transfers between UVM and the non-UVM VIP, then I wanted to shed some light on how we can approach it.  

What’s the problem?

Let’s assume we are building a testbench for a DUT which will use the UVM methodology to architect the verification framework.  If there is a specific interface (either proprietary or an existing VIP which is non-UVM), then we could follow the steps below to incorporate it as part of the UVM test bench.  This allows us to use the benefits of the UVM test bench such as randomization, configuration of the components, and ensuring consistent testbench flow. UVM introduces “Phases” to synchronize major functional steps a simulation runs through.  These steps are sequential in nature which are executed in the following order:

  • Build Phases
    Where the testbench is constructed, connected and configured.
  • Run-time Phases
    Stimulus generation & time consuming simulation takes place here.
  • Clean up Phases
    Here the Test results are collected and reported.

We also are trying to address some different issues using non-UVM IP which affects the following data points, such as:

  • Number of lines of code can be reduced if we employ the factory and configuration database methods available as part of the UVM constructs.
  • Randomization of the data structures is not possible
  • Reuse of the stimulus is limited.
  • Scalability of the testbench is affected
  • Readability of the code and number of lines code written is too much compared to UVM.

What’s the solution?

We are using the MDIO Verification IP which is a System Verilog VIP which is what we are integrating as part of the UVM VIP testbench. Here are a few examples of how we integrate the VIP into the existing testbench. The solution addresses the easy reuse of the non-UVM IP provided by vendors and also enables the benefits of UVM constructs to be leveraged with limited lines of code.

For usage, the following steps should be done:

  1. Import MDIO_S package into your test or the testbench

import MDIO_S::*

  1. Create MDIO_s_env class object

Description: mdio_ifc_s is the reference to the MDIO Slave interface instance name.  

Challenge: We have to create the instance of the environment in build phase.  As this is the phase used to build testbench components and create their instances

class test_top_env extend uvm_env;

  MDIO_s_env m_mdio_env;

  function new (string name, uvm_component parent);

    super.new(name, parent);

    printer = new();


  extern virtual function void build_phase(uvm_phase phase);

  extern virtual function void connect_phase(uvm_phase phase);

endclass : test_top_env

function void test_top_env::build_phase(uvm_phase phase);

  if (!uvm_config_db#(cfg)::get(this, “”, “cfg”, cfg))


  m_mdio_env = new(cfg.mdio_ifc_s);

endfunction : build_phase

  1.  Instantiate the mdio_s_if interface in you testbench and connect interface ports to your DUT.

`include “mdio_s_if.sv”

module tb_dut_top;

  import MDIO_S::*;

  wire mdc;

  mdio_s_if u_mdio_s_if(mdc);

  test_top dut (





  uvm_config_db#(virtual mdio_s_if)::set(null,”*”,”mdio_ifc_s”, u_mdio_s_if);

endmodule : tb_dut_top

  1.  The example below shows how the MDIO environment and interface can be instantiated in the UVM environment:

class cfg extends uvm_object;

  virtual mdio_s_if mdio_ifc_s;

  function new (string name, uvm_component parent);

    super.new(name, parent);

    printer = new();


endclass : cfg

  1.  Start MDIO Slave Environment for triggering the stimulus and also the tasks/functions as part of the non-UVM IP in sequence or the monitor:


Description: Now MDIO slave verification IP is ready to respond transactions initiated by master device. We want to call this function in the build_phase of the common sequence so that it starts to look for all the transactions triggered by the sequencers

Challenge: Make the tasks to be virtual so we can override them in the test to add additional functionality using the polymorphism concept as part of UVM

class test_mdio_config_ral_seq extends uvm_sequence;

  test_top_env env;  

  test_top_base_seq init_seq;


  function new(string name=”test_mdio_config_ral_seq”);



  virtual task body();



  endtask : body

  virtual task configure_mdio();

    rand this_addr_t l_addr;

    rand this_data_t l_data;

    rand int dev_type    this_data_t value;


  end task: configure_mdio

  task run_phase(uvm_phase phase);

    phase.raise_objection(this, “Test Started”);

    init_seq  = mpp_top_base_seq::type_id::create();


    phase.drop_objection(this, “Test Finished”);

  endtask : run_phase

endclass : test_mdio_config_ral_seq

Note: Randomization can be done as part of the encompassing sequence. Once the static value is received, then it is passed to the non-UVM IP.  This way the non-UVM IP tasks can be called to leverage the functionality and use the UVM methodology benefits as well.

  1.  UVM has the factory concept which essentially means that you can modify or substitute the nature of the components created by the factory without making changes to the testbench.  Say, you have written two driver classes, and the environment uses only one of them. This helps reducing the number of lines in the code as we can just override the tasks instead of creating redundant code.

class test_top_test extend uvm_test;

  function new (string name, uvm_component parent);

    super.new(name, parent);

    printer = new();


  function void test_top_env::build_phase(uvm_phase phase);

    set_type_override_by_type (uvm_object_wrapper original_type,

      uvm_object_wrapper override_type, bit replace=1);  

    set_type_override_by_name (string original_type_name,

      string override_type_name, bit replace=1);

    set_inst_override_by_type (uvm_object_wrapper original_type,

      uvm_object_wrapper override_type, string full_inst_path);  

    set_inst_override_by_name (string original_type_name,

      string override_type_name, string full_inst_path);

  endfunction: build_phase

endclass: test_top_test

We could follow the same strategy as we used in the sequence to call the functions and tasks of non-UVM IP in the monitor to decode and work on the data structures. Once the data structure is captured, we could use UVM constructs to do checking and eventually pass it on to the coverage monitor for functional coverage.

XtremeEDA is an experienced partner you can trust!!

Cadence Design Systems helps engineers pick up the development tempo. A leader in the market for electronic design automation (EDA) software, Cadence sells and leases software and hardware products used to design integrated circuits (ICs), printed circuit boards (PCBs), and other electronic systems. Semiconductor and electronics systems manufacturers use its products to build components for wireless devices, networking equipment, and other applications. The company also provides maintenance and support, and offers design and methodology consulting services. Customers have included Pegatron, Silicon Labs, and Texas Instruments. Cadence gets more than half of its sales from customers outside the US.

Synopsys, Inc. (Nasdaq:SNPS) provides products and services that accelerate innovation in the global electronics market. As a leader in electronic design automation (EDA) and semiconductor intellectual property (IP), Synopsys’ comprehensive, integrated portfolio of system-level, IP, implementation, verification, manufacturing, optical and field-programmable gate array (FPGA) solutions help address the key challenges designers face such as power and yield management, system-to-silicon verification and time-to-results. These technology-leading solutions help give Synopsys customers a competitive edge in quickly bringing the best products to market while reducing costs and schedule risk. For more than 25 years, Synopsys has been at the heart of accelerating electronics innovation with engineers around the world having used Synopsys technology to successfully design and create billions of chips and systems. The company is headquartered in Mountain View, California, and has approximately 90 offices located throughout North America, Europe, Japan, Asia and India.

asicNorth was established in January 2000 with one purpose in mind: deliver the highest quality design services possible. In an industry that can be quite volatile at times, it is important to have a design partner that you can depend upon to deliver the skills you need when you need them. A project can only be successful if there are:

Top quality skills on the team
Communication with the customer
Attention to detail
Cost sensitivity
Focus on the schedule

Today, asicNorth is enabling high-tech industry leaders and startups alike with a combination of digital, analog, and mixed-signal design capabilities. Driven to produce successful results, asicNorth is Making Chips Happen™.

Codasip delivers leading-edge RISC-V processor IP and high-level processor design tools, providing IC designers with all the advantages of the RISC-V open ISA, along with the unique ability to customize the processor IP. As a founding member of RISC-V International and a long-term supplier of LLVM and GNU-based processor solutions, Codasip is committed to open standards for embedded and application processors. Formed in 2014 and headquartered in Munich, Germany, Codasip currently has R&D centers in Europe and sales representatives worldwide. For more information about our products and services, visit www.codasip.com. For more information about RISC-V, visit www.riscv.org.

Founded in 1999, Avery Design Systems, Inc. enables system and SOC design teams to achieve dramatic functional verification productivity improvements through the use of

Formal analysis applications for RTL and gate-level X verification;

Robust Verification IP for PCI Express, USB, AMBA, UFS, MIPI, DDR/LPDDR, HBM, HMC, ONFI/Toggle, NVM Express, SCSI Express, SATA Express, eMMC, SD/SDIO, Unipro, CSI/DSI, Soundwire, and CAN FD standards.

Siemens EDA
The pace of innovation in electronics is constantly accelerating. To enable our customers to deliver life-changing innovations to the world faster and to become market leaders, we are committed to delivering the world’s most comprehensive portfolio of electronic design automation (EDA) software, hardware, and services.