SPI Master Mode 0

Beginner
Sign in →
00:00
01General Operation

The module implements an SPI master in mode 0 (CPOL=0, CPHA=0) with a configurable clock divider. A transaction starts on command and transfers data serially, MSB first. The module manages Chip Select and signals availability.

Reset is synchronous and active-high.

Generics:

  • g_clk_div : integer (default 4) — Number of system clock cycles per SCK half-period. With g_clk_div=4, SCK toggles every 4 cycles → SCK frequency = Fclk/8.
  • State machine for protocol management
  • SCK frequency is set by the g_clk_div generic
02Interface
SignalDirectionWidthDescription
i_clkInput1 bitSystem clock
i_rstInput1 bitSynchronous reset
i_startInput1 bitStart transaction
i_dataInput8 bitsData to transmit
i_misoInput1 bitMaster In Slave Out
o_dataOutput8 bitsReceived data
o_doneOutput1 bit'1' during DONE state
o_sckOutput1 bitGenerated SPI clock
o_mosiOutput1 bitMaster Out Slave In
o_cs_nOutput1 bitActive-low Chip Select