Course project · Digital design

RISC-V Single-Cycle CPU Design

A 32-bit RV32I processor in Verilog, from datapath to control unit, verified through simulation.

Role
Designer
When
Exchange year, 2023 – 2024
Where
Tongji University, Shanghai
RISC-V Single-Cycle CPU
32-bitRISC-V core
1clock cycle per instruction
RV32Ibase integer instruction set

How it works

  1. 01

    Fetch

    The program counter addresses instruction memory.

  2. 02

    Decode

    Main decoder and instruction decoder generate the control signals.

  3. 03

    Execute

    The ALU runs arithmetic, logic and branch comparisons.

  4. 04

    Memory

    Load and store through the data memory.

  5. 05

    Write-back

    Results go back to the register file in the same cycle.

Overview

The goal was a fully working processor for the RV32I base instruction set, written in Verilog, with datapath and control designed together so that every instruction executes correctly within its timing.

Single-cycle datapath and control overview.
Single-cycle datapath and control overview.

Architecture

In a single-cycle design every instruction completes in one clock cycle. The core includes the Program Counter, ALU, Register File, Instruction and Data Memory, an immediate extender, and a control unit split into a main decoder and an instruction (ALU) decoder. The control signals configure the datapath for arithmetic, memory and branch operations.

Verification

A top-level testbench drives the core, and the results were checked with waveform analysis in GTKWave across all instruction types, confirming correct execution.

This core was also the foundation for the HDMI character display built on a full RISC-V SoC.

Tools & techniques

  • Verilog
  • RISC-V
  • RV32I
  • GTKWave
  • Digital design