Different Reference Models For UVM Environment
Different Reference Models For UVM Environment
Abstract—With increasing digital systems complexity intro- proaches, AVM, OVM, and UVM have been introduced by
duced by the sophisticated architectures, design verification Accellera to unify engineer’s style of verification [2].
becomes challenging and crucial. Verification is required to UVM is the most recent verification methodology in the
provide enough confidence in the design before proceeding with
further expensive design stages, thus reliable reference models are industry that is fully automated and based on Object-Oriented
needed. Developing an efficient reference model is not an easy Programming (OOP) to be eligible for the reusability of
task and may cause delays in the verification process increasing the test bench. This makes it flexible to validate different
the time-to-market. This work elaborates the advantages of designs in addition to its ability to verify complex architecture
using high-level language reference models over the conventional accurately. UVM proposes a firm and productive approach
SystemVerilog ones in digital design verification. Comparison
between Python, C/C++, SystemC, Matlab, and conventional Sys- to build and reuse verification environments and components,
temVerilog reference models is explained from the perspectives making the verification environment flow consistent. It can
of the run-time, memory consumption, complexity of implemen- also be easily interpreted by any verification engineer and
tation and UVM-reference model interface. A separate Universal makes most of the environment plug and play for similar
Verification Methodology (UVM) environment is implemented for designs.
each reference model.
Since the verification is all about checking the correctness
Keywords—DPI, Python, Reference Model, SystemC, UVM, of the design, one of the most critical parts of any verification
Verification. environment is the expected output calculation. UVM output
is calculated by the reference model, which is normally
I. I NTRODUCTION implemented in SystemVerilog.
The problem is that when designing a UVM environment for
Verification of digital systems has been very challenging for complex designs as the wireless baseband digital systems. The
any design process since it requires verifying complex arith- implementation of the reference model would be a bottleneck
metic algorithms such as Fast Fourier Transform (FFT) [1]. since it is complicated. The reference model also must be
In Order to overcome the overhead that may be caused by coded with a high degree of accuracy which might be very
the verification process, reliable, fast and reusable verification difficult to achieve using Hardware Description Languages
techniques should be used. The used methods for the digital (HDL) especially with bulky designs that involve sophisticated
system verification have undergone many improvements in algorithms. Hence, the implementation of the design would
the past few years. It started with a simple testbench till not be coded in a straightforward readable manner using
the standardized techniques such as Advanced Verification this approach. Also the Design Under Test (DUT) is already
Methodology (AVM), Open Verification Methodology (OVM) written in HDL, so a high-level language is more convenient
and Universal Verification Methodology (UVM). to be used in a wide variety of applications. For instance,
Conventional testbenches are based on ”Directed Testing” the communication and signal processing communities utilize
by predefined stimuli in order to verify the expected behavior. Matlab for prototyping and delivering the abstraction models
However, it is insufficient and can not cover all the corner for the designs. While the video coding and image processing
cases. The basic solution to this problem is increasing the utilize C/C++. For neural network and machine learning devel-
number of test vectors. But it would take a huge effort with a opers prefer python. On the other hand, high-level synthesis
possibility of human errors and may consume a lot of time, yet and ASIC designers use SystemC [3]. So in order to unify
good coverage would not be achieved. Constrained Random the utilization of UVM for all communities and speed-up the
Test (CRT) is used to add constraints to the generated random time for verification development, different interfaces for all
stimuli with unexpected combinations that can be generated utilized languages are provided, which saves a lot of time in
during runtime. In order to standardize the verification ap- verification time-cycle.
68
Figure 3: C++ reference model Figure 4: Matlab reference model
IV. P ROPOSED R EFERENCE M ODELS compilation command. Questa Sim invokes the GCC passing
Each reference model is implemented and tested in a the needed compilation flags and include files [7].
standalone UVM environment. The algorithm of calculating
B. Matlab Model using “qmw” library
the expected output is the same in all the models as well as
UVM environment blocks, the only difference is the way the When it comes to designing a certain Digital Signal Process-
model is implemented and connected in order to guarantee a ing (DSP) algorithm, the most preferable choice is Matlab as it
fair comparison between each. contains all of the needed functions which verifies the design
architecture before proceeding to any further time-consuming
A. C/C++ Model using DPI connections implementation stages. Consequently, this initial simulation
The C/C++ is considered the most used programming lan- output would be the reference for all of the next stages.
guage overtime for many complex applications in embedded Therefore integrating Matlab implementation with UVM as
systems. Consequently, one might think C is the best can- a reference model adds more confidence to the verification
didate for developing a high-level language reference model. environment. Also, it will save the implementation time for
Thankfully with Direct-Programming Interface (DPI), using a any other reference models since it was already implemented
SystemVerilog-C connection has never been easier and we no in the earlier simulation stages. Furthermore, Matlab offers a
longer need to go deep with the VPI and PLI details [5]. wide variety of reliable tool boxes for different applications
SystemVerilog provides DPI that allows importing foreign with clear documentation that serves many areas.
language subroutine such as C functions. SystemVerilog tasks However, Matlab has a major drawback. It is not an open
and functions can also be exported to a foreign language. source and requires a license that may be expensive and
DPI libraries act as an interface for high-level language. It needs installations. When it comes to portability a Matlab
consists of two separate layers: SystemVerilog layer and a based UVM environment will not be the best solution, and
foreign language layer, the two layers are completely isolated since UVM is all about reusability some will find that Matlab
from each other [6]. reference model may not cope with this important feature.
A conventional UVM environment is designed but instead In order to have the ability to connect Matlab reference
of embedding the reference model into the “monitor ref” it model to UVM environment, there are two approaches. First
is implemented externally as a normal C function “tx ref”. via C based DPI interface. Second by using SystemC with
On SystemVerilog layer, this function is imported and de- TLM 2.0 as presented in [6]. Finally, the method used here
clared inside it. After the packet is generated, memory is as shown in Fig. 4 is a Questa Sim dedicated library to
allocated for the random packet along with the arrays that make the two programs communicate directly using socket-
hold the predicted output as a SystemVerilog open array since based interface without the need to implement interconnecting
C language lacks the concept of parameterized arguments, mechanisms. The used library “qmw” is precompiled and
on the other hand open arrays offer querying and access does not need any further implementation code. It simply
functions. Then the random packet is generated as stimulus initiates a bridge connection between SystemVerilog DPI and
and received at the “monitor ref”. It is sent to the C-model Matlab’s API [8]. On the Matlab side, a server is started with
by handle “svOpenArrayHandle” accompanied with the output a specific port that enables the data communication from and
arrays handle. In the C layer, the received packet can be to Matlab. This is done with the built-in Matlab’s function
accessed easily using a pointer to the open array handle. “hdldaemon” where it enables data transmission either through
Then, the computation of the expected output is calculated “I- shared memory or a socket port [9]. Using a port is better
phase and Q-phase components” that are saved in the arrays since it enables having Matlab installed on another machine
previously allocated using the array handles in SystemVerilog than the one used to run UVM environment on so it provides
side. After the calculation, “monitor ref” sends the output to more flexibility.
the scoreboard for comparison and repeat the process for other A TCL layer is implemented that allows sending any
packets as shown in Fig. 3. signals either at runtime or at post-simulation to Matlab. TCL
The environment execution is nearly the same where all commands can be executed using “tclHdlSim” to provide the
the Verilog files and C files are compiled using the normal interaction with QuestaSim. On QuestaSim side the design is
69
Figure 6: SystemC reference model
70
700
6
Simulation time in Sec[Log Scale]
Matlab
600
5 SystemC
Figure 7: Simulation time versus packets number Figure 8: Memory consumption versus packets number
71
Table I: Reference models comparison
SystemVerilog C Matlab Python SystemC
Performance Fast Fast Fast Slow Fast
Memory Average Average High Average Average
Interfacing Easiest Easy Moderate Complex Moderate
Reference Complex Moderate Easy Easiest Moderate
Model
Data Types High Low Low Low Medium
Compatibility
offers many hardware data types which are considered very [3] M. Smirnov and A. Takach, “A systemc superset for high-level syn-
close to those used in HDL languages. It also has methods thesis,” in 2009 Forum on Specification Design Languages (FDL), Sept
2009, pp. 1–6.
and threads equivalent to functions and tasks that make the [4] IEEE LAN/MAN Standards Committee and others, IEEE Standard for
reference model really simulates the behavior of the DUT but Local and metropolitan area networks, IEEE Std 802.15.4, IEEE.
with a syntax close to C++ and with all of the benefits of a [5] SystemVerilog DPI tutorial. Doulos. [Online]. Available:
https://www.doulos.com/knowhow/sysverilog/tutorial/dpi/
high-level language. [6] IEEE Computer Society and the IEEE Standards Association Corporate
Advisory Group, IEEE Standard for SystemVerilog Unified Hardware
VI. C ONCLUSION Design, Specification, and Verification Language, IEEE.
In this paper, we have presented various methods to im- [7] Questa SIM User’s Manual, Mentor, a Siemens Business.
[8] Matlab/integration. Mentor, a Siemens Business. [Online]. Available:
plement a high-level reference model for UVM environment. https://verificationacademy.com/cookbook/matlab/integration
The implementation methodology is listed for each model, [9] hdldaemon. The MathWorks Inc. [Online]. Available:
The PHY transmitter is used as a case study to achieve a https://www.mathworks.com/help/hdlverifier/ref/hdldaemon.html
[10] M. Slabicki and K. Grochla, “PyLTEs—Python LTE evaluation frame-
practical comparison between them. Consequently, the advan- work for quick and reliable network optimization,” in Telecommunica-
tages and disadvantages of each are revealed. This allows the tions and Signal Processing (TSP), 2016 39th International Conference
verification engineers to choose which one suits their needs. on. IEEE, 2016, pp. 64–67.
[11] M. Cieplucha and W. A. Pleskacz, “New constrained random and
The study has evaluated the reference models according to metric-driven verification methodology using Python,” in Design and
their time performance, memory consumption, the interfacing Verification Conference (DvCon US), 2017.
easiness, the simplicity of the model implementation and the [12] PotentialVentures. (2014) Cocotb (coroutine based cosim-
ulation testbench environment). [Online]. Available:
available data types. C/C++ was the easiest to connect with https://cocotb.readthedocs.io/en/latest/introduction.html
UVM, Matlab and Python reference models were effortless to [13] (2011, May) Embedding Python in another applica-
implement however, Python was complicated in the connection tion. Python Software Foundation. [Online]. Available:
https://docs.python.org/2/extending/embedding.html
as it required building a library from scratch to integrate it [14] IEEE Computer Society, IEEE Standard for Standard SystemC Language
with UVM environment, moreover, it achieved relatively poor Reference Manual, IEEE.
performance. SystemC is rich with different data types as well [15] UVM-Connect and TLM-2. 0 primer, Mentor, a Siemens Business.
[16] N. C. S. Campos, H. A. Monteiro, A. V. Brito, A. M. N. Lima, E. U. K.
as its ability to mimic the RTL behavior but on the other side, it Melcher, and M. R. A. Morais, “A framework for design and validation
needed a workaround to overcome its limitation of the payload of face detection systems,” in 2017 CHILEAN Conference on Electrical,
length. Electronics Engineering, Information and Communication Technologies
(CHILECON), Oct 2017, pp. 1–7.
R EFERENCES [17] Accellera Organization, Universal Verification Methodology (UVM) 1.0
Class Reference, IEEE.
[1] Y. Lee, V. Koo, and Y. Chan, “Design and development of FPGA- [18] Y. Zhu, T. Li, J. Guo, H. Zhou, and F. Fu, “A novel low-cost interface
based FFT co-processor for synthetic aperture radar (SAR),” in Progress design for SystemC and SystemVerilog Co-simulation,” in ASIC (ASI-
in Electromagnetics Research Symposium-Fall (PIERS-FALL), 2017. CON), 2015 IEEE 11th International Conference on. IEEE, 2015, pp.
IEEE, 2017, pp. 1760–1766. 1–4.
[2] UVM 1.2 User Guide and Reference Manual.
http://www.accellera.org/activities/vip, 2015.
72