The SPI Controller IP block is a configurable, high-performance SPI master with APB interface, FIFO buffering, and interrupt support. It is suitable for ASIC and FPGA integration.
- Integrate RTL: Add
spi_controller.sv,spi_fifo.sv, andspi_protocol_engine.svto your project. - Instantiate: Connect the APB and SPI interfaces as per your SoC or FPGA design.
- Configure: Set parameters (FIFO depth, data width, baud rate) as needed.
- Simulate: Use provided SystemVerilog or Cocotb testbenches for verification.
- APB Registers: Control, status, data, baud, FIFO, interrupt, and mode registers.
- Parameters: FIFO depth, data width, baud divider (see vyges-metadata.json).
- Interrupts: Enable/disable via INT register.
- Error Detection: Timeout, FIFO overflow/underflow detection.
- Loopback Mode: Internal loopback for testing.
- Chip Select Delay: Configurable CS delay timing.
- Transmit: Write data to TXDATA register via APB.
- Receive: Read data from RXDATA register.
- SPI Modes: Set CPOL/CPHA via MODE register.
- FIFO: Monitor FIFO status via STAT register.
- Timeout: Automatic timeout detection with configurable threshold
- FIFO Overflow: Detects when TX FIFO becomes full during writes
- FIFO Underflow: Detects when RX FIFO is empty during reads
- Error Interrupts: Enable via INT[3] for automatic error reporting
- Enable: Set CTRL[5] = 1
- Testing: Internal loopback connects MOSI to MISO for self-testing
- Use Case: Verify SPI controller functionality without external devices
- Configuration: Set CS delay in MODE[15:8] register
- Timing: Configurable delay between CS assertion and data transfer
- Compatibility: Supports devices requiring setup time after CS activation
- TX Enable: CTRL[1] - Enable transmitter independently
- RX Enable: CTRL[2] - Enable receiver independently
- CS Enable: CTRL[3] - Enable chip select independently
- Power Down Mode: CTRL[7] - Enable power down when idle
- Clock Gating: Automatic clock gating for power savings
- Dynamic Power: Reduced power consumption in idle state
- Slave Selection: CTRL[11:8] - Select target slave (0-15)
- CS Control: Independent chip select for each slave
- Multi-Device: Support for up to 16 SPI devices
- Error Recovery: CTRL[12] - Enable automatic error recovery
- Auto Retry: CTRL[13] - Enable automatic retry on errors
- Retry Count: CTRL[19:16] - Maximum retry attempts
- Recovery Logic: Automatic recovery from timeout/overflow
- Max Frequency: MODE[19:16] - Configure maximum operating frequency
- High-Speed: Optimized for frequencies up to 100MHz
- Timing Closure: Advanced timing optimization
- Enable controller: Write
0x1to CTRL. - Set baud: Write divider to BAUD.
- Set mode: Write value to MODE.
- Write data: Write to TXDATA.
- Read data: Read from RXDATA.
- No SPI output: Check CTRL enable, APB clock/reset, and SPI mode.
- FIFO full/empty: Monitor STAT register, adjust FIFO depth if needed.
- Interrupts not firing: Check INT register and interrupt wiring.
For further help, contact the Vyges team or refer to the design specification.