Wrapping Verilog Bus Functional Model (BFM) and RTL as Drivers in Customized UVM VIP Using Abstract Classes
Wrapping Verilog Bus Functional Model (BFM) and RTL as Drivers in Customized UVM VIP Using Abstract Classes
Thomas Bodmer
AMD Sunnyvale, USA
Abstract- With the increasing complexity of design and verification requirements, more and more verification
teams adopted the UVM methodology to build their testbench. UVM could bring a highly reusable, scalable,
extensible and configurable framework to engineers to shorten the verification schedule and ensure quality.
UVM verification IP (VIP) usually stands for a specific standard protocol interface UVM verification
component (iUVC), and could be easily reused to different level of UVM verification testbenches (IP or SoC).
In general, the verification team integrates in-house or 3rd part UVM VIP to verify the standard bus protocol.
However, there may be no available UVM VIP for a particular bus protocol, and an engineer has to develop the
customized UVM VIP as specific requirements.
In special cases, the master IP is connected to different slave IP through a shared bus, where timing is
particular and a little bit complex. This master IP with bus interface had been proved in past projects at the SoC
level. When the IP team wants to verify a new IP with this type of shared particular bus interface that will be
connected to the same master IP at the SoC level, the customized UVM VIP is necessary to help verify the new
IP at the UVM stand-alone level at an early stage. With such requirements, the master IP designer could
decouple the RTL into a clean Verilog BFM model with two bus interfaces: one is to drive the new slave IP and
easy, and another is simply to get drive from others. The efficient way to create a customized UVM VIP is to
reuse and wrap the Verilog BFM model inside and use abstract classes to define functions that easily
communicate BFM with the VIP driver. The SystemVerilog (SV) interfaces are bind between BFM and UVM
VIP to make sure that BFM is invisible from the outside. The user could treat this UVM VIP as the general
UVM VIP. In this way, when the master IP designer updates the bus timing, the UVM VIP could sync up the
decoupled BFM without any change.
This paper will introduce a proposal to deploy this kind of customized UVM VIP, and discuss the reuse
considerations. Users could extend this approach to implement other similar scenarios.
Keywords - Customized UVM VIP, Verilog BFM, SV Interface, Bind Methodology, Abstract Class
I. INTRODUCTION
With the increasing scale and complexity of design, the requirements of VIP are becoming critical for
verification team to reduce the verification cycle and improve verification quality. In the traditional HDL
based verification testbench, verification engineers create the Verilog BFM VIP to mimic a specific bus
protocol (such as SRAM and DDR models) and integrate BFM in the legacy verification environment. The
Verilog BFM has several common functions and tasks which could be directly called by verilog test code.
These modular application program interfaces (API) are usually used for BFM initial, driving bus,
capturing bus, etc. With the great UVM methodology adoption in recent years, more and more verification
environments are built by UVM. UVM defines the reusable framework, versatile APIs and coding
guidelines for users to create and integrate UVM UVCs. The interface UVC is a reusable UVM interface
VIP, and acts in the same role as the legacy Verilog BFM. It’s usually hard to create the iUVC from scratch
to meet the tough verification schedule, so it’s really important to reuse the legacy and leverage the effort
and stability into the iUVC VIP. To make the iUVC VIP easy to use and straight forward, it’s also
important to hide all of the implementations from the end users point of view. As the engineer’s experience
[1], the legacy Verilog BFM could be connected to the UVM driver by calling the built-in APIs of BFM. In
this way, it really makes the proved Verilog BFM model able to be reused from the legacy verification
environment to the UVM VIP. The end user could use this kind of VIP as the normal UVM iUVC.
Unfortunately, we don’t have this kind of existing Verilog BFM model in our case. This paper discusses a
proposal for a customized UVM iUVC VIP which wraps Verilog BFM (which is directly decoupled from
the proved RTL design). For a better hidden integration of BFM into UVM iUVC VIP, we use the abstract
class concept, adapter, internal SV interfaces, and SV binding methodology. Let’s start with our
verification requirements and challenges, gradually introduce our proposed solution with example code,
and finally discuss the consideration of the use model extending to an SoC.
When our group develops the new slave IP with the same particular bus interface which will be
integrated in the SoC, we encounter the following challenges in UVM stand-alone verification.
There is no available UVM VIP including in-house and 3rd party.
There is no Verilog BFM which has modular functions and tasks API.
IP must be fully verified in UVM stand-alone, the SoC level verification is too late.
If master IP changes the bus timing, the slave IP UVM verification environment must sync up
without any changes.
To address the above challenges, as we can see in Fig. 2, the master IP designer could decouple the RTL
into a clean Verilog BFM model with two bus interfaces: the one called the lower bus is there to
communicate with the slave IP and the other called the upper bus is to get drive from high layers. The
designer also makes the upper bus timing simple and easy to drive. The IP verification engineer could get
the Verilog BFM (which always sync up with the master IP RTL design changes) to create the customized
UVM VIP.
In the simple way, we can create an interface UVC (iUVC) and adopt the SystemVerilog (SV) bind
methodology to hookup the Verilog BFM to a slave new IP and hookup iUVC’s virtual interface to the
Verilog BFM model. Verification engineers can write several sequences and run them on the iUVC to drive
the upper bus to BFM, and then the BFM will communicate with the slave new IP as master IP behavior.
The disadvantage of this method is it is not reusable at the higher level. At the SoC level, the BFM upper
layer is driven by the Maser IP RTL upper layer design. We don’t like to hack and bind the passive UVM
iUVC to the master IP RTL design.
In Fig. 7, the concrete slave_vip_adapter class implements similarly as the vip_driver_api class does. In
addition, it defines several pure virtual functions (e.g. get/set_data1) and tasks (Ex. toggle_data1). They
provide the abstract APIs to communicate the interface.
In Fig. 8, we implement the parameterized slave VIP interface for end users, it’s similar to the
slave_adapter_bus interface. The user could hookup the slave VIP interface instance to the DUV module
using SV bind methodology and set the handle of the interface instance to the uvm_configure database so
as to get it in the hierarchical UVM components.
Fig. 8. Parameterized interface and the binding for slave_VIP
In Fig. 9, we use the uvm_config_db API to get the adapter_api and driver_api handle in the slave VIP
agent and call the create_slave_adapter/driver API to get an instance of parameterized adapter/driver. The
slave_vip_agt is not parameterized, so it removes the integration overhead from uvm_agent to uvm_env
caused by the parameterized.
Fig. 9. Use concrete classes APIs to create the parameterized UVM component
Fig. 10 depicts the flow to bind interfaces and use the uvm_config_db facility to pass down the virtual
interfaces through Verilog BFM/DUV and UVM components.
Fig. 10. Interface binding and connection between the BFM/RTL and UVM component
In Fig. 11, the slave_vip_adpr implements similarly with slave_vip_agt. In the run_phase, we use the
adapter APIs to do the communication between BFM and DUV. For example, in the BFM2DUV flow, it
calls the adapter_api.toggle_data1 to get a BFM.data1 data changing, and then passes the BFM.data1 to the
slave VIP virtual interface by calling adapter_api.get_data1(). There are several parallel threads to ensure a
good handshake between BFM and DUV.
Fig. 11. Use concrete classes APIs to bridge the BFM and DUV
The proposal depicted in this paper can be extended to the other prototype such as, a PCI, I2C like interface
using bi-directional interface or an AMBA like interface with ORed structure and separated channels. The
key is to decouple the RTL design into a clean BFM with a simple upper bus interface. The verification
engineer and RTL design engineer should consider the reusable solution for both design and verification. In
general, it only needs to decouple the specific module, but not the whole design. The less it impacts the
RTL design the better.
To fully address the issues above, verification team should schedule the resource to create the proper lower
layer UVC and build the protocol layering architecture with existing upper layer UVC.
ACKNOWLEDGMENT
We would like to thank my wife (Liangliang Li) and the AMD team (Davis.Wan and Leo.zhang) for
their continued support. AMD, the AMD Arrow logo, and combinations thereof are trademarks of
Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes
only and may be trademarks of their respective companies.
REFERENCES
[1] http://www.shoaibinamdar.in/blog/?p=393
[2] IEEE 1800-2009 SystemVerilog
[3] David Rich, Mentor, “The missing link: the testbench to DUT connection”, DVCon USA 2012