# RS5 **RS5** is a parameterizable, 4-stage pipelined RISC-V processor written in SystemVerilog, developed at the [Hardware Design Support Group (GAPH)](https://nsesd.pucrs.br/), PUCRS, Brazil. [](riscof/README.md) [](proto/RS5) [](proto/RS5_SUME) [](https://www.linkedin.com/feed/update/urn:li:activity:7470952399667425280/) [](LICENSE) ## Table of Contents - [RS5](#rs5) - [Table of Contents](#table-of-contents) - [Feature overview](#feature-overview) - [Simulation Quick Start](#simulation-quick-start) - [Requirements](#requirements) - [Build the test application](#build-the-test-application) - [Simulate with Verilator](#simulate-with-verilator) - [Simulate with Modelsim/Questa](#simulate-with-modelsimquesta) - [Simulate with Xcelium](#simulate-with-xcelium) - [FPGA Prototyping](#fpga-prototyping) - [Prototyping steps](#prototyping-steps) - [Architectural compliance (RISCOF)](#architectural-compliance-riscof) - [Tutorials (in Portuguese)](#tutorials-in-portuguese) - [Cite this work](#cite-this-work) - [Acknowledgements](#acknowledgements) --- ## Feature overview | Feature | Details | |---|---| | Base ISA | RV32I | | Privilege modes | Machine mode (M-mode) and User mode (U-mode) | | Interrupt controller | optional [SiFive-compliant](https://github.com/riscv/riscv-plic-spec) [PLIC](rtl/plic.sv) | | Machine timer | optional [mtimer](rtl/rtc.sv) | | Extension type | Available extensions | |---|---| | Integer extensions | Zicond; Zicsr (always enabled); Zihpm | | Multiply/divide extensions | M or Zmmul (multiply subset) | | Atomic extensions | A, Zalrsc (conditional subset), or Zaamo (AMO subset) | | Compressed extensions | C and Zcb (additional compressed) | | Cryptography | Zkne (AES), Zbkb (bit-manip), Zknh (SHA2), Xkyber(Kyber) | | Vector extension | Zve32x and Zvl64b subsets (configurable VLEN, LLEN) | | Non-standard | Xosvm (offset and size virtual memory support) | | Parameter | Details | |---|---| | Branch prediction | Optional static branch prediction for immediate branches at decode stage | | Data forwarding | Optional forwarding from execution result or memory read. Register writeback is always forwarded. | | Instruction buffering | Optionally fetches while pipeline is stalled | Optional features are configurable through parameters in [rtl/RS5.sv](rtl/RS5.sv). See [docs/README.md](docs/README.md) for details on the core implementation, parameters and extensions. --- ## Simulation Quick Start ### Requirements It is possible to evaluate RS5 using only open source tools: - [Verilator](https://verilator.org) - [RISC-V toolchain](https://github.com/gaph-pucrs/Memphis-V/blob/master/docs/riscv.md) RS5 also supports simulation with the following commercial tools: - Modelsim/Questa - Xcelium ### Build the test application The default test application is a set of tests from the [riscv-arch-test](https://github.com/riscv/riscv-arch-test). You need to build the application before running the simulation: ```bash make -C app/riscv-tests ``` ### Simulate with Verilator This verilates and runs the default application. Results are written to `sim/results/Output.txt` (simulation output) and `sim/results/Report.txt` (profiling). ```bash make -C sim ``` ### Simulate with Modelsim/Questa ```bash cd sim vsim -c -do sim.do ``` ### Simulate with Xcelium ```bash cd sim xrun -f sim.xrun ``` --- ## FPGA Prototyping The [proto/](proto/) folder provides projects for prototyping targeting the **Nexys A7** and the **NetFPGA SUME** boards. The FPGA environment contains peripherals and a BRAM. Peripherals include a UART, real-time clock, PLIC, and a mapped button interrupt.