Design and Verification of Serial Peripheral Interface 1 Ananthula Srinivas, 2 M.Kiran Kumar, 3 Jugal Kishore Bhandari

Similar documents
Design Development and Implementation of SPI

FPGA Implementation Of SPI To I2C Bridge

ISSN Vol.03,Issue.29 October-2014, Pages:

HCTL Open Int. J. of Technology Innovations and Research HCTL Open IJTIR, Volume 4, July 2013 e-issn: ISBN (Print):

International Journal of Advance Engineering and Research Development DESIGN AND IMPLEMENTATION OF SPI PROTOCOL

High Speed SPI Slave Implementation in FPGA using Verilog HDL

DEVELOPMENT AND VERIFICATION OF AHB2APB BRIDGE PROTOCOL USING UVM TECHNIQUE

DESIGN AND VERIFICATION OF LOW SPEED PERIPHERAL SUBSYSTEM SUPPORTING PROTOCOLS LIKE SPI, I 2 C AND UART

Understanding SPI with Precision Data Converters

Design and Verification of Network Router

FPGA Implementation of I2C and SPI Protocols using VHDL

DESIGN AND VERIFICATION ANALYSIS OF APB3 PROTOCOL WITH COVERAGE

AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL

SystemVerilog Verification of Wishbone- Compliant Serial Peripheral Interface

An Efficient Designing of I2C Bus Controller Using Verilog

< W3150A+ / W5100 Application Note for SPI >

RECONFIGURABLE SPI DRIVER FOR MIPS SOFT-CORE PROCESSOR USING FPGA

Embedded Systems and Software. Serial Interconnect Buses I 2 C (SMB) and SPI

PIC Serial Peripheral Interface (SPI) to Digital Pot

spi 1 Fri Oct 13 13:04:

THE INTERNATIONAL JOURNAL OF SCIENCE & TECHNOLEDGE

VERIFICATION OF AMBA AXI BUS PROTOCOL IMPLEMENTING INCR AND WRAP BURST USING SYSTEM VERILOG

Keywords: Soft Core Processor, Arithmetic and Logical Unit, Back End Implementation and Front End Implementation.

Parallel Data Transfer. Suppose you need to transfer data from one HCS12 to another. How can you do this?

VERIFICATION OF AHB PROTOCOL USING SYSTEM VERILOG ASSERTIONS

Raspberry Pi - I/O Interfaces

EE 456 Fall, Table 1 SPI bus signals. Figure 1 SPI Bus exchange of information between a master and a slave.

Serial Peripheral Interface. What is it? Basic SPI. Capabilities. Protocol. Pros and Cons. Uses

Functional Verification of xhci (extensible host controller Interface) for USB 3.1 Using HDL

VERIFICATION ANALYSIS OF AHB-LITE PROTOCOL WITH COVERAGE

SPI Block User Guide V02.07

International Journal of Applied Sciences, Engineering and Management ISSN , Vol. 05, No. 02, March 2016, pp

Serial Communication. Spring, 2018 Prof. Jungkeun Park

UVM BASED REUSABLE VERIFICATION IP FOR WISHBONE COMPLIANT SPI MASTER CORE

App Note Application Note: Addressing Multiple FPAAs Using a SPI Interface

Prototyping of On-chip I2C Module for FPGA Spartan 3A series using Verilog

UART TO SPI SPECIFICATION

Design and Coverage Driven Verification of AXI2OCP Bridge for Industrial SoC Designs

Serial Peripheral Interface (SPI)

Microcontrollers and Interfacing

Amarjeet Singh. January 30, 2012

i_csn i_wr i_rd i_cpol i_cpha i_lsb_first i_data [15:0] o_data [15:0] o_tx_ready o_rx_ready o_rx_error o_tx_error o_tx_ack o_tx_no_ack

ISSN Vol.05, Issue.12, December-2017, Pages:

DESIGNING OF INTER INTEGRATED CIRCUIT USING VERILOG

SPI Overview and Operation

DQSPI IP Core. Serial Peripheral Interface Master/Slave with single, dual and quad SPI Bus support v. 2.01

Universität Dortmund. IO and Peripheral Interfaces

Verification of I2C module for Multiprotocol Serial Controller

UVM BASED TEST BENCH TO VERIFY AMBA AXI4 SLAVE PROTOCOL

System-Level Verification Platform using SystemVerilog Layered Testbench & SystemC OOP

COVERAGE DRIVEN VERIFICATION OF I2C PROTOCOL USING SYSTEM VERILOG

ISSN Vol.03, Issue.02, March-2015, Pages:

IMPLEMENTATION OF LOW POWER INTERFACE FOR VERIFICATION IP (VIP) OF AXI4 PROTOCOL

CprE 488 Embedded Systems Design. Lecture 4 Interfacing Technologies

Design and Verification of Slave Block in Ethernet Management Interface using UVM

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -4 1 UNIT 4

Assertion Based Verification of AMBA-AHB Using System Verilog

Introduction the Serial Communications Parallel Communications Parallel Communications with Handshaking Serial Communications

SPI 3-Wire Master (VHDL)

Serial Peripheral Interface Design for Advanced Microcontroller Bus Architecture Based System-on- Chip

VERIFICATION OF DRIVER LOGIC USING AMBA- AXI UVM

Universal Asynchronous Receiver/Transmitter Core

Design And Implementation Of USART IP Soft Core Based On DMA Mode

Optimal Implementation Of UART_SPI Controller and Slave Interface With Master.

AXI4-Stream Verification IP v1.0

or between microcontrollers)

LAB4. Program the on chip SPI module

Block Diagram. mast_sel. mast_inst. mast_data. mast_val mast_rdy. clk. slv_sel. slv_inst. slv_data. slv_val slv_rdy. rfifo_depth_log2.

DESIGN OF WISHBONE INTERFACED I2CMASTER CORE CONTROLLER USING VERILOG

VERIFICATION OF AXIPROTOCOL SYSTEM VERILOG

INDUSTRIAL TRAINING: 6 MONTHS PROGRAM TEVATRON TECHNOLOGIES PVT LTD

Lecture 14 Serial Peripheral Interface

6 Month Certificate Program in VLSI Design & Verification" with Industry Level Projects. Tevatron Technologies Prívate Limited

Design and Simulation of UART for Serial Communication

Controller IP for a Low Cost FPGA Based USB Device Core

UNIVERSAL VERIFICATION METHODOLOGY BASED VERIFICATION ENVIRONMENT FOR PCIE DATA LINK LAYER

FPGA Based Digital Design Using Verilog HDL

DESIGN AND IMPLEMENTATION OF I2C SINGLE MASTER ON FPGA USING VERILOG

FPGA-BASED DATA ACQUISITION SYSTEM WITH RS 232 INTERFACE

DESIGN A APPLICATION OF NETWORK-ON-CHIP USING 8-PORT ROUTER

UART IP CORE VERIFICATION BY USING UVM

McMaster University Embedded Systems. Computer Engineering 4DS4 Lecture 6 Serial Peripherals Amin Vali Feb. 2016

SPI (Serial & Peripheral Interface)

Design of AMBA Based AHB2APB Bridge

Serial Peripheral Interface (SPI)

A Novel Architecture of Parallel Multiplier Using Modified Booth s Recoding Unit and Adder for Signed and Unsigned Numbers

The 9S12 Serial Peripheral Inteface (SPI) Huang Section 10.2 through 10.6 SPI Block User Guide

System Verification of Hardware Optimization Based on Edge Detection

Design of Dual Port SDRAM Controller with Time Slot Register

Section 5 SERCOM. Tasks SPI. In this section you will learn:

Each I2C master has 8-deep transmit and receive FIFOs for efficient data handling. SPI to Dual I2C Masters. Registers

OUTLINE. SPI Theory SPI Implementation STM32F0 SPI Resources System Overview Registers SPI Application Initialization Interface Examples

Design and Implementation of Hamming Code on FPGA using Verilog

Real Time Embedded Systems. Lecture 1 January 17, 2012

UVM for VHDL. Fast-track Verilog for VHDL Users. Cont.

Getting Started with ESPI Interface Using the Z8 Encore! XP F1680

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

Growing Together Globally Serial Communication Design In Embedded System

Sampling and Reconstruction of Ordered Sets in PCIe 3.0

Introducing SPI Xpress SPI protocol Master / Analyser on USB

Transcription:

Design and Verification of Serial Peripheral Interface ISSN: 2321-9939 Design and Verification of Serial Peripheral Interface 1 Ananthula Srinivas, 2 M.Kiran Kumar, 3 Jugal Kishore Bhandari 1,3 MTech Student, 2 Assistant Professor Anurag group of Institutions, Department of Electronics & Communication Engineering, JNTU, Hyderabad, AP, INDIA 1 srinivasananthula9@gmail.com, 2 kirankumarece@cvsr.ac.in, 3 bhandari.jugal@gmail.com Abstarct - Today, at the low end of the Communication Protocols there are mainly Two Protocols: Inter- Integrated circuit (I2C) and the Serial Peripheral Interface (SPI) Protocols. Both the protocols are well suited for communications between Integrated Circuits for communication with ON-Board Peripherals. SPI is one of the most commonly used serial protocols for both inter-chip and intra-chip low/medium speed data-stream transfer. In conformity with design-reuse methodology, this paper introduces high-quality SPI IP with one Master One Slave configuration with that of 8-bit data transfer which incorporates all necessary features required by modern ASIC/SoC applications. The Designed SPI is used for communication between different peripherals with that of a processor in a SoC application. The Designed SPI is Implemented and also Verified using a System Verilog in order to show its code coverage and functional correctness. The whole RTL design code is written in Verilog for synthesis and its Verification code is written in System Verilog, IEEE (2005). Keywords - Serial Peripheral Interface (SPI), System Verilog, System- on- Chip (SoC), Intellectual Property (IP). I. INTRODUCTION There are many communication protocols for both short and long distance communication purpose such as ETHERNET, USB,SATA,PCI-EXPRESS are used for long distance and I2C and SPI are used for short distance communications. SPI is a serial interface protocol, compared to other protocols, it has high transmission speed, simple to use and little pins advantages [1]. The four interfaces are required by standard SPI protocol at least. Usually, the devices which based on SPI protocol are divided into master device and slave-device for transmitting the data. The chip select signal and clock signal have be generated by the master-device when the data exchange has been processed.spi is often considered as the little communication protocol which is used for ON-Board communication [2]. Although the literature on SPI protocol is so extensive and the topic is so old (early 1980), to the best of the authors knowledge there is no comprehensive analysis of SPI problem. By comprehensive analysis, we mean a treatment that start from Motorola s V03.06 SPI bus specifications and goes down to the actual ASIC/FPGA implementation, discussing all relevant architectural aspects and providing all design details. In our attempt to implement universal SPI IP cores according to the designreuse methodology [3], we first made a market study of an important number of recent commercial SPI devices (datasheets) from different vendors to look at the requirements and what features are to be included to satisfy modern ASIC/SoC applications. II. SPI PROTOCOL Standard SPI is a high-speed, full-duplex, synchronous communication bus [4]. For saving the chip ports and space on PCB layout, the ports of the SPI only take four lines. It is working in the Master-Slave full duplex mode which has one master device and one slave device and requires four lines whose components are SDI (data in), SDO (data out), SCK (clock), SS (Slave select).when the SPI master wants to send data to a slave, it will pull the SS line low for selecting slave, and activates the clock signal which usable between the master and the slave at same time. The master transmits the data to the MOSI (master s SDO and slave s SDI) line and receives the data from the MISO (master s SDI and slave s SDO) line at the time. SPI is a serial communication protocol, that data is transmitted bit by bit. The clock pulse is provided by SCK and SDI, SDO is based on this pulse to making the data transmission. Data output through the master s SDO line at the rising or falling edge of the clock, and be read by slave in the falling or rising edge followed. So 8-bit data transfer need at least 8 times the clock signal changes [3]. Fig 1 SPI with Single Master and Single Slave SPI Signal Descriptions:Master In Slave Out (MISO) The MISO line is configured as an input in a master device and as an output in a slave device. It is one of the two lines that transfer serial data in one direction, along with the most significant bit sent first. The MISO line of a slave device is placed in the high-impedance state if the slave is not selected. 130

Table 1 SPI Interface Signals SPI Interface Signals PICname Master Slave SCK Serial clock output from master [SCK] Input to Slave[SCK] SDO Serial data output from master[mosi] Input to slave[mosi] SDI Serial data input from slave [MISO] Output from slave[miso] SS Optional slave (chip) select [SS] Slave select [SS] Master Out Slave In (MOSI) The MOSI line is configured as output in a master device and as an input in a slave device. It is one of the two lines that transfer serial data in one direction, with the most significant bit sent first. Serial Clock (SCK) The serial clock is used to synchronize data movement both in and out of the device through its MOSI and MISO lines. The Master and Slave devices are capable of exchanging a byte of information during a sequence of eight clock cycles. Since SCK is generated by the master device, this line becomes an input on a slave device. Slave Select (SS_bar) The slave select input line is used to select a slave device. It has to be low prior to data transactions and must stay low for the duration of the transaction. III. SPI DATA TRANSMISSION The SPI has four modes of operation, 0 through 3. These modes essentially control the way data is clocked in or out of an SPI device. The configuration is done by two bits in the SPI control register (SPCR). The clock polarity is specified by the CPOL control bit, which selects an active high or active low clock. The clock phase (CPHA) control bit selects one of the two fundamentally different transfer formats. To ensure a proper communication between master and slave both devices have to run in the same mode. This can require a reconfiguration of the Table 2 SPI Modes SPI MODE CPOL CPHA SHIFT SCK EDGE CAPTURE SCK EDGE 0 0 0 Falling Raising 1 0 1 Raising Falling 2 1 0 Raising Falling 3 1 1 Falling Raising master to match the requirements of different peripheral slaves. SPI is a Synchronous data transmission, Clock plays important role in this Communication. For describing the clock information we have two flags called CPOL and CPHA in SPI Control Register. The CPOL clock polarity control bit specifies an active high or low clock. The CPHA clock phase control bit selects one of two different transmission formats. CPOL-SPI Clock Polarity Bit To transmit data between SPI modules, the SPI modules must have identical CPOL values. In master mode, a change of this bit will abort a transmission in progress and force the SPI system into idle state. 1 = Active-low clocks selected. In idle state SCK is high. 0 = Active-high clocks selected. In idle state SCK is low. CPHA- SPI Clock Phase Bit This bit is used to select the SPI clock format. In master mode, a change of this bit will abort a transmission in progress and force the SPI system into idle state. 1 = Sampling of data occurs at even edges (2, 4, 6) of the SCK clock. 0 = Sampling of data occurs at odd edges (1, 3, 5) of the SCK clock. Figure2: SPI Data Transmission of 8-bit from Master to slave The communication is initiated by the master all the time. The master first configures the clock, using a frequency, which is less 131

than or equal to the maximum frequency that the slave device supports. The master then selects the desired slave for communication by pulling the chip select (SS) line of that particular slave-peripheral to low state. Data transfer is organized by using Shift register with some given word size such as 8- bits in both master and slave. They are connected in a ring. While master shifts register value out through MOSI line, the slave shifts data in to its shift register and sends data to master from slave by MISO line [6]. Figure3: The timing diagram of the four different data transfer formats IV. VERIFICATION ENVIRONMENT The Verification Plan is based on System Verilog Hardware Verification Language. The methodology used for Verification is Constraint random coverage driven verification. The Verification Plan is the focal point for defining exactly what needs to be tested and it is used to determine the progress and completion of the verification phase of verification. It will functionally verify the design with all possible corner cases. Verification plan contains the structure of the verification environment. Based on the project requirements, following points are considered while architecture is built. Reusability, Is it a verification IP. What blocks the verification language can support. Controllability of the stimulus generation etc. Next phase is to build the Verification environment. Final phase is to verify the DUT using the environment built. Throughout these evolutionary steps, the approach to verification has not fundamentally changed. Individual design features are verified using individual test cases crafted to exercise the targeted feature. Figure 4: Verification Environment A Generator creates a transaction, randomizes it, and puts it in the mailbox to the driver. Driver is class which generates the packets and then drives it to the DUT input interface and pushes the packet in to mailbox. Receiver collects the data bytes from the interface signal. And then unpacks the bytes in to packet and pushes it into mailbox. Scoreboard has 2 mailboxes. One is used to for getting the packets from the driver and other from the receiver. Then the packets are compared and if they don't match, then error is asserted. 132

Functional coverage of design features have been exercised by the tests. The process of measuring and using functional coverage consists several steps. First, add code to the testbench to monitor the stimulus going into device, and its reaction and response, to determine what functionality has been exercised and after running simulation, analyze the coverage results and find out if some test Scenarios have not been exercised and write tests to exercise them. V. IMPLEMENTATION AND SIMULATION RESULTS The whole design code, either for synthesis or functional verification, is implemented in Verilog 2001 (IEEE 1365). The synthesis design code is technology independent and was simulated at both RTL and gate level (post place & route netlist) with timing back annotation using Questasim 6.2 and mapped onto Xilinx Vertex 5 FPGA using Foundation Xilinx Vivado tool. Simulation Results: Figure 5: RTL Schematic of Top module showing blocks of individual master and slave. Figure 6: Overall Output waveform showing Full Duplex operation of the top module. As that of the data transmission formats of the SPI protocol we have generated the outputs showing that it works in a full duplex operation. That is the Master s 8-bit data is going to be stored in the fifo_read_final _slave signal after 8 clock pulses and at the same time the 8-bit data present in the slave is transferred to the fifo_read_final_master signal. We have also shown the individual MOSI and MISO outputs of the master and slave Modules. The below shown figures are the individual mode output of the SPI with that of different 8-bit data for each mode. Figure 7: Output of SPI Mode - 1. Figure 8: Output of SPI Mode 2. 133

Figure10: Output of SPI Mode 4 Figure 9: Output of SPI Mode 3 Flow Chart of the Design Verification Results: By Using SystemVerilog we have written the code for the verification environment and the following code coverage report. 134

Fig 11: A SOC where the Designed SPI is used. Questa Coverage Report Parameter Coverage Report The main Advantage of going for SystemVerilog Verification is that of its Reusability and advanced features of OOPS concepts and constrained Randomization makes it easy to understand and make sure that the there is much coverage of code for the much more number of test cases. Code Coverage Report Functional Coverage Report VI. CONCLUSION The Design of Serial Peripheral Interface(SPI) with Single Master and Single Slave configuration has been done Successfully showing that it operates in Full Duplex Mode and also verified the Designed SPI using System Verilog using constrained Random methodology with that of 100 percentage of Code Coverage report and with all the functional coverage. Thus, Designed SPI Protocol is used in Real Time application of a SoC(System on chip) in order to communicate with the PPC 440 Processor and other peripherals which is applicable for present day Avionics Systems in Defense. 135

REFERENCES [1] S.Sarns and J. Woehr, Exploring I2C, Embedded Systems Programming, vol. 4, p. 46, Sept. 1991. [2] F.Leens, An Introduction to I2C and SPI Protocols, IEEE Instrumentation & Measurement Magazine, pp. 8-13, February 2009. [3] Freescale Semiconductor, (2008, October 14). Freescale SPI Block Guide V04.01 July. [4] L.Bacciarelli et al, Design, Testing and Prototyping of a Software Programmable I2C/SPI IP on AMBA Bus, Conference on Ph.D. Research in Microelectronics and Electronics (PRIME'2006), pp. 373-376, ISBN: 1-4244-0157-7, Ortanto, Italy, June 2006. [5] A.K. Oudjida et al, FPGA Implementation of I2C and SPI Protocols: A Comparative Study. Proceedings of the 16th edition of the IEEE International Conference on Electronics Circuits and Systems ICECS, pp. 507-510, ISBN: 978-1-4244-5091-6, December 13-16 2009, Yasmine Hammamet, Tunisia. [6] IP Design of Universal Multiple Devices SPI Interface Tianxiang Liu1, Yunfeng Wang1 * Department of Electronic Engineering, Xiamen University,2011 IEEE. [7] Chris Spears SYSTEMVERILOG FOR VERIFICATION, Publisher: Springer. [8] Bhaskar. J, A Verilog HDL Primer, Publisher: Syndicate Publications. AUTHORS PROFILES Mr.ANANTHULA SRINIVAS, Pursuing M.TECH (VLSI System Design) from CVSR College of Engineering, Ghatkesar, Hyderabad, A.P. Completed B.Tech in Electronics and Communication Engineering from CMR Institute of Technology, JNTUH. Mr. M KIRAN KUMAR, Assistant Professor from Anurag Group of Institutions also Worked as a Project Engineer at RCI Lab, DRDO for One Year. M.Tech from ASR College of Engineering, JNTUK Kakinada. Jugal Kishore Bhandari received the B.E. degree in Electronics & communication engineering from Anna University, Chennai, India, in 2007 and pursuing Masters of Engineering at Anurag Group of Institutions Formerly known Cvsr College of engineering Ghatkesar hyd, where he is engaged in designing of methods for the analysis of electrocardiogram signals. 136