SPI Sub (Slave) Core

SPI subordinate with clean clock-domain handling.

Overview

The SPI Sub core makes the FPGA an SPI subordinate. SCLK, CS and MOSI arrive asynchronously and are synchronised into the system clock, so the whole core runs in one clock domain. It handles continuous multi-byte frames under one chip select and stages the next word at word boundaries. A MISO output-enable supports shared buses.

Features

  • Asynchronous SCLK, CS and MOSI synchronised into the system clock
  • All four SPI modes
  • Continuous multi-byte frames under one CS
  • MISO output-enable for shared buses
  • Next-word staging at word boundaries
  • Single clock domain; synchronous active-high reset; std_logic-only ports; no vendor primitives
  • Self-checking testbenches included

Block diagram

SPI Sub core block diagramSCLK, CS_N and MOSI from the external main pass through two flip-flop synchronisers into the system clock domain, then into edge detection and shift registers with next-word staging. Received words go to the host; the host supplies the next transmit word. A MISO output stage drives MISO and its output enable.spi_subCPOL, CPHArx wordtx word (next)Shift registersedge detect, word count,next-word stagingInput sync2-FF × 3MISO outwith OESCLKCS_NMOSIMISOMISO_OE
Fig. 1 SPI Sub core, functional view. clk and rst not drawn.

Specifications

ParameterValue
HDLVHDL, synthesizable
Clock domains1 (fclk)
ResetSynchronous, active-high
SPI modes0, 1, 2, 3
Input handlingSCLK, CS, MOSI synchronised to fclk
FramesContinuous multi-byte under one chip select
Word stagingNext word staged at word boundaries
MISOOutput-enable for shared buses
SCLK limit≤ fclk/10
Port typesstd_logic only
Vendor primitivesNone
VerificationSelf-checking testbenches

Interface

PortDirWidthDescription
clkin1System clock, fclk
rstin1Synchronous reset, active-high
cpolin1Clock polarity
cphain1Clock phase
rx_dataout8Byte received
rx_validout1Byte received strobe
tx_datain8Next byte to send
sclkin1SPI clock from main
cs_nin1Chip select, active low
mosiin1Main out, subordinate in
misoout1Main in, subordinate out
miso_oeout1MISO output enable
Port list for orientation; the datasheet is authoritative. W = word width generic.

Performance

TransferSCLK ratio@ fclk = 40 MHz@ fclk = 100 MHz
Subfclk/104 MHz10 MHz
Verified in simulation. Maximum SCLK on hardware also depends on board, I/O timing and the connected device.

Resource utilisation

DeviceLUTsFFsFmax
AMD 7 SeriesPublished after synthesis — ask sales
Altera CyclonePublished after synthesis — ask sales
Lattice ECP5Published after synthesis — ask sales

Supported targets

Vendor-neutral VHDL with no vendor primitives or constraints. The source licence targets any family listed under supported FPGA vendors, including NI LabVIEW FPGA targets through the IP Integration Node. An evaluation netlist is built for one named device and toolchain version.

Deliverables

ItemEvaluationSource licence
Delivered asNetlist for one named device + toolchainVHDL source + testbenches
DocumentationDatasheetDatasheet, integration guide, testbench guide
UseEvaluation only, [terms to fill in]Production, [terms to fill in]
Full terms: Licensing & evaluation.

Documentation

DocumentFormatAvailability
SPI Sub (Slave) Core — DatasheetPDFPublic
Integration guidePDFWith source licence
Testbench guidePDFWith source licence