This project implements a complete UVM verification environment for an SPI memory controller, validating correct functionality across read, write, reset, and error scenarios. The design under test (DUT) models an SPI interface connected to an internal memory, while the verification environment ensures protocol correctness, data integrity, and error handling.
The DUT consists of:
- SPI Interface Controller (
spi_intf) - SPI Memory Model (
spi_mem) - Top-level wrapper (
top) connecting the controller and memory
- Supports SPI read and write operations
- Address range checking (valid:
0–31) - Error detection for illegal addresses (
addr > 31) - Handshake-based transaction completion using
doneandop_done - Serial data transfer via MOSI/MISO
- Chip Select (CS) driven protocol control
The verification environment follows a standard UVM layered architecture:
test
└── env
├── agent
│ ├── sequencer
│ ├── driver
│ └── monitor
└── scoreboard
- Controls whether the agent operates in active or passive mode
- Allows easy reuse and scalability of the environment
Represents a single SPI operation and includes:
- Operation type (
read,write,reset,error) - Address and input data
- Output data, completion, and error flags
- Constrained-random address generation
writed– Valid writereadd– Valid readrstdut– DUT resetwriteerr/readerr– Illegal address access
| Sequence Name | Description |
|---|---|
write_data |
Valid write transactions |
read_data |
Valid read transactions |
write_err |
Write operations with invalid address |
read_err |
Read operations with invalid address |
reset_dut |
Reset sequence |
writeb_readb |
Back-to-back write followed by read |
All sequences use constrained randomization and explicit operation selection.
- Drives SPI transactions through a virtual interface
- Handles reset, read, and write behavior
- Synchronizes stimulus with
donesignal - Implements protocol-aware driving logic
- Passively observes DUT interface signals
- Converts pin-level activity into transaction objects
- Sends transactions to the scoreboard via analysis port
- Detects reset, read, write, and error events
- Maintains an internal reference memory model
- Verifies:
- Correct write behavior
- Read data integrity
- Proper error signaling
- Reports data match/mismatch conditions
- Address < 32
- Serial transmission of
{data, address, write}packet - Memory updated upon successful completion
- Address < 32
- Address phase followed by data phase
- Data returned via MISO
- Address ≥ 32
- Chip select remains inactive
- Error flag asserted
- Transaction safely terminated
- Clock generated in the testbench
- Reset supported at startup and via UVM sequence
- Reset brings DUT and memory to a known state
- VCD waveform dumping enabled
- Informative
uvm_infologs from:- Driver
- Monitor
- Scoreboard
- Easy waveform-based debugging
- Open the EDA Playground link
- Select a SystemVerilog simulator
- Enable UVM support
- Run the simulation
- Observe logs, scoreboard output, and waveforms
- Practical UVM testbench implementation
- Constrained-random stimulus generation
- SPI protocol understanding
- Scoreboard-based data verification
- Error injection and handling
- Clean separation of DUT and verification logic
- Functional coverage integration
- UVM register model support
- SPI protocol assertions (SVA)
- Multi-slave SPI support
- Parameterized data/address widths
- VLSI verification students
- Entry-level verification engineers
- Learners exploring UVM with protocol-based designs
This project is intended for learning and demonstration purposes, while closely following industry-standard verification practices.