
Sunrise is a 32-bit RISC-V CPU implementing the full RV32I base integer instruction set, built as a classic 5-stage in-order pipeline (fetch, decode, execute, memory, write-back). It has 32 general-purpose registers, full forwarding from the memory and write-back stages, load-use hazard detection, and branch/jump resolution in the execute stage.
The chip has no internal program or data memory. All instructions and data live in external QSPI memory on the Tiny Tapeout QSPI Pmod (one flash chip and two PSRAM chips) connected to the bidirectional pins:
init_done.Memory map
| Address | Device |
|---|---|
0x0000_0000 - 0x00FF_FFFF |
Flash (16 MB): program code and read-only data. Writes are ignored |
0x0100_0000 - 0x017F_FFFF |
PSRAM A (8 MB): data, stack |
0x0180_0000 - 0x01FF_FFFF |
PSRAM B (8 MB) |
0x0800_0000 |
GPIO output register (read/write, 4 bits) -> uo_out[7:4] |
0x0800_0004 |
GPIO input: reads ui_in[7:0] |
Accesses to 0x08xx_xxxx go to the GPIO block and complete in one cycle (no memory stall).
Execution starts at address 0x0000_0000 after reset. ECALL/EBREAK halt the CPU (it loops on that
instruction). FENCE executes as a no-op. CSRs, interrupts and misaligned accesses are not supported.
Registers x1-x31 are not reset (as allowed by the RISC-V specification); software must initialise them.
Timing. Signed off with a 20 ns clock constraint: 50 MHz meets timing at the typical corner (25 °C, 1.8 V), the worst-case corner (100 °C, 1.6 V) supports about 40 MHz, and 25 MHz meets timing in all corners. Expect roughly 0.3-0.4 MIPS at 25 MHz and 0.6-0.8 MIPS at 50 MHz (memory-bound).
You need the QSPI Pmod plugged into the bidirectional Pmod header.
rst_n low). While in reset, all uio pins are released
(inputs), so the RP2040 on the demo board can drive the Pmod: program the flash at address 0 using
standard single-SPI commands (06h write enable, 20h sector erase, 02h page program). If the program
has initialised data, write it to PSRAM A the same way (02h write).rst_n. uo_out[0] (init_done) goes high after
the PSRAM initialisation, then the CPU starts fetching from flash. uo_out[2] and uo_out[3] pulse on
every instruction fetch and data access.uo_out[7:4] by storing to 0x0800_0000 (LEDs, status codes, or a
bit-banged serial output at low baud rates) and read the ui_in pins at 0x0800_0004.ECALL. When the program has halted, uo_out[2] keeps pulsing at a steady rate (the same fetch
repeating) and uo_out[3] stops. Put the design back in reset and read PSRAM A from the RP2040 (03h read).Test programs. The test/programs folder contains the 40 rv32ui programs from the official
riscv-tests suite, built for this memory map. Each one writes 1 to address 0x0100_0000 (first word of
PSRAM A) when it passes, or (test_number << 1) | 1 when a sub-test fails, then executes ECALL.
The cocotb testbench in test/ runs all 40 on the RTL and 12 on the gate-level netlist, using models of the
flash and PSRAM connected to the Pmod pins, plus a GPIO test (test/mmio/gpio.S).
Pins
| Pin | Function |
|---|---|
uo_out[0] |
init_done: PSRAM initialisation finished |
uo_out[1] |
Reserved (0) |
uo_out[2] |
ibus_req: instruction fetch in progress |
uo_out[3] |
dbus_req: load/store in progress |
uo_out[7:4] |
GPIO outputs (register at 0x0800_0000, reset to 0) |
ui_in[7:0] |
GPIO inputs (read at 0x0800_0004), e.g. the demo board switches |
Tiny Tapeout QSPI Pmod on the bidirectional Pmod header: W25Q128JV flash (16 MB, quad enable set at the factory) and two APS6404L PSRAMs (8 MB each), wired as below.
uio pin |
Signal |
|---|---|
uio[0] |
CS flash |
uio[1] |
SD0 / MOSI |
uio[2] |
SD1 / MISO |
uio[3] |
SCK |
uio[4] |
SD2 |
uio[5] |
SD3 |
uio[6] |
CS PSRAM A |
uio[7] |
CS PSRAM B |
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | GPIO_IN0 | init_done | CS_FLASH |
| 1 | GPIO_IN1 | SD0 | |
| 2 | GPIO_IN2 | ibus_req | SD1 |
| 3 | GPIO_IN3 | dbus_req | SCK |
| 4 | GPIO_IN4 | GPIO_OUT0 | SD2 |
| 5 | GPIO_IN5 | GPIO_OUT1 | SD3 |
| 6 | GPIO_IN6 | GPIO_OUT2 | CS_RAM_A |
| 7 | GPIO_IN7 | GPIO_OUT3 | CS_RAM_B |