SPI WISHBONE Controller
March 2014
Reference Design RD1044
Introduction
The Serial Peripheral Interface (SPI) bus provides an industry standard interface between microprocessors and
other devices as shown in Figure 1. This reference design documents a SPI WISHBONE controller designed to
provide an interface between a microprocessor with a WISHBONE bus and external SPI devices. In master mode,
the SPI controller can be configured for communication with multiple off-chip SPI ports. In slave mode, the SPI sup-
ports communications with an off-chip SPI master.
As a simple serial port, the SPI uses few FPGA resources (see Table 6) and little board space for wires. This SPI
reference design uses only three pins (clock, data in, and data out) plus one select for each slave device. A SPI is
a good choice for communicating with low-speed devices that are accessed intermittently and transfer data
streams rather than reading and writing to specific addresses. A SPI is an especially good choice if you can take
advantage of its full-duplex nature, which sends and receives data at the same time.
Figure 1. Using the SPI WISHBONE Controller to Connect to Peripherals
Peripheral
FPGA
Slave
SPI
SPI
WISHBONE
Controller
Microprocessor
(Master Mode)
Peripheral
Slave
SPI
Both Verilog and VHDL versions of the reference design are available. Lattice design tools are used for synthesis,
place and route and simulation. The design can be targeted to multiple Lattice device families. Its small size makes
it portable across different FPGA or CPLD architectures.
This design assumes the user has experience with WISHBONE controllers. Information available in the documents
listed in the References section is not repeated in this document.
Theory of Operation
Overview
This SPI WISHBONE controller provides an interface between a microprocessor with a WISHBONE bus and a SPI
device. The controller can either act as the SPI Master or SPI Slave device. The selection of the Master or Slave
mode is done using parameters in the HDL code. The design uses a single module.
The SPI WISHBONE reference design provides standard, fully-configurable SPI ports including:
• WISHBONE B.3 interface
• Slave and master modes. Master mode can control up to eight slaves. More can be added if desired.
• Interrupt request to the processor, configurable for a variety of status conditions.
• Configurable serial clock (SCLK) frequency.
© 2014 Lattice Semiconductor Corp. All Lattice trademarks, registered trademarks, patents, and disclaimers are as listed at www.latticesemi.com/legal. All other brand
or product names are trademarks or registered trademarks of their respective holders. The specifications and information herein are subject to change without notice.
www.latticesemi.com
1
rd1044_01.7