AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL

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

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

SPI Block User Guide V02.07

Module 3.C. Serial Peripheral Interface (SPI) Tim Rogers 2017

More on the 9S12 SPI Using the Dallas Semiconductor DS1302 Real Time Clock with the 9S12 SPI

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

EE 308 Spring Using the 9S12 SPI

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

RTL DESIGN OF EFFICIENT MODIFIED RUN- LENGTH ENCODING ARCHITECTURES USING VERILOG HDL

Serial Peripheral Interface (SPI) Host Controller Data Sheet

FPGA Implementation Of SPI To I2C Bridge

spi 1 Fri Oct 13 13:04:

Design Development and Implementation of SPI

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

ECE 4510/5530 Microcontroller Applications Week 6

Serial Peripheral Interface (SPI)

THE INTERNATIONAL JOURNAL OF SCIENCE & TECHNOLEDGE

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

RECONFIGURABLE SPI DRIVER FOR MIPS SOFT-CORE PROCESSOR USING FPGA

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.

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

DESIGN AND IMPLEMENTATION OF I2C SINGLE MASTER ON FPGA USING VERILOG

High Speed SPI Slave Implementation in FPGA using Verilog HDL

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

Design with Microprocessors

a Serial Peripheral Interace (SPI). Embedded RISC Microcontroller Core Peripheral

Understanding SPI with Precision Data Converters

An SPI interface for the 65(C)02 family of microprocessors

Serial Peripheral Interface (SPI) Last updated 8/7/18

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

UART TO SPI SPECIFICATION

Serial Peripheral Interface (SPI)

Menu. What is SPI? EEL 3744 EEL 3744 SPI

Microcontrollers and Interfacing

ECE 4510 Introduction to Microprocessors. Chapter 10

Serial versus Parallel Data Transfers

Design and Simulation of UART for Serial Communication

VERIFICATION OF AXIPROTOCOL SYSTEM VERILOG

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

Serial Buses in Industrial and Automotive Applications

SPI 3-Wire Master (VHDL)

System Verification of Hardware Optimization Based on Edge Detection

Raspberry Pi - I/O Interfaces

Synchronous = SPI (3 options)

SPI: Serial Peripheral Interface

AT89S4D12. 8-Bit Microcontroller with 132K Bytes Flash Data Memory AT89S4D12. Features. Description. Pin Configurations

DESIGN OF WISHBONE INTERFACED I2CMASTER CORE CONTROLLER USING VERILOG

Lecture 14 Serial Peripheral Interface

CprE 488 Embedded Systems Design. Lecture 4 Interfacing Technologies

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

EE 308: Microcontrollers

From Datasheets to Digital Logic. synthesizing an FPGA SPI slave from the gates

Interfacing Techniques in Embedded Systems

Discontinued IP. Slices. LUTs. FFs. Block RAMs. Instantiation

Serial Communication. Spring, 2018 Prof. Jungkeun Park

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

Review for Exam 3. Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions

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

INTERNATIONAL JOURNAL OF ELECTRONICS AND COMMUNICATION ENGINEERING & TECHNOLOGY (IJECET)

Using the Z8051 MCU s USI Peripheral as an SPI Interface

16 BIT IMPLEMENTATION OF ASYNCHRONOUS TWOS COMPLEMENT ARRAY MULTIPLIER USING MODIFIED BAUGH-WOOLEY ALGORITHM AND ARCHITECTURE.

DESIGN AND IMPLEMENTATION OF ADDER ARCHITECTURES AND ANALYSIS OF PERFORMANCE METRICS

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

An Efficient Designing of I2C Bus Controller Using Verilog

Real Time Embedded Systems. Lecture 1 January 17, 2012

Growing Together Globally Serial Communication Design In Embedded System

Introduction to I2C & SPI. Chapter 22

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

PIC Serial Peripheral Interface (SPI) to Digital Pot

University, Patiala, Punjab, India 1 2

FPGA Implementation of A Pipelined MIPS Soft Core Processor

INTRODUCTION TO FPGA ARCHITECTURE

Amarjeet Singh. January 30, 2012

FPGA Implementation of I2C and SPI Protocols using VHDL

For reference only Refer to the latest documents for details

< W3150A+ / W5100 Application Note for SPI >

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features

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

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

1 Contents 2 2 Overview 3 3 Hardware Interface 4 4 Software Interface Register Map Interrupts 6 5 Revision History 8

Design of AMBA Based AHB2APB Bridge

Optimal Implementation Of UART_SPI Controller and Slave Interface With Master.

Documentation. Design File Formats. Constraints Files. Verification. Slices 1 IOB 2 GCLK BRAM

SystemVerilog Verification of Wishbone- Compliant Serial Peripheral Interface

ELEC 4200 Lab#10 Interrupting SPI Receiver for use with a Processor Core

Novel Design of Dual Core RISC Architecture Implementation

Synthesis of VHDL Code for FPGA Design Flow Using Xilinx PlanAhead Tool

Today. Comments about assignment Max 1/T (skew = 0) Max clock skew? Comments about assignment 3 ASICs and Programmable logic Others courses

UART Register Set. UART Master Controller. Tx FSM. Rx FSM XMIT FIFO RCVR. i_rx_clk o_intr. o_out1 o_txrdy_n. o_out2 o_rxdy_n i_cs0 i_cs1 i_ads_n

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

Addressing scheme to address a specific devices on a multi device bus Enable unaddressed devices to automatically ignore all frames

Lecture 25 March 23, 2012 Introduction to Serial Communications

Fig.1. Floating point number representation of single-precision (32-bit). Floating point number representation in double-precision (64-bit) format:

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

Introduction to Serial Communication. ECE/CS 5780/6780: Embedded System Design. A Serial Channel. Definitions. SCI versus SPI.

Asynchronous & Synchronous Serial Communications Interface. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

SHA3 Core Specification. Author: Homer Hsing

LogiCORE IP AXI Quad Serial Peripheral Interface (AXI Quad SPI) (v1.00a)

DataFlash. Application Note. Using Atmel s DataFlash. Introduction (AN-4)

Part 1 Using Serial EEPROMs

Transcription:

International Journal of Electronics and Communication Engineering & Technology (IJECET) Volume 7, Issue 3, May June 2016, pp. 38 45, Article ID: IJECET_07_03_005 Available online at http://www.iaeme.com/ijecet/issues.asp?jtype=ijecet&vtype=7&itype=3 Journal Impact Factor (2016): 8.2691 (Calculated by GISI) www.jifactor.com ISSN Print: 0976-6464 and ISSN Online: 0976-6472 IAEME Publication AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL Bangaru Kalpana Student School of Electronics and Communication Engineering Reva University, Bangalore, Karnataka, India Amrut Anilrao Purohit Assistant Professor School of Electronics and Communication Engineering Reva University, Bangalore, Karnataka, India R. Venkata Siva Reddy Professor School of Electronics and Communication Engineering Reva University, Bangalore, Karnataka, India ABSTRACT The Objective of this Paper is to optimize the area of (Serial peripheral interface) SPI module. SPI is a inter and intra communication protocol used for communication and testing s like BST. Its occupies space in Embedded industry for communication of devices like Microcontrollers, peripheral s for example ADC s, DAC s, Memories etc. ll these devices have a SPI module on it which acts as a master or Slave. This module is consuming more Area, here we made a approach in order to reduce Area, which reduces Cost as well. Protocol is implemented in Structural Code Verilog, Simulated and Synthesized Using Xilinx9.1 on various families of FPGA. Finally whole design is mapped onto Vertex 5 FPGA. Key words: SPI module, Vertex 5FPGA, Xilinx 9.1. Cite this Article: Bangaru Kalpana, Amrut Anilrao Purohit and R. Venkata Siva Reddy, Area Optimization of SPI Module Using Verilog HDL, International Journal of Electronics and Communication Engineering & Technology, 7(3), 2016, pp. 38 45. http://www.iaeme.com/ijecet/issues.asp?jtype=ijecet&vtype=7&itype=3 http://www.iaeme.com/ijecet/index.asp 38 editor@iaeme.com

Area Optimization of SPI Module Using Verilog HDL 1. INTRODUCTION The communication links across components of a chip or a board may be either serial or parallel. Serial communication is performed over fewer interconnecting cables, thus enables to save a significant amount of space and reduce the number of connecting pins. These reasons have led the serial communication interfaces to play a major role in the field of embedded systems. Even though serial communications like I 2 C offers much more features than SPI, Such as less pin count, automatic multi-master conflicts handling and built in addressing management etc. SPI is preferable, since it is very simple, high speed protocol, gives better throughput and offers extensions and variations. Technology has been increased Integrated chips came into picture, where millions of devices are integrated in to the single chip reduces area and Cost as well. In this Paper we moved one more step to reduce area consumed by the SPI module. SPI protocol introduced by the Motorola has four wires. It doesn t have a Certain Speed limit, today s it works up to 10Mega bits per second. It is a Mater-Slave protocol i.e., A Module can be acts as either Master or Slave. Master initiates the transmission and sends out Clock. In this paper we used a Structural code Verilog to implement SPI module. A simple master, slave are deigned and the whole design is simulated and synthesized using Xilinx9.1. 1.1. SPI Protocol SPI is a simple four wire protocol designed by the Motorola initially, later many vendors came up with new SPI designs,some features added.it is a full duplex, Synchronous serial comminution protocol. It isn t a standard protocol like I 2 C. Designer has freedom to Extend it.spi works in either master mode or Slave mode. Four pins and their description according to the Motorola as below Table1 Shows how the purpose of pins vary for master and slave modules Pin notation Master Slave MOSI (Master out slave in) Output pin Input pin MISO (master in Slaveout) Input pin Output pin SCK (serial clock) Output pin Input Pin SS_ba (slave select) Output pin Input pin Master starts sending or receiving by asserting slave select line of particular slave, generates Clock and sends out the clock to the slave through SCK line, keep whole transmission under control of the clock. Every SPI module has mainly Port logic, Baud rate generation logic, Shift logic [7]. It has 8 bit registers through which user can sets SPI module. Even it is 8 bit, it can transmit up to 12 bits. Control word written decides whether the SPI Module works as master or slave, the two shift register s, one in Master and one in Slave are Connected in loop through MOSI and MISO lines[7]. Since it is full duplex for every clock pulse one bit is shifted in and shifted out of the module. Once Data has been received, data will transfer to receive data register parallelly, sets bits in Status register. http://www.iaeme.com/ijecet/index.asp 39 editor@iaeme.com

Bangaru Kalpana, Amrut Anilrao Purohit and R. Venkata Siva Reddy Baud rate register R/W SPPR2 SPPR1 SPPR0 SPR2 SPR1 SPR0 Reset 0 0 0 0 0 0 0 0 Figure1 Reset values, bits description of baud rate register Above shows a baud rate register with 8 bits sets the clock rate, SPPR2, SPPR1, SPPR0 are Baud rate preselection bits and SPR0, SPR1, SPR2 SPI Baud rate selection bits combinely to divide clock to desired frequency. Status Register: As per name it shows the status of SPI module R/W SPIF SPTEF Reset 0 0 0 0 0 0 0 0 Figure2 Reset values and bit descriptions of status register SPTEF -set's the interrupt when the transmit data register is empty. Clearing this bit after writing to data register starts next transmission. SPIF-SPI interrupt flag: Once data has been received, this bit is set. Reading data register without reading status register is not allowed. Control register R/W SPIE SPE SPTIE MSTR CPOL CPHA SSOE LSBFE Reset 0 0 0 0 1 0 0 0 Figure3: Reset values and bit descriptions of control register SPIE- interrupt enable bit of SPI module. Enable the interrupt for reading operation if SPIF =1.ISR interrupt service routine, which includes operations to Start next byte of transmission consider the interrupt raises by SPIF this bit is to be set. SPE- system enable bit of SPI module. SPI module works only, if this bit is set. Clearing of this bit disables the SPI module and goes to idle state. SPTIE-Transmit enable bit of SPI. Enable the interrupt for next transmission if SPITFE=1.This bit enables the SPTEF interrupt to survive. MSTR-This bit shows weather module acts as master or slave, if 1 acts as master. CPOL: Clock polarity bit, if 1, Clock inversion occurs. This bit sets the clock as inverted clock or non-inverted that module has to work. CPHA: This bit decides at which clock edges latching and shifting has to occur, if it is 0, latching occurs on even edges and shifting in odd. SSOE: Slave select output enabled, for master acts as output pin assert to Vcc if single master, for slave acts as input pin grounded to 0 if single slave. LSBFE-This bit decides which bit to shift either LSB (least significant bit) or MSB (most significant bit) to shift. 2. FUNCTIONAL DESCRIPTION Control word written decides Module as a master or Slave. SPE bit enables the SPI module and MSTR decides Mater or Slave [4]. MASTER If MSTR=1, Module do master functions.it has to generate Clock. Baud logic generates the clock from the word written to the baud rate register. Master initiates the transmission by selecting slave through SS_bar line. The slave by asserting slave select line of particular slave to 0 in Multi slave mode. If single slave in http://www.iaeme.com/ijecet/index.asp 40 editor@iaeme.com

Area Optimization of SPI Module Using Verilog HDL communication, VCC is given to SS pin. It begins transmission by reading the Status register, if SPITE =1 write the data has to be transmitted into Transmit data register. Transmit data register shifts 8bit data parrallely into Shift register by clearing SPITE flag. Communication occurs by transmitting one bit per one clock pulse, after 8 pulses data has been received shifted out parallelly into Receive data register by setting SPIF flag. Slave If MSTR=0, module acts as Slave. In slave mode SCK and MOSI acts as input pins and MISO as output pin by default. Select pin is connected to the ground before transmission. Data exchanging occurs under the control of master clock. Once data has been received, bits are transmitted to Data register by setting SPIF flag bit. This bit is cleared by doing read accesses to the status register followed by data register. 2.1.1. Transmission Formats: [4] CPOL, CPHA bits in the Control register decides four modes in which data transmission occurs. CPOL bit decides, Clock is inverted or not. Mode 0 when CPOL=0, CPHA=0: Data changing on falling edge, reading on raising edge Mode 1 when CPOL=1, CPHA=0: FIGURE 4 Timing diagram of mode0 Mode 2 when CPOL=0, CPHA=1: FIGURE 5 Timing diagram of mode1 FIGURE 6 Timing diagram of mode2 http://www.iaeme.com/ijecet/index.asp 41 editor@iaeme.com

Bangaru Kalpana, Amrut Anilrao Purohit and R. Venkata Siva Reddy Mode 3 when CPOL=1, CPHA=1: Figure7 Timing diagram of mode 3 3. NEW DESIGN We followed the Motorola user guide in order to model this design. Optimization of the gate level logic design is possible if we have a thorough knowledge of digital design. We actually went for digital logic design of logics to compress the area of SPI protocol. Successfully we optimize the area of baud logic, shift logic and port logic results a very less consumption of area than previous design. Since it is a Synchronous and asynchronous mixed design, all synchronous part of a design is edge triggered one. Synthesis has done on vertex-5 Xc5VLX30T FF324 board using XILINX 9.1. Below shows RTL view and schematic view of design on vertex-5 Xc5VLX30T FF324 Figure 8 SPI module RTL view. Figure 9 SPI module RTL view. http://www.iaeme.com/ijecet/index.asp 42 editor@iaeme.com

Area Optimization of SPI Module Using Verilog HDL 4. IMPLEMENTATION RESULTS Whole design implemented in XILINX9.1. Below shows verification results of design done by using MODELSIM 9.1. Design wrong with control, data, and baud registers which has to set by the user. A default value has been assigned to the register before module works for transmission. In our design default values are shown above. Below shows synthesis results of design, mapped on to vertex-5 Xc5VLX30T FF324 board, spatran3 board etc... A comparison is made to the previous design results. SPI master module sending data out: SPI slave module receiving data: Figure 10.SPI module as Master when MSTR=1. Figure 11 SPI module as a slave when MSTR=0. Table 2 Shows Synthesis results on Vertex 5 xc5vlx30-3ff324 comparison [1] & [4] Used by Utilized in Our design Available percentage Slices count 0 40 0% LUT count 40 19200 0% Bound ed IOB s 22 220 10% http://www.iaeme.com/ijecet/index.asp 43 editor@iaeme.com

Bangaru Kalpana, Amrut Anilrao Purohit and R. Venkata Siva Reddy Table3 Shows Synthesis results comparison on different boards with previous design done in reference [2] Spartan 3E Used by Used By previous XC3S500E - 5[2] Our design design Available Slices count 13 51 4656 LUT count of 4 input 92 23 9312 Bounded IOB s 21outof232 22 Out of 92 Spartan 3E XC3S1200E -5 Slices count 13 51 8672 LUT count 23 92 17344 Bounded IOB s Virtex 4 XC4VFX100-12 Slices count 22outof 190 21 out of 250 13 43 42176 LUT count 81 23 84352 Bounded IOB s 22 out of 576 21out of 680 5. CONCLUSION AND FUTURE SCOPE Proposed design is simple SPI module acts as either master or slave. Our design consumes less area comparatively known from results in section before. Reducing area, reduces cost of design as well. Future, by adding some more features this module can also work in multi slave and multi master communication environment, still consumes less area. REFERENCES [1] Anand N, George Joseph, Suwin Sam Oommen, and R Dhanabal, design and implementation of high speed serial interface, School of Electronics Engineering, VIT University, Vellore, India. [2] Amit Kumar Shrivastava and Himanshu Joshi, Design, Implementation and Functional Verification of Serial Communication Protocols (SPI and I2C) on FPGAs, HCTL Open IJTIR Volume 4, July 2013. http://www.iaeme.com/ijecet/index.asp 44 editor@iaeme.com

Area Optimization of SPI Module Using Verilog HDL [3] T. Durga Prasad and B. Ramesh Babu, Design and simulation of master/ using Verilog HDL, IJSR, 3 (8), August 2014. [4] Prof. Jai Karan Singh and Prof. Mukesh Tiwari, Implementation of SPI slave on FPGA, IJAET/Vol.III/ Issue IV/Oct.-Dec, 2012/24-26. [5] A.K. Oudjida et al, FPGA Implementation of I2C and SPI protocols, IEEE Instrumentation & Measurement Magazine, pp.8 13, February 2009. [6] Motorola Inc, SPI Block Guide V03.06, February 2003. [7] Fareha Naqvi, design and implementation of serial peripheral interface protocol Using Verilog HDL, 2015 IJEDR, 3(3) ISDSN: 2321 9939. [8] Qazi Raza Abdul Quadir, Arif Rasool, Manan Mushtaq and Yasirbhat, Design and Simulation of A Non-Pipelined, Multi- Cycle 16 Bit Risc Educational Processor Using Verilog HDL, International Journal of Electronics and Communication Engineering & Technology, 5(9), 2014, pp. 14 23. [9] Md. Ajmal Sadiq, T.Naga Raju and Kumar. Keshamoni, Modeling and Simulation Of Test Data Compression Using Verilog, International Journal of Electronics and Communication Engineering & Technology, 4(5), 2013, pp. 143 141. [10] R.Kathiresan, M.Thangavel, K.Rathinakumar And S.Maragadharaj, Analysis of Different Bit Carry Look Ahead Adder Using Verilog Code, International Journal of Electronics and Communication Engineering & Technology, 4(4), 2013, pp. 214 220. http://www.iaeme.com/ijecet/index.asp 45 editor@iaeme.com