Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Configurable Verification IP for UART

Stepan Harutyunyan Taron Kaplanyan


Chair of Microelectronic Circuits and Systems National Chair of Microelectronic Circuits and Systems National
Polytechnic University of Armenia Polytechnic University of Armenia
Synopsys Armenia Educational Department Synopsys Armenia Educational Department
Yerevan, Armenia Yerevan, Armenia
stepanh@synopsys.com tkaplan@synopsys.com

Artak Kirakosyan Haykaram Khachatryan


School of Electrical Engineering and Computer Science Chair of Microelectronic Circuits and Systems National
University of Ottawa Polytechnic University of Armenia
Ottawa, Canada Synopsys Armenia Educational Department
akira034@uottawa.ca Yerevan, Armenia
khachatr@synopsys.com

Abstract—Verification of Integrated Circuits using Verilog lacks been designed in this paper for UART interface. It is compliant to
the flexibility and reusability of the environment. System Verilog UART specification [6] and can be easily used to verify any
provides building blocks and OOP concepts to work with. That device that has UART interface. Let’s describe the advantages of
allows to create much more flexible test environment with reusable SystemVerilog that the VIP is using.
components. This paper presents a verification architecture of
One of such advantages is the functional coverage model [7].
configurable Verification IP for UART interface. The Verification IP
presented in this paper provides complete functionality of an System Verilog allows to do what’s called functional coverage-
operating UART interface and can be used to test any UART device. driven verification. In order to do that you need to “translate” the
A functional coverage model has been developed to determine if the technical documentation into set of cover points and create the
verification process covers all possible scenarios or not. Each testcase coverage model. The coverage model will determine which
reports coverage which is later used to analyze the effectiveness of features have been tested by the environment and which have not.
the testcase. Full coverage has been achieved using both random and That will help to understand the verification holes and cover them
directed test cases. The coding is done using System Verilog and the to assure in completely verified product.
simulation is done using VCS. Other than the Coverage model SystemVerilog has the
object-oriented programming (OOP) concepts integrated into the
Keywords—UART, Verification, Functional Coverage, System
Verilog language too. That allows to separate the verification environment
into smaller parts. Those smaller parts or how you separate those
I. INTRODUCTION are the base of verification methodologies like VMM and UVM.
System on Chip design nowadays uses many reusable IP In general, the components are generators, for generate certain
cores and requires a lot of effort for the functional verification of packets, drivers to send those packets, receiver to receive,
the system [1]. Since the systems are becoming bigger and bigger monitors to monitor the interfaces and scoreboard to check the
the requirements for speed on the verification environment is correctness of the operation. There are other components, but
increasing. Not only speed but also the effectiveness of the these are the widely used ones.
environment should increase in order to cover most functionality This paper concentrates on developing of configurable VIP
in least time possible. Verilog is one of the ways to describe the for UART interfaces. In upcoming chapters, the UART interface
hardware, but Verilog is designed for hardware modeling and overview is given to have general idea of the interface. The VIP
lacks the features that are required for verification of complex and test environment architectures are described, and everything
SoC designs. To fix those issues SystemVerilog has been is concluded with the functional coverage results of the VIP.
introduced with its specialized methodologies like Universal
II. UART OVERVIEW
Verification Methodology (UVM) and Verification Methodology
Manual (VMM). Those methodologies are currently widely used Universal Asynchronous Receiver-Transmitter is one of the
in verification [2]-[5]. Other than methodologies in the widely used interfaces. It is a single TX and single RX line
verification there are reusable IP blocks which are called interface. It can be configured to send and received data of 5-8
Verification Intellectual Properties (VIP). One of such VIP has bits long with and without parity bit. Parity can be either even

978-1-7281-9713-5/20/$31.00 ©2020 IEEE


2020 IEEE 40th International Conference on Electronics and Nanotechnology (ELNANO) 234

Authorized licensed use limited to: UNIVERSITY OF BIRMINGHAM. Downloaded on May 10,2020 at 08:47:42 UTC from IEEE Xplore. Restrictions apply.
Fig. 1 The operating model of UART

parity or odd parity. Also, the stop bit count can be 1, 1.5 and 2 line is being checked each BCLK and if on any of those the TX
bits. Let’s quickly go over the UART operating model. line doesn’t have logic 0 value it is considered as glitch and no
The UART bit clock is derived from an input clock of the sampling happens. This wraps up the operation of the UART.
UART. Each data slot consists of either 13 or 16 BCLKs. The Next chapter shows how the UART VIP was designed to support
operating model of the UART is presented in Fig 1. all these features.
When the data is being sent first the START bit should be
sent. In the idle state the TX line has logic high value and in order
to transmit the data TX line is being deasserted. On the receiver III. VIP ARCITECTURE
side it is being considered as the beginning of START bit. After As mentioned earlier System Verilog has been used to create
the START bit, DATA bits are being sampled. Depending on the the VIP. Unlike Verilog, System Verilog supports OOP which
configuration the data length can be from 5 to 8 bits long. After helps to create the verification environment much more
the DATA bits, there may or may not be the PARITY bit. And at faster and the components created for the current application may
the end, there are the STOP bits. Just like the START bit deasserts be used in others also, in other words the components are reusable.
the TX line the STOP bits assert the TX line. After that, the packet Since OOP concepts came into verification, the components
sending part has been completed and the process can be restarted. of the environment are split up. Fig. 2 shows the components that
When, the data is being sampled depends if each data lasts 13 the VIP consist of:
or 16 BCLKs. For 13 BCLK the data is being sampled at the 6th Generator: The generator is used to generate UART packets
BCLK and for 16 BCLK on the 8th. according to the DUT configuration. At the beginning of
simulation, before sending packets the VIP is being configured.
During that part generator is configured also and when Data
should be sent, packets with correct data format are being created.
CLK_GEN: This module is used both in driver and receiver.
It is used to generate the BCLK and is responsible for all
operations related to data sampling and glitch checking. It uses
EVENT mechanism to trigger data sampling and state changes.
Driver: Driver is the component that controls the TX line.
When the generator creates a packet, it is being passed to driver
through mailbox and driver starts to send it. Driver doesn’t check
the configuration, it is done on earlier stage inside the generator.
The Driver simply sends the data. It has an instance of CLK_GEN
class which controls the timing.
Receiver: This block is used for RX purposes. It monitors the
RX line and is also responsible for glitch checking on RX line.
This block also has an instance of CLK_GEN class. This module
in combination with its CLK_GEN module is also responsible for
glitch checking.
In order to pass the data objects from one class to another a
Fig. 2 VIPs Block Diagram
special class for data has been created. All mentioned components
Another thing to consider is the possible glitches that may are working with “uart_pkt” type. This is special type which
occur. To make sure that possible glitch on the TX line may not encapsulates all the info needed to describe a full packet. This
cause any non-valid data sampling, debounce mechanism is datatype is also used in Scoreboard to compare received and
implemented. Each time the TX line is being deasserted for the transmitted packets. Additionally, this data type includes special
first time (START bit) that mechanism comes into play. The TX variables which are sampled to determine functional coverage.

2020 IEEE 40th International Conference on Electronics and Nanotechnology (ELNANO) 235

Authorized licensed use limited to: UNIVERSITY OF BIRMINGHAM. Downloaded on May 10,2020 at 08:47:42 UTC from IEEE Xplore. Restrictions apply.
IV. TESTBENCH ARCHITECTURE object are used to sample coverage, those variables are set inside
the generator. When the coverage percentage reached certain
The Testbench architecture is presented in Fig. 3. It shows
level, the simulation is completed. That level is determined by
that the environment consists not only from DUT and the VIP but
user and shows how much of the functionality has been checked.
also has application and scoreboard.
In general, the test environment works in loopback mode.
Application (APP): is the application side of the UART, the
When the environment starts the application configures the DUT.
other side, that needs to use the received data or sends the data to
After that VIP is configured, and generator starts to create packets.
VIP through DUT. Application has control over the DUT, at the
Packets are put into send mailbox and VIP automatically sends
beginning of the test application reconfigures the DUT and resets
those. At the same time application monitors the DUT signals.
to prepare it for normal operation.
When the DUT receives data, the application reads it and moves
it into the TX buffer of the DUT. DUT sends it back to VIP. Using
this mechanism both TX and RX sides are being tested. The idea
mentioned here is shown in Fig. 4.
Whenever the DUT received data it generates the
“uart_rx_fifo_read” signal. After one clock cycle the data is being
reported to the “uart_rx_fifo_data_out”. Data is being taken from
that port, moved to “uart_tx_fifo_write_data” and
“uart_tx_fifo_write” is being pulsed. It completes the loop and the
data is already in the TX fifo of the DUT. Since the TX is enabled
DUT starts to send that data back to VIP. Before sending the
packet is being sent to the Scoreboard to compare with the packet
that VIP will receive. In general, the Scoreboard has 4 packet
queues. It is separated 2 by 2 to compare data that VIP sent and
Fig. 3 Test Environment Diagram
APP received and vice versa.
The Verification process is separated into couple phases, one
Scoreboard: This component is responsible for multiple of them is random testcases to cover most of the functionality.
things. First of all, it is used to compare sent and received data. It After that directed testcases are written to hit scenarios that
has 4 mailboxes which are used to compare data sent in both randomization-based testing hasn’t hit. Same process was used for
directions. When VIP sends data, it puts sent packet into this environment also. In the random testcase the application was
scoreboard and when the DUT received that exact packet it puts reconfiguring the DUT, VIP was reconfigured after that and
it into scoreboard too. Those two packets are than compared to certain number of packets were being sent in the loopback mode.
make sure data was not corrupted. It was being done until a coverage of 90% was reached. When that
was done the results have been analyzed and remaining part has
been covered using directed testcases. These test cases allowed to
achieve 100% coverage on UART functionality.

V. FUNCTIONAL COVERAGE AND SIMULATION RESULTS


In order to measure the efficiency of the verification the code
coverage is introduced. It does a quantitative measurement of the
test environment by measuring and reporting the percentage of the
DUTs checked functionality [7]. One of the Coverage types is the
Functional Coverage. It is determined by user and can be used to
understand how much of the design specification is tested in the
environment.
Two separate cover groups have been introduced to check the
VIPs functionality. One for Tx side of the VIP and one for RX.
The Functional coverage cover groups are shown in Fig. 5. From
that figure it is seen that 100% coverage has been obtained on both
Fig. 4. Loopback Mode in TE
cover groups. The Code coverage results are being calculated after
Scoreboard is also responsible for test termination. This is each packet is sent and received either from VIP of from
generally used in random testing, since it is hard to put an application side. Than if it is random testcase the coverage metrics
endpoint in random testcase. It works based on coverage is used to terminate the simulation.
percentage. After successful comparison of the packet, the packet
is used to take coverage results. Special variables inside the packet

2020 IEEE 40th International Conference on Electronics and Nanotechnology (ELNANO) 236

Authorized licensed use limited to: UNIVERSITY OF BIRMINGHAM. Downloaded on May 10,2020 at 08:47:42 UTC from IEEE Xplore. Restrictions apply.
To achieve the full coverage both random and directed TABLE I. TEST CASE DISCRIPTIONS
testcases have been developed. Table 1 shows the summary of the Coverage Simulation
Test Name Config Name
testcases. Table contains the test case name, configuration of the TX/RX Time(s)
UART, Coverage percentage in both TX and RX (all the testcases Directed 01 8-EN-ODD-1 51.6 / 51.38 7.18s
were using the loopback mode) and the simulation time. Directed 02 7-EN-ODD-1 51.6 / 51.38 6.88s
Directed 03 6-EN-ODD-1 51.6 / 51.38 6.65s
Directed 04 5-EN-ODD-1 51.6 / 51.38 6.40s
Directed 05 8-EN-EVEN-1 51.6 / 51.38 7.22s
Directed 06 8-DIS-ODD-1 51.6 / 51.38 6.84s
Directed 07 8-EN-ODD-2 51.6 / 51.38 7.48s
Directed 08 8-EN-ODD-1.5 51.6 / 51.38 7.28s
Directed 09 8-EN-ODD-1 41.66 / 43.05 4.23s
Random 01 -Random- 95/83.33 65.8s

Test environment on the other hand implements not only the


VIP but also application which allows to run the tests in loopback
Fig. 5 Cover groups of the VIP
mode allowing faster simulations and less code to manipulate the
Directed testcases from 1-4 test the environment for the bit DUT. About 10 Directed Test cases are written and simulated
width. Test 05 checks the functionality of Even parity instead of using VCS to verify the functionality of UART. The simulation
ODD. Test 06 is using disabled parity. Testcases from 7-9 are waveform shows the successful data transfers in UART protocol.
checking the stop bit count. Coverage results are reported in “vdb” This is also proved by the scoreboard results, as the VIP has
format. As Table 1 shows all these testcases have quiet low implemented data check mechanism. Functional coverage reports
percentage on the coverage as they are testing specific show 100 percent functional coverage, this means that all the
functionality of the UART Interface. In order to understand if cover groups are covered and prove the effectiveness of the
whole functionality was covered or not all those “vdb” files have verification environment. The UART VIP created can be easily
been merged and final results show 100% of coverage. used to test any device that has the UART interface as it can
Other than usual testcases an error injection test case has been
simply be integrated in almost any Verification environment.
developed to check if the RTL will detect the wrong parity and
will assert appropriate signal. That has been done using callback REFERENCES
mechanism. Before starting to send the packet, a certain function
is called. This idea is called callback. It is used to inject error [1] Khan S. A. “Digital design of signal processing systems: a practical
approach”, John Wiley & Sons, pp. 21-132, 2011.
scenarios, such as parity error and also for coverage collection in
[2] Visalli G. “UVM-based verification of ECC module for flash memories” in
bigger designs. 2017 European Conference on Circuit Theory and Design (ECCTD). IEEE,
Random testcase has also been implemented. It works in 2017. С. 1-4.
certain order. At the beginning of the simulation application [3] Elakkiya, C., Murty, N. S., Babu, C., & Jalan, G. “Functional Coverage-
reconfigures the DUT. When DUT is configured, the VIP is Driven UVM Based JTAG Verification”, in 2017 IEEE International
reconfigured according to DUTs signals using same interface that Conference on Computational Intelligence and Computing Research
(ICCIC), pp. 1-7, IEEE. 2017.
the application used to configure the DUT. When that is also [4] M. Moskala, P. Kloczko, M. Cieplucha, and W. Pleskacz, “UVM based
completed the VIP’s starts to generate and drive packets verification of bluetooth low energy controller”, in 2015 IEEE 18th
according to the applied configuration. After certain numbers of International Symposium on Design and Diagnostics of Electronic Circuits
packets, if scoreboard doesn’t report any data mismatch the & Systems, pp. 123-124, IEEE, 2015.
configuration is randomized and the loop of reconfiguring the [5] Vineeth, B., and B. Bala Tripura Sundari. "UVM Based Testbench
Architecture for Coverage Driven Functional Verification of SPI Protocol."
application and DUT starts again. 2018 International Conference on Advances in Computing, Communications
The endpoint of the random testcase is determined by the and Informatics (ICACCI)., pp. 307-310 IEEE, 2018.
coverage results. It is being sampled after each packet is checked [6] Instruments, Texas. "Keystone architecture universal asynchronous
in scoreboard and scoreboard from its side stops the loop if the receiver/transmitter (uart) user guide." Texas Instruments User Guide
coverage has reached a certain threshold. For current testcase the (2010).
threshold was set to 90%. As shown in Table I the end result was [7] Chris Spear, "System Verilog for Verification, A guide to Learning the
Testbench Language Features", 3rd ed., pp 295-332, 2012.
95% on RX side and 83.33% on TX side. [8] VCS® User Guide,Synopsys Inc. – Dec 2019. -2106p.
[9] Bergeron J. et al. “Verification methodology manual for SystemVerilog” –
VI. CONCLUSION Springer Science & Business Media, pp. 260-280 2006.
[10] Accellera, Universal Verification Methodology 1.1 User’s guide, CA,
A Verification IP for UART interface verification has been (2011).
successfully implemented using System Verilog. Simulations [11] Chu, Xiao Bin, L. U. Tie-Jun, and Y. Zong, "Combination of Assertion and
have been done using VCS [8]. The VIP architecture is created Coverage-Driven Verification Methodology." Microelectronics & Computer
11, 2008.
based on general verification concepts including generator,
drivers, scoreboard etc.

2020 IEEE 40th International Conference on Electronics and Nanotechnology (ELNANO) 237

Authorized licensed use limited to: UNIVERSITY OF BIRMINGHAM. Downloaded on May 10,2020 at 08:47:42 UTC from IEEE Xplore. Restrictions apply.

You might also like