
The rSPARK RTL targets a Tiny Tapeout SKY130 accelerator with eight FP8 E4M3FN MAC lanes and one 1 KiB OpenRAM SRAM. It streams sensor inputs from UART, fetches instructions and weights from an external QPI PSRAM, and returns two FP8 output values per computation over UART.
Use the TinyQV QSPI Pmod pin order. Prepare PSRAM-A in QPI mode and load the program image before releasing chip reset and giving the accelerator the bus. The UART uses 8N1. At 50 MHz, the RTL default of 434 clock cycles per bit gives about 115.2 kbaud.
| Tiny Tapeout pin | Function |
|---|---|
ui[3] |
UART RX |
uo[4] |
UART TX |
uo[2] |
Decoder ready |
uo[1] |
Fault |
uio[1,2,4,5] |
QPI DQ0–DQ3 |
uio[3] |
QPI clock |
uio[6] |
PSRAM-A chip select, active low |
uio[0,7] |
Other memory chip selects, held high |
The PSRAM image has an eight-byte little-endian header at 0x1ffff8. Bits
8:0 give the input channel count (1–256), and bits 11:9 give the batch size
(1–4). The RTL reads the UART clocks per bit from bits 21:12. Use zero for
the default (434), or set a divisor from 32 to 1023. Bits 63:22 are reserved
and must be zero. The MCU writes this value before reset is released, and
the same setting applies to RX and TX until the next reset.
The repeat table begins at 0x1ff000 and the instruction stream
starts at 0x200000. Send input bytes after the ready signal. Pad an odd
channel count with one zero byte. The current RTL sends the two FC output
values with ACC_TO_UART and transmits the lower byte first.
The 1 KiB RTL uses a single 128-word × 64-bit SRAM with 512 B UB, 256 B ACC,
and 256 B WB. A full 256-neuron weight column fits in WB, so a 32-row repeat
descriptor can load it in one pass. The default output of
scripts/build_column_egru.py matches this allocation.
Programs can also tile their work and spill/reload FP8 partial sums with
ACC_TO_DRAM and DRAM_TO_ACC when their working set exceeds 256 B.
The standalone 1 KiB macro files are in memory/openram/generated/tt_sram_1rw_64x128_sky130/.
The packaged Tiny Tapeout tile in layout/final/ includes the 1 KiB macro.
ACC_TO_UART (opcode 0x45) uses the DMA instruction format. Bits
31:16 give the starting ACC row and bits 15:8 give the row count.
Bits 36:35 select the first FP8 lane, and bits 34:32 select the number
of bytes per row (1–4, or zero for the default of two). Set bits 63:37
to zero. DMA sends the selected bytes in ascending lane order and
applies the same window to each row. An empty row range sends nothing.
A lane window that extends past a row raises a fault and skips the
instruction. UART starts as soon as it accepts a result. SYNCHRONIZE
retires the input frame once its instructions are drained.
For VPU instructions that read SRAM directly, the 16-bit source address field uses bit 6 to select UB (0) or WB (1). Bits 5:0 select a row within that region, with up to 64 rows in UB and 32 rows in WB. Upper bits must be zero for a nonempty read, and a range that crosses the end of either region raises the fault output and skips the instruction. DMA instructions still use region-relative row addresses selected by their opcode.
The source list is src/sources.f. The accelerator datapath, DMA and
program sequencer live in src/rtl/accelerator/. UART and the PSRAM controller live in
src/rtl/peripherals/. The DMA connects directly to the PSRAM controller
with a shared read/write burst command and 64-bit data beats. The command
length determines the number of beats. The same response channel returns
read data or acknowledges a completed write. The DMA shares one
region-tagged row request port across UB, WB, and ACC in the SRAM
controller. The VPU and activation datapaths share the row counters,
metadata queue and SRAM request ports in mem_ctrl. The DMA engine
inside mem_ctrl has its own transfer state and SRAM request port.
The PSRAM controller arbitrates DMA, instruction fetch and UART ingress.
The accelerator and SRAM macro
wrappers live in src/rtl/macros/. Testbenches and peripheral models live
under test/rtl/. The wrapper smoke test exercises QPI boot,
UART ingress, SRAM DMA, an FP8 vector operation, and UART egress through
the public pins.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | FLASH_CS_N_HIGH | ||
| 1 | ERROR | QSPI_DQ0 | |
| 2 | DECODER_READY | QSPI_DQ1 | |
| 3 | UART_RX | QSPI_SCK | |
| 4 | UART_TX | QSPI_DQ2 | |
| 5 | QSPI_DQ3 | ||
| 6 | PSRAM_A_CS_N | ||
| 7 | PSRAM_B_CS_N_UNUSED |