|Author: Rich Edelman - Mentor, A Siemens Business Introduction: This paper will demonstrate techniques and methods for using DPI-C along with a standard UVM Testbench. The C code will take the form of low level transaction generator, high level transaction generator, scoreboard and monitor. The UVM Testbench will be operating at the same time – for example the UVM tests may be streaming background traffic on the bus, while the C code is creating specific bus transactions that are under test. The Problem with the UVM and C: The UVM is used quite widely for testbench creation, coverage collection and monitoring. Using SystemVerilog and UVM has become a way to improve productivity in verification teams. In addition to the power of randomization and constraints that UVM offers naturally, verification teams have needs to create or reuse C programs. These C programs may generate stimulus, they may check golden results, they may collect statistical data. Using SystemVerilog DPI-C is the way to connect these two worlds together. The problem is that using DPI-C can sometimes be hard, and the DPI code has a close connection to a “scope”. A scope can be a module instance, an interface instance, or the global root scope. These scopes offer the DPI a connection point for calling back and forth from SystemVerilog. A UVM testbench has few if any of these kinds of scopes. A UVM testbench is a dynamic class based structure, not a static instance based structure. A Solution: The Virtual Interface: There are a number of solutions for easily connecting the UVM and C. This paper will explore the simplest approach – leveraging the interface (virtual interface) that will be associated with an agent.Background A UVM testbench is frequently built with an agent attached to a SystemVerilog interface. The interface is connected to the DUT pins. For communication to the DUT, the UVM driver causes the interface pins to wiggle. For communication from the DUT, the UVM monitor collects pins wiggles. The interface instance is a perfect place to host our DPI-C calls. View & Download: Read the entire UVM and C Tests - Perfect Together technical paper.