Functional Verification of SPI Protocol Using UVM Based On AMBA Architecture For Flash Memory Applications
Functional Verification of SPI Protocol Using UVM Based On AMBA Architecture For Flash Memory Applications
Abstract—Effective verification of circuit designs is required protocol data transfer is between the slave and master.[4]. Before
because integrated circuit designs keep growing, and hence the attempting to transmit again, a device that is transmitting data must
process of verification is becoming major challenging and read the incoming data. The devices always exchange data with one
prolonging action. Hence, there is a need for a robust testbench another. A device acts as both transmitter and receiver. [3]. Between
hierarchy that contains essential common control components the devices the data exchange is done by clock line namely SCK,
which are widely transformable and can be simply extended to which is controlled by the master device.
models. One architecture that implements architectures for The UVM Class Library, the units are provided to create test
testbench in verification environments along coverage with CRT environments and verification components(reusable), is used to
is the Hierarchy of Universal Verification Methodology (UVM) model the entire architecture in this research project. [5,6].
(Limited Random Test). According to the verification strategy The bus protocol and the specifications, which is more suited to
developed following a thorough analysis of the SPI protocol reusing IP, must be followed in the development of IP. Applications
specifications, the current work is appropriately focused on the for the AMBA bus abound on system chips built around the ARM
SPI Single Master and Multiple Slave protocol based on UVM processor. Additionally, the ARM processor holds a dominant share
verification. The UVM test bench targets on bringing forth in the embedded sector. As a result, the AMBA bus protocol enjoys
random vectors that are fed to a DUT (Design Under Test) or widespread acceptance both domestically and internationally and is
SPI module and compares them with the output secured by a the industry standard for on-chip bus architecture. Hence, the
scoreboard. This procedure helps to validate SPI functionality. creation of communication protocols using AMBA bus has
The SPI interface has flexible bandwidth and frequency and can significant current and future utility. SPI is a communication
give and take data from multiple slaves and powerful APB SPI protocol that is frequently used in the AMBA bus architecture and
controllers. An SPI device is difficult to manage over the AMBA has a variety of benefits, including user friendly, resource
bus because it is usually attached to the main data bus of the conservation, dependability, and stability. To make sure it can be
system, such as the AMBA APB bus interface core. In the field used for IP reuse, this research created the SPI protocol and
of embedded systems, flash memory has gained its significance. performed front-end design and functional verification on it.
This paper describes how an analog FPGA-based SPI FLASH
memory system can be used in various applications by taking
advantage of its features such as parallelism, reconfiguration,
fast real-time and high speed.
I. INTRODUCTION
The majority of the SOC is made up of various peripherals,
including registers, memories, digital to analogue converters, and
others. As a result, data transmission and reception between the
various connected peripherals inside the SOC are required. Often
used most popular serial interface for intra and inter-chip normal
speed data transfers is serial peripheral interface (SPI). It is utilised
to transfer data between a processor and various hardware Fig. 1:SoC for Flash Memory
components, such as external memory, data conversion circuits, etc.
[1]. SPI is usually referred to as a "little" interface communication Due to its less power consumption, low pin count, high speed,
in the world of protocols. It's critical to keep in mind each protocol's increased capacity, low cost, and lack of data loss after a power
goal. Meanwhile communication between low to medium speed data outage, FLASH memory is utilized in many applications in
exchange with on board peripherals is good using SPI. embedded sector. The widespread use of SPI+FLASH in many
Communication with outside world and data transfer inside the fields has exposed a number of issues. For instance, even though
system is done using Ethernet, USB, and SATA. [2], [3]. In SPI FLASH works quickly in bigger data volumes, instructions and
Authorized licensed use limited to: KLE Technological University. Downloaded on November 23,2023 at 13:12:43 UTC from IEEE Xplore. Restrictions apply.
311
timing of Flash are complicated, and repeatedly rewriting in small
volumes of data is not simple or flexible. Applications which
involve high-speed data transmission clearly benefit from the
FPGA's high integration and flexibility, low power consumption,
good speed, and real-time performance. The most common remedy
is to apply an FPGA to oversee the SPI+FLASH memory system.
This involves using the FPGA as the controller to control the
SPI+FLASH and perform various operations like reading, erasing
and writing of FLASH while also receiving commands from the host
computer.
Authorized licensed use limited to: KLE Technological University. Downloaded on November 23,2023 at 13:12:43 UTC from IEEE Xplore. Restrictions apply.
312
ease of engineers to control, the driver can convert transaction level bridge ought to act as a slave device for both. The bridge becomes
stimuli to signal level stimuli that the DUT can recognize, whereas more than just a simple location for data exchange as a result of these
the DUT line output is converted to transaction level data by the problems. It should have a sophisticated control system with
monitor that is easy to understand. The ideal value of the information memory units and an error-handling system. Such a construction
or data is represented by outcome of the reference model. The does, however, allow for a reduction in processor usage when it
scoreboard compares the two data which are transmitted from the comes to the link to external devices. The structure shown in Fig.3
monitor which obtains the actual value of data. The APB bus contributes four major activities:
transmits the signal to APB master agent, which is typically the • control,
master device also acts as input agent. The DUT is paired with an • data storage,
output agent known as SPI, one of which is a slave device and the • synchronization,
other a master device. • serialization.
It is necessary to use "first in, first out" (FIFO) buffers. The two
FIFO memories receive signal transmissions in memory words of
the user's chosen length. The memory address is automatically
increased after each read/write cycle. The system clock synchronises
the quick APB transmission, whereas the much slower SPI
transmission may have a different clock period. The system clock
and SCK are synchronised by the edge detector in order to avoid
mis-detecting the data and finds the edges at the nSS line, which are
critical for the auto-incremented memory. The knowledge is saved
in memory words. The serializer and de-serializer enable the
serialisation of parallel data from memory for SPI transmission or
reception. Control is handled by the control unit communicated to
Fig. 3. Bus verification platform for SPI the address decoder. It finds the selection of a bridge, keeps track of
data flow, alerts the user to faults, resets the bridge, and sends
transmission acknowledgement. Data overflow and reading of a
IV. AMBA ARCHITECTURE vacant FIFO is prevented by control unit. A specified input word can
Architecture of APB/SPI bridge is shown in Fig. 3. The APB bus read the status register, which is automatically updated to reflect any
relies on parallel transmission and needs a large data bus (Fig.4), exception, if one occurs. By writing the right value to the right
usually with 32 bits for the data read bus (PRDATA) and 32 bits for register, the reset could be both hard (hardware) and soft (software).
the data write bus (PWDATA). The device address bus (PADDR)
and the protocol-specified signals clock (PCLK), slave select
V. SPI FLASH MEMORY
(PSEL), write (PWRITE), write/read enable (PENABLE), and
acknowledge are additionally necessary (PREADY). The High-performance non-volatile memory, also known as FLASH
transmission and system clock are in sync. memory, is a type of memory system that merge the privileges of
RAM and ROM, transfers data fast, and maintains data when power
is lost for an extended period of time, much like a hard drive. The
main distinction between FLASH and EEPROM is that each unit are
erased using FLASH, whereas bytes are erased using EEPROM.
There are also differences in the addressing schemes and the storage
unit's structural design. EEPROM is often used as data storage
which is nonvolatile than FLASH because of its simpler circuit
structure, lower cost, and smaller chip area per unit of capacity.
FLASH is therefore well suited for storing programs. The two most
popular non-flash memory technologies are NOR and NAND. Using
a memory block a permanent memory called FLASH can be reset
and reprogrammed. At all time, erasing data ought be completed
before writing, because FLASH writing can only be done on deleted
or deleted cells. While erase operations in NAND memory are fairly
simple, erase operations in NOR mode require all bits in the target
block to be reset to zero first. [7].
The FLASH chip the MX25L3206E shown in Fig 5 was selected
for this study. It has 64 Blocks, each of which is composed of 16
Sectors. Each section has 12 memory addresses, and every block can
be individually erased. Up to 64k bytes of data can be stored in each
block and every section up to 4k bytes of data. If the instructions are
followed, each Block can be completely erased. Figure 4 below
Fig. 4. The Architecture of APB/SPI bridge displays the serial flash memory block diagram. There are two
output modes: one with 33554432x1 bits and the other with
Depending on the number of peripherals, the SPI only has 3 to 4 16777216x2 bits. The SPI protocol is compatible with both SPI0 and
wires: master out slave in (MOSI), slave select (nSS), serial clock SPI3 method of operation, and the voltage at which it operates for
(SCK), and master in slave out (MISO). Because SPI transmission erasing, reading, and writing data on this chip is -2.7 to 3.6 volts.
rarely exceeds 1 Mbit/s, it is significantly slower than APB but much The region that is protected from page programming and erasure
more useful for external devices. instructions is identified by the block storage protection function
The Advanced Peripheral Bus/Serial Peripheral Interface bridge using the bp3-bp0 state bit. This chip can transfer data via a three-
needs to be "unseen" to both the Central Processing Unit and the wire bus thanks to the SPI interface and a software protocol that
peripheral. In addition, SPI is very much slower than APB, for includes a Serial Clock Input (SCLK), Serial data (SI) and Serial
asynchronous communication between CPU and a peripheral, the data Outputs (SO). The CS input enables serialization of the device.
Authorized licensed use limited to: KLE Technological University. Downloaded on November 23,2023 at 13:12:43 UTC from IEEE Xplore. Restrictions apply.
313
During bidirectional output read mode, the Serial Input and Serial
Output signals of the chip become SIO0 and SIO1 pins for
communication. Status registers are built into the chip to provide
practical user interfaces for users and to indicate the status of the
chip. A read status register instruction can find out whether a page
program command or an erase command has been executed by
looking up the WIP bit. During the off state of the device, it is in
standby mode with high CS.
Status register will be checked to make sure that the device is ready
for the operation. The memory enters standby mode when
unauthorized instruction is received to the device. It stays in standby
mode till correct command is inputted to the device. Access to
memory array is neglected when a write status register operation is
in progress.
The RTL Module for the AMBA Architecture for the SPI
is represented in the Fig 7 for the Flash memory applications.
Synthesis report for the AMBA Architecture is given in the Table 2.
EDA-Playground tool along with the mentor questa 2021.3 and 40 Control Logic
Percentage of Utilization
synopsys VCS 2021.09 simulator tools. The simulation of the the 35 SPI Master-Slave
UVM shown in the Fig 6. 30
25
20
15
10
0
No. of Slices No. of input LUT No. of bounded IOBs Number of GCLK
Parameters
Authorized licensed use limited to: KLE Technological University. Downloaded on November 23,2023 at 13:12:43 UTC from IEEE Xplore. Restrictions apply.
314
VII. CONCLUSION [17] PallaviPolsani, V. Priyanka B., Y. Padma Sai, “Design & Verification
of Serial Peripheral Interface (SPI) Protocol”, International Journal of
Recent Technology and Engineering (IJRTE) ISSN: 2277-3878,
In this study, System Verilog is used to create a UVM environment Volume-8 Issue-6, March 2020
for the SPI protocol. Full duplex serial communication between a [18] Deepika, Jayanthi K Murthy “Interrupt Enabled Priority Based Master
single master and multiple slave modules can be verified and Slave Communication using SPI Protocol”, International Journal of
validated by using test bench. The AMBA architecture, which Innovative Technology and Exploring Engineering (IJITEE), ISSN:
connects the APB and SPI protocols, is also covered in this essay. 2278-3075, Volume-9 Issue-9, July 2020
SPI is used in real-time, high-speed applications, and can interface [19] N.Venkateswara Rao, PV Chandrika, Abhishek Kumar and Sowmya
with flash memory. Overall, System Verilog, UVM (Universal Reddy “Design of AMBA based AHB2APB protocol for efficient
utilization of AHB and APB”, International Research Journal of
Verification Methodology), and AMBA architecture are used to Engineering and Technology (IRJET), Volume 07, Issue 03, pp. 2395-
create, test, and apply a reusable SPI protocol that can be used in 0072, 2020.
Flash Memory. The simulation of the DUT is carried out for the [20] Vaishnavi R.K, Bindu.S and Sheik Chandbasha, “Design and
flash memory is done for the AMBA architecture provides better Verification of APB Protocol by using System Verilog and Universal
performance. Verification Methodology”, Internat ional Research Journal of
Engineering and Technology (IRJET), Volume 06, Issue 06, pp. 2395-
0072, 2019.
REFERNCES [21] Kommiriset t i Bheema Raju and Bala Krishna Konda, “Design and
Verification of AMBA APB Protocol”, Int Journal of Engineering
[1] Ni W and Zhang J “Research of reusability based on UVM Research and Application, Volume 7, Issue 1, pp.87-90, 2017.
verification” IEEE 11th Int. Conf. on ASIC, 2015 pp 1–4. [22] Xiuli Yu, Bingqi Li,” Simulation SPI+FLASH system based on FPGA”
[2] Rajashekar Reddy P, Sreekanth P and Arun Kumar K “Serial peripheral The 2019 6th International Conference on Systems and Informatics
interface-master universal verification component using UVM” Int., [23] Muhammad Hafeez, Azilah Saparon” IP Core of Serial Peripheral
Journal of Advanced Scientific Technologies in Engineering and Interface (SPI) with AMBA APB Interface” 2019, IEEE Xplore.
Management Sciences, 2017 3 p 27. [24] Dr. Punith Kumar M B, Sreekantesha H N,” Design and Verification
[3] Prasad R and Rani C S “UART IP core verification using UVM” IRF of Serial Peripheral Interface Master Core Using Universal Verification
Int. Conf., 2016 Methodology” International Journal of Computer Sciences and
[4] Aditya K, Sivakumar M, Noorbasha F and Thummalakunta P Engineering,2019.
B“Design and functional verification of a SPI master slave core using [25] Vineeth B, Dr. B. Bala Tripura Sundari,” UVM Based Testbench
system Verilog” Int. Journal of Computational Engineering Research, Architecture for Coverage Driven Functional Verification of SPI
2018. Protocol” 2018, IEEE Xplore.
[5] Roopesh P D, Siddesha P K and Kavitha Narayan B M”RTL design [26] Lakhan Shiva Kamireddy_, Lakhan Saiteja K,” UVM Based Reusable
and verification of spi master-slave using UVM” Int. Journal of Verification IP for Wishbone Compliant SPI Master Core”
Advanced Research in Electronics and Communication Engineering, arXiv:1809.10845v1 [cs.OH] ,Sep 2018.
2015. [27] Robert Nawrath1 and Robert Czerwinski,” FPGA-based
[6] Mahesh G and Sakthivel S M ”Verification of memory transactions in Implementation of APB/SPI Bridge” International Conference of
axi protocol using system verilog approach” Proc. Of Int. conf. on Computational Methods in Sciences and Engineering 2018
Communication and Signal Processing, 2015,0860- 0864 [28] P. Rajashekar Reddy, P.Sreekanth, K.Arun Kumar,” Serial Peripheral
[7] Li Ping, Wu Xiao, Shan Shou, “Multiple Configuration of FPGA Interface-Master Universal Verification Component using UVM”
Based on SPI FLASH,” Modern Electronic Technology, 36(22): 127- International Journal of Advanced Scientific Technologies in
130, 2013. Engineering and Management Sciences · June 2017.
[8] Rajesh Thumma, Pilli Prashanth “Design and verification of daisy [29] Nidhi Gopal,” SPI Controller Core: Verification” SSRG International
chain serial peripheral interface using system Verilog and universal Journal of VLSI & Signal Processing (SSRG-IJVSP) – volume 2 Issue
verification methodology” TELKOMNIKA Telecommunication 3 Sep to Dec 2015
Computing Electronics and Control Vol. 21, No. 1, pp. 168~177, [30] K. V. Ashok Kumar, M. Santosh Krishna,” Design and Functional
February 2023. Verification of A SPI Master Slave Core using UVM” International
[9] CHETAN N*, R KRISHNA,” Verification of SPI protocol Single Journal of Scientific Engineering and Technology Research
Master Multiple Slaves using System verilog and Universal Volume.04, IssueNo.51, December-2015, Pages: 11023-11030
Verification Methodology (UVM)” International Journal of
Engineering Research and Applications, ISSN: 2248-9622, Vol. 11,
Issue 7, (Series-VI) July 2021, pp. 01-08
[10] Bitty Jose, J Samson Immanuel,”Design of BIST(Built-In-Self-Test)
Embedded Master-Slave communication using SPI Protocol” 3rd
International Conference on Signal Processing and Communication,
2021.
[11] Dawei Wang, Jiang Yan and Ying Qiao,” Design and verification of
SPI bus IP core” Journal of Physics: Conference Series, 2021.
[12] Padmaprabha Jain, Sateesh Rao,” Design and Verification of Advanced
Microcontroller Bus Architecture-Advanced Peripheral Bus (AMBA-
APB) Protocol” Proceedings of the Third International Conference on
Intelligent Communication Technologies and Virtual Mobile Networks
(ICICV 2021). IEEE Xplore Part Number: CFP21ONG-ART; 978-0-
7381-1183-4.
[13] Muhammad Hafeez Sabparie, Emillia Noorsal, Suhana Sulaiman, and
Azilah Saparon”Design and Simulation of Serial Peripheral Interface
Core with APB Interfacing” Journal of Electrical and Electronic
Systems Research, Vol. 19 Oct 2021.
[14] Aman Kulkarni, S M Sakthivel,” UVM methodology based functional
Verification of SPI Protocol” 2020, Journal of Physics: Conference
Series1716 (2021) 012035
[15] Izhar Izzudin bin Jamaludin, Hasliza binti Hassan,” Design and
Analysis of Serial Peripheral Interface for Automotive Controller”
2020 IEEE Student Conference on Research and Development.
[16] Jiang Yang, Yile Xiao, Dejian Li, Zhenj Li, Zhijie Chen, Peiyuan
Wan,” A Configurable SPI Interface based on APB Bus”2020, IEEE
Xplore.
Authorized licensed use limited to: KLE Technological University. Downloaded on November 23,2023 at 13:12:43 UTC from IEEE Xplore. Restrictions apply.
315