"# SPI_Master_Core"
This project implements an APB (Advanced Peripheral Bus) based SPI (Serial Peripheral Interface) Master Core using RTL design in Verilog. The design enables efficient communication between an APB master (like a microcontroller) and SPI-compatible peripheral devices.
The SPI core supports full-duplex synchronous communication, configurable clock modes, and seamless integration with AMBA APB protocol systems.
- APB3 compliant slave interface for easy SoC integration
- Full-duplex SPI communication (simultaneous transmit & receive)
- Configurable SPI modes (CPOL & CPHA support)
- Master and Slave operation support
- Programmable baud rate generator
- Low power operation modes (Run, Wait, Stop)
- Double-buffered data handling
The SPI core is divided into the following major blocks:
-
APB Slave Interface
- Handles communication with APB master
- Supports read/write transactions
-
Baud Rate Generator
- Generates SPI clock (SCLK) from APB clock
- Uses programmable divisor logic
-
SPI Slave Select Generator
- Controls SS (Slave Select) signal
- Manages transaction boundaries
-
Shift Register (Shifter)
- Handles serial-to-parallel and parallel-to-serial conversion
👉 The block diagram (page 8 of the document) shows interaction between APB interface, shifter, and clock generator.
- MOSI – Master Output, Slave Input
- MISO – Master Input, Slave Output
- SCK – Serial Clock
- SS – Slave Select
These signals enable synchronous communication between master and slave devices.
-
Uses Setup and Access phases for each transfer
-
Minimum of 2 clock cycles per transaction
-
Key signals:
PADDR,PWDATA,PRDATAPSEL,PENABLE,PWRITEPREADY,PSLVERR
| Address | Register Name | Access | |
|---|---|---|---|
| 0 | SPI Control Register 1 | RW | |
| 1 | SPI Control Register 2 | RW | |
| 2 | SPI Baud Rate Register | RW | |
| 3 | SPI Status Register | RO | |
| 5 | SPI Data Register | RW |
- Data written into SPI Data Register via APB
- SS signal goes LOW (start of communication)
- SCLK generated based on CPOL & CPHA
- Data transmitted via MOSI and received via MISO
- SS goes HIGH (end of communication)
- Verilog HDL (RTL Design)
- Simulation using Verilog Testbench
- Linting & Synthesis tools
- AMBA APB Protocol
- Verilog-based testbench used for functional validation
- Different SPI modes and baud rates tested
- Data integrity verified through simulation
- Embedded systems
- Sensor interfacing
- Communication modules
- Microcontroller peripheral communication
- UVM-based verification environment
- Support for multi-slave SPI
- DMA integration for high-speed transfer
- AXI/APB bridge extension
This project successfully demonstrates the design and implementation of an APB-based SPI Master Core using RTL in Verilog. It ensures reliable, high-speed communication between APB and SPI domains with configurable features like clock modes and baud rate. The modular architecture makes it scalable and easy to integrate into SoC designs. Overall, it provides a strong foundation for further enhancements in design and verification.