SlideShare une entreprise Scribd logo
1  sur  22
Serial Peripheral Interface (SPI)Serial Peripheral Interface (SPI)
Master CoreVerificationMaster CoreVerification
By: Maulik Suthar
IntroductionIntroduction
What is SPI?
Properties of SPI
SPI Master Core Specification
Verification Approach
Environment Diagram
Testcases
BUGS!!
Conclusion
What is SPI?What is SPI?
SPI stands for Serial Peripheral Interface.
Synchronous Serial Bus protocol
developed by Motorola.
Also known as SSI(Synchronous Serial
Interface)
4-wired serial bus.
Simple, fast, easy to use.
Accepted by wide number of devices
offering serial data transmission.
Properties of SPIProperties of SPI
Always FULL DUPLEX.
Devices communicate in master-
slave mode, master initiates the transfer.
Single master – multiple Slaves
Single slave is active at a given instance of
time.
Variable transmission speed from slave
supported.
INTERFACEINTERFACE
The SPI bus specifies four logic signals
SCLK: serial clock (output from master)
MOSI: master output, slave input
MISO: master input, slave output
SS: slave select (slave enable signal,
output from master)
Data TransmissionData Transmission
Host configures the master
Master initiates the transfer by selecting
the slave, and starting the SCLK.
Data from master shifts out from MOSI
and slave data shifts in via MISO
SPI Master Core ArchitectureSPI Master Core Architecture
FeaturesFeatures
Full duplex synchronous serial data transfer
Variable length of transfer word up to 128 bits
MSB or LSB first data transfer
Rx and Tx on both rising or falling edge of serial
clock independently
8 slave select lines
Fully static synchronous design with one clock
domain
Technology independent Verilog
Fully synthesizable
Wishbone InterfaceWishbone Interface
 SPI Master acts as a slave to the Wishbone Interface.
 Wishbone communicates with the host
 Bus signals are as described below:
SPI Core registersSPI Core registers
Data receive registers, Data transmit register
◦ Both are same registers, total four registers each of 32 bits
◦ Received data is stored in Rx0, Rx1, Rx2, Rx3 after read
cycle
◦ Transmitted data is stored in Tx0, Tx1, Tx2, Tx3 during
write cycle
Divider register
◦ This register specifies the SCLK frequency which is derived
by dividing the Master clock
Registers Contd.Registers Contd.
Slave Select register
◦ bits [7:0] defines the current active slave out of 8
slaves.
◦ It employs 1-hot encoding as to enable only 1 slave at
a time, it its automatically set by master if ASS bit in
CTRL is set to 1.
Control and status register
Verification approachVerification approach
Master agent is established to simulate the
wishbone protocol signals from host side.
Slave agent is established to simulate the SPI
protocol.
Each agent has its individual sequencer, monitor
and driver.
The virtual sequencer and scoreboard are
included in the environment and the top level
module which encapsulates the RTL along with
the Testcases.
Steps to drive the DUVSteps to drive the DUV
 To drive the DUV we need to make the signals
wb_we_i = 1,
wb_stb_i = 1,
wb_cyc_i = 1.
 This will activate the SPI Master Core and indicate a
valid write cycle.
 Supply the address of the SPI core registers to write
into and wait for the ack to arrive from the core.
 After configuring the data, divider, and ss registers at
last configure the CTRL register by making GO_BUSY
bit to 1 and start the slave data transfer.
Contd.Contd.
After slave completes writing the data
into core’s data registers wb_int_o signal
will be asserted.
This indicates end of a valid bus cycle and
core is ready to proceed for next cycle.
TestcasesTestcases
Test_1
◦ LSB =1, TxNEG = 1, RxNEG = 0.
Test_2
LSB =1, TxNEG = 0, RxNEG = 1.
Test_3
LSB =0, TxNEG = 0, RxNEG = 1.
Test_4
LSB =0, TxNEG = 1, RxNEG = 0.
BUGS!!BUGS!!
Able to find two BUGS!! In the design of
SPI master core.
First bug is found in MISO coming from
slave side.
When the SCLK starts, the data to be
transferred is not arriving at triggering
edge of the SCLK as a result X is
transferred into the master.
Screenshot of BUGScreenshot of BUG
Another BUG!! Is found in the MOSI
coming out of the master core.
The applied data to be transmitted to
slave is shifted 1-bit right, when collected
from slave monitor.
01001001110111010101100011000100 MOSI from master
monitor
00100100111011101010110001100010 MOSI from slave
monitor
Design with Multiple SlavesDesign with Multiple Slaves
• Design with a single master and multiple
independent slaves.
• This Design supports up to 8 slaves which can be
addressed using SS signal independently.
ConclusionConclusion
Design was verified based on UVM
methodology.
Simulation was done in Questasim using
SystemVerilog.
Two critical bugs were found during
Verification.
Functional coverage was implemented
and achieved 92.85% of functional code
coverage for this design.
Pros & Cons of SPIPros & Cons of SPI
Fast & easy to implement.
Best choice for point-to-point
connections.
Easily supported by devices.
Lack of ACK mechanism.
Doesn't have in-built addressing for
slaves
Multiple slaves increases its complexity.
No data error control and flow control.
Cant detect if slave present or not.

Contenu connexe

Tendances (20)

Serial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System ProtocolSerial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System Protocol
 
Apb
ApbApb
Apb
 
Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0
 
Amba axi 29 3_2015
Amba axi 29 3_2015Amba axi 29 3_2015
Amba axi 29 3_2015
 
Ambha axi
Ambha axiAmbha axi
Ambha axi
 
Serial peripheral interface
Serial peripheral interfaceSerial peripheral interface
Serial peripheral interface
 
AMBA 3 APB Protocol
AMBA 3 APB ProtocolAMBA 3 APB Protocol
AMBA 3 APB Protocol
 
I2C Bus (Inter-Integrated Circuit)
I2C Bus (Inter-Integrated Circuit)I2C Bus (Inter-Integrated Circuit)
I2C Bus (Inter-Integrated Circuit)
 
AMBA_APB_pst
AMBA_APB_pstAMBA_APB_pst
AMBA_APB_pst
 
Uart
UartUart
Uart
 
Axi
AxiAxi
Axi
 
AXI Protocol.pptx
AXI Protocol.pptxAXI Protocol.pptx
AXI Protocol.pptx
 
I2C introduction
I2C introductionI2C introduction
I2C introduction
 
AHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptxAHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptx
 
Advance Peripheral Bus
Advance Peripheral Bus Advance Peripheral Bus
Advance Peripheral Bus
 
system verilog
system verilogsystem verilog
system verilog
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
 
Pcie basic
Pcie basicPcie basic
Pcie basic
 
I2C
I2CI2C
I2C
 

Similaire à Spi master core verification

communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemsRaghunath reddy
 
Spi in arm7(lpc2148)
Spi in arm7(lpc2148)Spi in arm7(lpc2148)
Spi in arm7(lpc2148)Aarav Soni
 
Fpga implementation of utmi with usb 2.O
Fpga implementation of  utmi  with usb 2.O Fpga implementation of  utmi  with usb 2.O
Fpga implementation of utmi with usb 2.O Mathew George
 
spi-180501092933-converted.pptx
spi-180501092933-converted.pptxspi-180501092933-converted.pptx
spi-180501092933-converted.pptxsauryakumar3
 
Serial Peripheral Interface Design for Advanced Microcontroller Bus Architect...
Serial Peripheral Interface Design for Advanced Microcontroller Bus Architect...Serial Peripheral Interface Design for Advanced Microcontroller Bus Architect...
Serial Peripheral Interface Design for Advanced Microcontroller Bus Architect...IJMTST Journal
 
Master synchronous serial port (mssp)
Master synchronous serial port (mssp)Master synchronous serial port (mssp)
Master synchronous serial port (mssp)babak danyal
 
Embedded systems and robotics by scmandota
Embedded systems and robotics by scmandotaEmbedded systems and robotics by scmandota
Embedded systems and robotics by scmandotascmandota
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
Part-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentPart-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentFastBit Embedded Brain Academy
 
Designing of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDLDesigning of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDLJay Baxi
 
AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL
AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDLAREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL
AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDLIAEME Publication
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)ijceronline
 
One-Wire-Serial-Communication.pdf
One-Wire-Serial-Communication.pdfOne-Wire-Serial-Communication.pdf
One-Wire-Serial-Communication.pdfshamtekawambwa1
 
SOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsSOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsA B Shinde
 
UNI T 6- SPI_I2C_Lecture8.pptx
UNI                    T 6- SPI_I2C_Lecture8.pptxUNI                    T 6- SPI_I2C_Lecture8.pptx
UNI T 6- SPI_I2C_Lecture8.pptxnaveen088888
 
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardCustomizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardBharat Biyani
 

Similaire à Spi master core verification (20)

communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systems
 
Spi in arm7(lpc2148)
Spi in arm7(lpc2148)Spi in arm7(lpc2148)
Spi in arm7(lpc2148)
 
Fpga implementation of utmi with usb 2.O
Fpga implementation of  utmi  with usb 2.O Fpga implementation of  utmi  with usb 2.O
Fpga implementation of utmi with usb 2.O
 
Assembler4
Assembler4Assembler4
Assembler4
 
spi-180501092933-converted.pptx
spi-180501092933-converted.pptxspi-180501092933-converted.pptx
spi-180501092933-converted.pptx
 
Serial Peripheral Interface Design for Advanced Microcontroller Bus Architect...
Serial Peripheral Interface Design for Advanced Microcontroller Bus Architect...Serial Peripheral Interface Design for Advanced Microcontroller Bus Architect...
Serial Peripheral Interface Design for Advanced Microcontroller Bus Architect...
 
Master synchronous serial port (mssp)
Master synchronous serial port (mssp)Master synchronous serial port (mssp)
Master synchronous serial port (mssp)
 
Embedded systems and robotics by scmandota
Embedded systems and robotics by scmandotaEmbedded systems and robotics by scmandota
Embedded systems and robotics by scmandota
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
Introduction to embedded systems
Introduction to embedded systemsIntroduction to embedded systems
Introduction to embedded systems
 
Part-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentPart-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver development
 
Serial Busses.pptx
Serial Busses.pptxSerial Busses.pptx
Serial Busses.pptx
 
Designing of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDLDesigning of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDL
 
AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL
AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDLAREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL
AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
One-Wire-Serial-Communication.pdf
One-Wire-Serial-Communication.pdfOne-Wire-Serial-Communication.pdf
One-Wire-Serial-Communication.pdf
 
SOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsSOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC Tools
 
UNI T 6- SPI_I2C_Lecture8.pptx
UNI                    T 6- SPI_I2C_Lecture8.pptxUNI                    T 6- SPI_I2C_Lecture8.pptx
UNI T 6- SPI_I2C_Lecture8.pptx
 
SPI Protocol in LPC2148
SPI  Protocol in LPC2148SPI  Protocol in LPC2148
SPI Protocol in LPC2148
 
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardCustomizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
 

Spi master core verification

  • 1. Serial Peripheral Interface (SPI)Serial Peripheral Interface (SPI) Master CoreVerificationMaster CoreVerification By: Maulik Suthar
  • 2. IntroductionIntroduction What is SPI? Properties of SPI SPI Master Core Specification Verification Approach Environment Diagram Testcases BUGS!! Conclusion
  • 3. What is SPI?What is SPI? SPI stands for Serial Peripheral Interface. Synchronous Serial Bus protocol developed by Motorola. Also known as SSI(Synchronous Serial Interface) 4-wired serial bus. Simple, fast, easy to use. Accepted by wide number of devices offering serial data transmission.
  • 4. Properties of SPIProperties of SPI Always FULL DUPLEX. Devices communicate in master- slave mode, master initiates the transfer. Single master – multiple Slaves Single slave is active at a given instance of time. Variable transmission speed from slave supported.
  • 5. INTERFACEINTERFACE The SPI bus specifies four logic signals SCLK: serial clock (output from master) MOSI: master output, slave input MISO: master input, slave output SS: slave select (slave enable signal, output from master)
  • 6. Data TransmissionData Transmission Host configures the master Master initiates the transfer by selecting the slave, and starting the SCLK. Data from master shifts out from MOSI and slave data shifts in via MISO
  • 7. SPI Master Core ArchitectureSPI Master Core Architecture
  • 8. FeaturesFeatures Full duplex synchronous serial data transfer Variable length of transfer word up to 128 bits MSB or LSB first data transfer Rx and Tx on both rising or falling edge of serial clock independently 8 slave select lines Fully static synchronous design with one clock domain Technology independent Verilog Fully synthesizable
  • 9. Wishbone InterfaceWishbone Interface  SPI Master acts as a slave to the Wishbone Interface.  Wishbone communicates with the host  Bus signals are as described below:
  • 10. SPI Core registersSPI Core registers Data receive registers, Data transmit register ◦ Both are same registers, total four registers each of 32 bits ◦ Received data is stored in Rx0, Rx1, Rx2, Rx3 after read cycle ◦ Transmitted data is stored in Tx0, Tx1, Tx2, Tx3 during write cycle Divider register ◦ This register specifies the SCLK frequency which is derived by dividing the Master clock
  • 11. Registers Contd.Registers Contd. Slave Select register ◦ bits [7:0] defines the current active slave out of 8 slaves. ◦ It employs 1-hot encoding as to enable only 1 slave at a time, it its automatically set by master if ASS bit in CTRL is set to 1. Control and status register
  • 12. Verification approachVerification approach Master agent is established to simulate the wishbone protocol signals from host side. Slave agent is established to simulate the SPI protocol. Each agent has its individual sequencer, monitor and driver. The virtual sequencer and scoreboard are included in the environment and the top level module which encapsulates the RTL along with the Testcases.
  • 13.
  • 14. Steps to drive the DUVSteps to drive the DUV  To drive the DUV we need to make the signals wb_we_i = 1, wb_stb_i = 1, wb_cyc_i = 1.  This will activate the SPI Master Core and indicate a valid write cycle.  Supply the address of the SPI core registers to write into and wait for the ack to arrive from the core.  After configuring the data, divider, and ss registers at last configure the CTRL register by making GO_BUSY bit to 1 and start the slave data transfer.
  • 15. Contd.Contd. After slave completes writing the data into core’s data registers wb_int_o signal will be asserted. This indicates end of a valid bus cycle and core is ready to proceed for next cycle.
  • 16. TestcasesTestcases Test_1 ◦ LSB =1, TxNEG = 1, RxNEG = 0. Test_2 LSB =1, TxNEG = 0, RxNEG = 1. Test_3 LSB =0, TxNEG = 0, RxNEG = 1. Test_4 LSB =0, TxNEG = 1, RxNEG = 0.
  • 17. BUGS!!BUGS!! Able to find two BUGS!! In the design of SPI master core. First bug is found in MISO coming from slave side. When the SCLK starts, the data to be transferred is not arriving at triggering edge of the SCLK as a result X is transferred into the master.
  • 19. Another BUG!! Is found in the MOSI coming out of the master core. The applied data to be transmitted to slave is shifted 1-bit right, when collected from slave monitor. 01001001110111010101100011000100 MOSI from master monitor 00100100111011101010110001100010 MOSI from slave monitor
  • 20. Design with Multiple SlavesDesign with Multiple Slaves • Design with a single master and multiple independent slaves. • This Design supports up to 8 slaves which can be addressed using SS signal independently.
  • 21. ConclusionConclusion Design was verified based on UVM methodology. Simulation was done in Questasim using SystemVerilog. Two critical bugs were found during Verification. Functional coverage was implemented and achieved 92.85% of functional code coverage for this design.
  • 22. Pros & Cons of SPIPros & Cons of SPI Fast & easy to implement. Best choice for point-to-point connections. Easily supported by devices. Lack of ACK mechanism. Doesn't have in-built addressing for slaves Multiple slaves increases its complexity. No data error control and flow control. Cant detect if slave present or not.