Boot and run your SoC straight out of QSPI flash — no copy to RAM
The Zen QSPI flash controller is a Quad-SPI NOR controller a client drops into their SoC to reach external flash two ways from one shift engine: a software-driven command engine that runs any JEDEC SPI-NOR command, and a hardware XIP (execute-in-place) path that maps flash into the address space so a CPU reads and executes code directly from it. Product / integrator view; every number is sourced from the product datasheet or marked TBC with an owner.
1. QSPI in one paragraph
The controller splits the peripheral bus into two regions by the top address bit. A CONFIG region exposes a 10-register CSR file plus byte-wide TX/RX FIFOs that drive the command engine — program a transfer descriptor (opcode → optional 3/4-byte address → dummy cycles → data), pick the I/O width per phase, and set START to run any flash command. An XIP read region at base 0x8000_0000 turns a plain bus read into a preconfigured fast-read to flash: the controller fetches the word, assembles it little-endian, and returns it as the read response — the execute-from-flash boot path, with no firmware copy step. Both masters share one shift engine and serialize automatically, so there is no interleave and no deadlock.
- QSPI controller (shared engine)
- host bus / client design
- external NOR flash
2. What it is, at a glance
| Element | Detail | Default | Status |
|---|---|---|---|
| Flash protocol | Quad-SPI NOR, SPI mode 0 (CPOL=0, CPHA=0) | — | exists |
| Command descriptor | opcode · addr 0/3/4 B · dummy · dir · len · per-phase width | — | exists |
| Lane modes | single (x1) / dual (x2) / quad (x4), selectable per phase | — | exists |
| XIP read region | addr[31]=1, base 0x8000_0000, read-only | — | exists |
| XIP fetch width | 4 bytes per bus word, little-endian | 4 B | exists |
| TX / RX FIFOs | byte-wide, depth FIFO_DEPTH | 8 | exists |
| SCLK generation | clk_i / (2 × (CLKDIV+1)) | — | exists |
| Register file | CTRL … XIPCFG | 10 CSRs | exists |
| Interrupt | 1 aggregated line (tx/rx threshold, transfer-done) | — | exists |
| Max SCLK frequency @ node | timing sign-off downstream | TBC | TBC |
Sources: Zen QSPI product datasheet; as-built RTL.
3. How a client uses it
- Instantiate the controller on the native Zen peripheral bus; tie the four IO lanes, SCLK, and chip-select to the external NOR flash pins.
- Bring up over the command engine — program a descriptor (read-ID, then a fast-read), push/pop bytes through the TX/RX FIFOs, and poll
STATUS.busyor service the aggregated interrupt on transfer-done. - Configure XIP once — set the fast-read opcode, address bytes, dummy cycles, and data width in
XIPCFG, then enable the region. - Execute in place — point the CPU or boot ROM at
0x8000_0000 + offset; reads return flash data transparently and code runs straight from flash, no copy to RAM. - Maintain firmware — page-program, erase, and read-status sequences through the command engine keep firmware images, calibration tables, or config in flash. Command and XIP coexist on the shared engine and serialize automatically.
4. Verification & provenance
- Byte-exact flash compliance: an assertion-based cocotb environment with a
qspi_flashNOR device model checks program-then-read-back byte-for-byte, dummy-cycle honoring, and that quad reads return the same data as single. - XIP proven independently: dedicated tests cover byte-exact XIP reads, XIP quad == single, sequential XIP, write-rejection, and SW/XIP coexistence on the shared engine — 15 of 15 tests passing across the command-engine and XIP suites.
- Gated: Verilator DV plus a Yosys synthesis check (no inferred latches). Coverage-closed v1; re-run independently at architecture review.
Sources read
Sources: Zen QSPI product datasheet; as-built RTL.