Design and verification of daisy chain serial peripheral interface using system Verilog and universal verification methodology

id


INTRODUCTION
System on chip (SoC) architecture requires different components to develop an application.For the communication and operation between these components, Interfaces are utilized.The communication speed of the SoC depends on the types of interfaces.The speed rate of the serial peripheral interface (SPI) interface is 1.1 Mbps.The interfaces are classified into two types, based on the data transmission.They are a serial interface and a parallel interface.
According to the SoC component's protocols, serial or parallel communication interfaces are used [1]- [17].The motorola semiconductors are the first developers of SPI.The SPI and inter-integrated circuit (I2C) protocols are used [2] to transfer the data in sequential communication.These two protocols are appropriate for interchanges between coordinated circuits and with onboard peripherals.The inter-integrated circuit (I2C) transport utilizes two signals, a sequential clock signal (SCL) and a sequential information signal SDA, to move information among numerous devices.When contrasted with I2C, SPI utilizes four signals to move among various devices [3]- [25].For intra chip communication, SPI is usually used.Both the master and slave perform the dual role of transmitter and receiver in the SPI.The SPI master slave is designed from the initial specifications to final system verification by using Verilog hardware description language (HDL) and achieved 71 to 75 megabytes second by implementing in Virtex-5 field programmable gate array (FPGA) [4]- [24].Various SPI design techniques are proposed and compared [5] their implementation with respect to chip selects lines.


Design and verification of daisy chain serial peripheral interface using … (Rajesh Thumma) 169 However, the number of chip-select lines are increased in the SPI conventional method, while in the daisy chain technique, the number of chip-select lines is reduced in implementation and easy to design [5]- [21].The master-slave communication protocol is designed by assigning the priority to each slave by communicating with the master based on the highest priority slave [6]- [23].However, the design will consume less power and utilization sources compared with the other complex design.The high-speed SPI [7] bus is designed in vertex5 to control and handle two slaves at a time and compared with the existing architectures.However, accessing multiple devices using a master-slave will be overcome by applying the standard Serial peripheral interface [8] and single/master communication protocol.The SPI has been designed with five 32-bit registers using a compatible wishbone interface [9], [10] for serial synchronous communication.In this, 100% of functional code coverage achieved with up to 64-bits of full-duplex communication is verified.The interfacing and monitoring of battery-operated electric vehicles [11], [12] is designed using complementary metal-oxide-semiconductor (CMOS) to transfer the data rate upto 1 Mbps.System Verilog is the most promising language to reduce the system-on-a-chip (SOC) verification and reusable components of the complex SOC design.using system Verilog [21], various components are designed, implemented with object-oriented programming [13], [14] and applied a random technique to find functional coverage.However, universal verification methodology [15], [17], [18] will reduce the complexity, time, and rewriting code by accessing the inbuilt classes.Using universal verification methodology (UVM), the SPI master-slave is designed and verified the 100% functional coverage and code coverage [19], [20].
The SPI is the most used in various interfacing circuits like analog to digital converters (ADCs), static random access memory (SRAM), sensors, digital to analog converters (DACs), shift registers and others.SPI is a master, slave-based synchronous, full-duplex interface [5]- [17].The data is synchronized from the master or slave at the falling or rising edge of the clock [22].Both slave and master can send information (data) simultaneously.This article proposes a daisy chain technique to design an SPI Master-slave interface using Verilog and verified with system Verilog and UVM.The simulation verification is performed in a model sim and QuestaSim.The simulation results are obtained in Xilinx Vivado, and both the verification methods covered 100% of functional coverage, code coverage.In section 2 covers basic information of the SPI theory, dasiy chain method and operation.Section 3 covers designing a daisy chain SPI using Verilog and is verified in system Verilog and UVM.Section 4 covers the simulation results of the proposed design Xilinx and QuestaSim.

SERIAL PERIPHERAL INTERFACE
SPI the data transfer between the master and slave devices are depends on the control signals and data signals of the serial peripheral interface.There are two types of control signals, namely slave select (SS) or chip select (CS), a clock signal (SCLK).The master output slave input (MOSI), master input slave output (MISO) are two data signals.When the chip select line is active low its selects, the respected slave and the data will read or write based on the clock polarity (CPOL) and clock phase (CPHA).The clock signal reads the data addresses the clock pulses and writes when the chip select signal is high.The data is transferred from master to slave and slave to the master through MOSI and MISO signals.There are four modes to transfer the data with clock polarity and clock phase.Table 1 represents the SPI Modes with clock polarity.
Daisy chain SPI based on the number of slaves, the serial peripheral interface is classified into a single master-single slave, single master-multiple slaves.In single master-single slave, the communication is in between master and slave only.By using single master-single slave, the area will increase by increasing the master-slaves, and the design will be complex, making the increase in cost and the area.So, the single master-single slave is not preferable, and single master-multiple slaves are used in most of cases.The single master-multiple slaves are further classified into regular SPI method and daisy chain method.In regular SPI mode, the number of chip-select lines is increased if the number of slaves increases.Figure 1 shows the regular SPI mode of operation.Due to this, the input data received by the master from the slaves are corrupted at MISO.Because of this daisy chain method is most preferable to overcome this problem.The daisy chain method requires only one chip select line at master compared to the regular SPI mode.When the chip-select line is active low, all the slaves are active, and the clock is initiated to all the slaves to transfer the data from the master to the first slave through the MOSI.
The first slave's output is shared with a second slave, the second slave with the third, and the last slave output is shared with the master; this forms a daisy chain configuration.The primary serial peripheral interface with a single master multiple slave configuration shows in Figure 1.The proposed daisy chain SPI configuration shows in Figure 2.

VERIFICATION
The daisy chain SPI is designed with Verilog and verified using the system Verilog and universal verification methodology.The flow chart of the verification methodology is shown in Figure 3.The Verilog code is compiled and finds the zero errors which create the elaborated design.After simulation of the design, the following are observed by taking the register-transfer level (RTL) analysis: RTL schematic, physical design, elaborated design, and power report.To implement in FPGA, the constraint files are written for generating a bitstream and dumped in the FPGA board.

System Verilog
The daisy chain verification environment is implemented with the system Verilog components.The input and outputs are instantiated in class_packet.The class_packet is included in the generator and initiated naming as packet 1.A mailbox is used between the generator and the driver to transfer the generator's data to the driver.The generator is included in the driver, and a virtual interface is provided to access the inputs from the interface in a test.A mailbox driver can transfer the data between the driver to the scoreboard and the receiver to the scoreboard.


Design and verification of daisy chain serial peripheral interface using … (Rajesh Thumma) 171 The data received from the driver and receiver will compare on the scoreboard and send to display.The class_driver is added in the receiver; design under test (DUT) output values are added to packet 2 using a virtual interface.The packet 1 data from the driver to the scoreboard and the packet 2 data from the receiver to the scoreboard are compared and included in the coverage.Different random values are added to the inputs using coverage groups, and coverage is added to the environment.
The functions of generator, driver, receiver, scoreboard and coverage are instantiated in the environment.The environment is included in the test to perform the test for the environment.A daisy-chain SPI DUT is developed with a single master and two slaves.A detailed code operation is written for master, slave 1, slave 2 and included in the DUT.Input and outputs are instantiated in the interface to access virtually.The test, DUT and Interfaces are included in the top block.The top block generates the clock, reset, start signals.The system Verilog verification environment is shown in Figure 4.

Universal verification methodology
A rich set of standard rules and guidelines systematically doing the things is called methodology.It provides the necessary infrastructure to build a robust, reliable and complex verification environment.It contains a base class library set, which we can use to build our test benches.A methodology should support coverage driven verification (CDV), transaction based verification (TBV), assertion based verification (ABV), constrained random testing (CRT).There are various verification methodologies, advanced verification methodology (AVM) developed by mentor graphics using system C and system Verilog.Reference verification methodology (RVM) is developed by synopsys using open vera.Open verification methodology (OVM) developed by mentor graphics using system Verilog.Verification methodology manual (VMM) by synopsys using system Verilog.
A technical subcommittee of accellera voted to establish the UVM and decided to build this new standard using the open verification methodology as its foundation.UVM is derived mainly from the OVM.Advantages of UVM are Common test bench structure and run flow.Reusability through test bench, Time required to build test bench is very less.It avoids poor coding practices, and Debugging is simple.The complete UVM verification environment is shown in Figure 5.
To understand the UVM, it is required to understand the verification environment of system Verilog.The architectures of system Verilog and UVM are similar, but generators are replaced with sequencers and agents are introduced in UVM.At this moment, a design under test (DUT) is used.To test the functionality of the DUT, an environment is required to connect the DUT.For this, a sequencer block is used to generate sequences of bits to transmit into the DUT.Generally, sequencers are responsible for generating data sequences, and they pass the data to another block called a driver.Why because the sequencer is unaware of the communication bus.So, the sequencer transmits the data to the driver.Now, the driver starts communicating with the DUT and by feeding the received data from the sequencer.A monitor block is used to communicate between the driver and the DUT to evaluate the DUT's responses.Monitors try to predict the expected result by sampling the inputs and the outputs of the DUT.They send the prediction and result of the DUT to the block called the scoreboard.The predicted data are compared and evaluated in the scoreboard.A typical system is formed with all these blocks to perform the verification.The UVM test benches use the same structure [13].Figure 5 represents the verification environment of the UVM.A test block is used generally to control all the blocks of the UVM.The Top block controls all the blocks and sub-blocks of the test bench.This implies that just by changing a couple of code lines, it is possible to add, eliminate and abrogate blocks in the test bench and construct various conditions without reworking the entire test.To delineate the benefit of this verification, need to add a monitor and a driver to the Verification, the environment changes to the I2C from the serial communication SPI and vice versa.
The serial peripheral interface is widely used due to its advantages.In single master-single slave SPI communication, there is no difficulty at master input slave output (MISO) to transfer the data compared to the single master-multiple slave SPI.To solve the above-mentioned problem, different design techniques are proposed by the different authors.They are interrupt enabled priority-based SPI, parameterization method using time-sharing multiples technique, high-speed SPI and wishbone compliant SPI.Table 2 represents the comparison of design techniques and their design or verification languages.Table 2 compares various SPI design techniques designed using the Verilog, system Verilog (SV), and UVM.All the SPI design techniques are designed with the Verilog, but few of them are designed with advanced verification methodologies like SV and UVM.SPI master interface using system Verilog [13], SPI master-slave core [9] are verified using SV and SPI master-slave core using UVM [3] is verified in UVM achieves the 100% code coverage.The proposed daisy-chain SPI is designed using Verilog HDL, and a verification environment is implemented using SV and UVM to achieve 100% code coverage.

SIMULATION AND RESULTS
The daisy chain Serial Peripheral interface is designed and verified using various VLSI tools like Xilinx Vivado 2015.2,ModelSim, Xilinx integrated synthesis environment (ISE), QuestaSim.Single master-two slaves are configured in the daisy-chain.The following three inputs are applied in this design; they are  = 10110110, 1 = 11001101, 2 = 10010011 are given to the , 1, 2, respectively.The clock, reset, start and chip select lines control the proposed project's entire design.The output ports are instantiated as , 1 and 2 ports and these ports are used to transfer the data between the master and slaves shift registers.A Verilog code is written and compiled in Xilinx Vivado 2015.2, and a detailed RTL code, test_bench, are designed with Verilog HDL.By successfully running the behavioural simulation with 0 errors and 0 warnings, the following simulation results are shown in Figure 6.
The data outputs  = 1, 1 = 2, and 2 =  define that the data flow is transferred in a daisy-chain fashion.The complete schematic diagram of daisy-chain SPI is obtained by applying an elaborated design is shown in Figure 7, and Figure 8 shows the elaborated circuit design cells.After adding the constraints to the xdc file, the design is synthesized.The synthesized device, synthesized schematic of top-level and circuit level are shown in Figure 9, Figure 10 and Figure 11.After generating the bitstream, it is dumped into the FPGA board to verify the functionality.
The design is verified in the verification environment using the system Verilog by using QuestaSim 10.0b tool.The inputs from the driver _: 1, __1: 10, __2: 11, and outputs from the receiver : 11, 1: 1, 2: 10 are compared at scoreboard.After comparison of the data received from the driver and receiver in scoreboard has matched.The daisy chain SPI simulation results of the system Verilog is shown in Figure 12.Coverage groups are developed for inputs _, __1, __2 with random values, and a 100% functional coverage report is achieved.Figure 13 represents the coverage report of system Verilog using QuestaSim 10.0b.The design is verified in universal verification methodology by developing a verification environment.
In this, the inputs from monitor 1, outputs from monitor two are compared at the scoreboard.Here the inputs are consider as _ = 182, __1 = 138, __2 = 7, the outputs from the monitor 2 are  = 7, 1 = 182, 2 = 138 are matched at the scoreboard according to the daisy-chain method.Figure 14 represents the simulation and summary report of the UVM using QuestaSim 10.0b.
The covearge A, coverage B, coverage C are developed for the inputs with random values and achieved a 100% functional coverage and code coverage.Figure 15 represents the coverage report of the UVM.The functional and code coveage reports are execucted using QuestaSim.

CONCLUSION
In this paper, the daisy-chain SPI is designed using Verilog.The developed design is verified using SV and UVM.The open-source design suite tool, ModelSim personal edition, was used to write the Verilog code, which gives the simulation results.The verification environment of the SV and UVM is developed using the QuestaSim tool.ModelSim and QuestaSim are Mentor Graphics products, which are used to implement the necessary functional registers.Universal verification methodology verifies the design in the most effective way.The daisy chain SPI functionality, operation, depiction of registers, pin and signals are discussed.Functional verification contains the verification platform's description using system Verilog for the design under the daisy-chain SPI test.The created verification environment validates the functionality and operation of configurable daisy-chain SPI.The verification environment developed for daisy-chain SPI protocol was reusable and using which design can be verified successfully.by using this verification environment, we can achieve 100% functional and assertion coverage.The designed daisy chain SPI from Verilog is implemented in FPGA.

Table 1 .
SPI modes with CPOL and CPHA On the rising edge, data was sampled, and on the falling edge, it was shifted out  ISSN: 1693-6930

Table 2 .
Comparison of various SPI design techniques