GitHub: https://github.com/potats0/gw2a-riscv-linux-soc
I got a full RISC-V Linux 6.6 SoC running on a low-cost Gowin GW2A-LV18 (20K LUT) FPGA board (Lichuang LogicPi FPGA-G1), booting to a persistent ext4 rootfs and SSH shell over a single USB Type-C cable (power + networking, debugger unplugged).
To be completely upfront: Gemini did a lot of the work for me on this project. I have no prior hardware or Verilog background, and
Gemini wrote most of the SoC RTL, the pure-Verilog USB 1.1 PHY and CDC-ECM virtual NIC, the Linux kernel drivers, timing constraints, and build scripts. My job was setting the goals, wiring and flashing the board, running real-hardware tests, and iterating through bugs together until it ran stably on physical silicon.
RISC-V & SoC Architecture:
- -CPU Core: VexRiscv RV32IMA + Sv32 MMU + zicntr hardware rdtime @ 60 MHz (actual Fmax 71.22 MHz, 0 ns TNS)
- L1 Caches: 8 KiB 2-way VIPT I-Cache + 8 KiB 2-way VIPT D-Cache (64B lines, 16-word Wishbone bursts)
- Boot & Interrupts: Custom RV32 BootROM -> OpenSBI v1.5.1 -> Linux 6.6.63, standard CLINT (1 MHz mtime) and PLIC (7 IRQ sources)
- Memory & Storage: 256 MiB DDR3 (using Gowin's DDR3 IP), 8 MiB W25Q64 SPI Flash, persistent ext4 rootfs on MicroSD via an onboard GD32F303 4 KiB batched SPI bridge
- Single-Cable USB NIC: Pure-Verilog USB 1.1 Full-Speed soft PHY (48 MHz 4x oversampling DPLL, NRZI, bit-stuffing) + hardware
auto-enumerating CDC-ECM Ethernet controller over just 3 regular GPIO pins (D+, D-, 1.5k pull-up), recognized driverlessly on Linux/macOS via mainline cdc_ether
Real-Hardware Results:
- Cold boot to persistent ext4 shell: 7.49 s (Run /init at 5.24 s)
- USB Virtual NIC: ~4.18 ms ping RTT, 0% packet loss, Dropbear 2024.86 SSH/SCP (Ed25519)
- DDR3 + Cache stress test: >100 MiB continuous random MD5 verification, 0 bit flips, 0 kernel warnings
- GW2A-LV18 Utilization: 51% LUT (10,548 / 20,736), 45% FF (7,195 / 16,173), 37 / 46 BSRAM (81%), 4 / 24 DSP, 3 / 4 rPLL
Everything except the Gowin DDR3 memory controller IP is open source (MIT for RTL/firmware/scripts, GPL-2.0 for the Linux drivers), including Verilator testbenches for both the SoC and the USB CDC-ECM unit.
With ~49% of the LUTs, 9 BSRAMs, and 1 rPLL still free, I'm considering trying dual-core SMP Linux (VexRiscvLitexSmpCluster_Cc2 with 4K+4K caches) next. Feedback, critiques, or RTL tips are very welcome!