Skip to content
RISC-V CPU with 5-stage pipeline, implemented in Verilog HDL.
Verilog C++ VHDL Assembly Python Makefile Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Update project report & readme Jan 12, 2018
src Update project report Jan 12, 2018
test Update project report Jan 12, 2018
.gitignore Add project report Jan 11, 2018 Update project report & readme Jan 12, 2018


Zhou Fan (范舟)

This project is a RISC-V CPU with 5-stage pipeline implemented in Verilog HDL, which is a course project of Computer Architecture, ACM Class @ SJTU.



Feature RISC-V CPU
ISA RISC-V (RV32I subset)
Pipelining 5 stages
Data forwarding
Cache N-way set associate I-cache and D-cache [1]
UART module passed simulation [2]
Security perfect proof against Meltdown and Spectre attack [3]
  • [1] The cache is based on Zhekai Zhang's code
  • [2] UART module has not passed test on FPGA yet for the limited time. I re-designed part of CPU code to avoid hidden danger on FPGA, and it may need some more debugging.
  • [3] Just kidding ;-) That's because the CPU is not with branch prediction or out-of-order execution.

This CPU project has a five stage pipeline with data forwarding. In the picture below, red paths show stall control flow, while orange ones show data forwarding path. cpu-pipeline-graph

For program test on FPGA without capable memory, this CPU uses UART protocol to communicate with PC, where runs a memory simulator. uart-simulate-memory


This CPU is simulated with UART communication module in Xilinx vivado. test-bench-wave


Implementation on Basys3 FPGA, using Xilinx vivado. implementation-graph Scematic Overview implementation-circuit-overview CPU Module Scematic implementation-circuit-cpu


You can’t perform that action at this time.