Skip to content

vlsienthusiast00x/rv32imc-pipelined-cpu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RV32IMC Pipelined CPU

This repository contains a custom implementation of a pipelined CPU based on the RISC-V RV32IMC instruction set architecture. The design leverages pipelining to achieve higher instruction throughput and efficient hardware utilization.

Features

  • RV32IMC Support: Implements the full 32-bit base integer instruction set (RV32I), plus multiplication and division extensions (M), and compressed instruction extension (C).
  • 5-Stage Pipeline: Fetch, Decode, Execute, Memory, and Write-back stages for efficient instruction processing.
  • Hazard Handling: Includes basic mechanisms for data forwarding and pipeline stalling to resolve data and control hazards.
  • Memory Interface: Supports interaction with instruction and data memory modules.
  • Testbench: Reference testbench for simulation and validation.

Block diagram

Screenshot (19)

Directory Structure

├── rtl

├── docs

├── assembly-tests

├── README.md

├── LICENSE

Getting Started

Prerequisites

  • Verilog/SystemVerilog simulator (e.g., Icarus Verilog, ModelSim, or Vivado)
  • RISC-V toolchain for generating machine code

Running Simulations

  1. Clone the repository:
    git clone https://github.com/vlsienthusiast00x/rv32imc-pipelined-cpu.git
    cd rv32imc-pipelined-cpu
  2. Compile the source code
    cd rtl
    make all
  3. Run the simulation and inspect the waveform/logs for correct behavior.
    vvp rv32imc.vvp
  4. Change the code in instr.S file for testing different operations

Click Here for some sample test assembly codes

File Overview

  • rtl/: Contains the main CPU pipeline design, ALU, register file, control logic, and memory interface.
  • docs/: Includes architecture diagrams, pipeline stage explanations, and performance analysis.
  • assembly-tests/: Provides some sample ready-to-compile assembly codes, that completely proves each instruction of this CPU.

Documentation

See the docs folder for:

  • Pipeline architecture overview
  • Block/Architectural diagram
  • Hazard detection and forwarding logic
  • Example instruction flows
  • RISC-V GNU toolchain installation

Contributing

Feel free to open issues, suggest improvements, or submit pull requests for bug fixes and enhancements.

License

This project is licensed under the MIT License.

Author

Created by vlsienthusiast00x