Skip to content

Anish-Rooj-cpu/RV32IM-Single-Cycle-RISC-V-Processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RV32IM Single Cycle RISC-V Processor

This is a 32-bit Single-Cycle RISC-V Processor implementing the RV32IM Instruction Set Architecture.
This project was built as a learning experience to understand how a processor works internally. The design is kept simple, modular, and easy to understand, making it ideal for students and beginners exploring CPU architecture.

The processor supports the RV32I base instruction set along with the RV32M multiplication and division extension.


Features

  • RV32I Base ISA support
  • RV32M Multiply/Divide support
  • Single-cycle architecture
  • Modular Verilog design
  • Byte-addressable data memory
  • Branch and jump support
  • Load/store instructions
  • Signed and unsigned operations
  • Fully synthesizable RTL

Supported Instruction Set

RV32I Instructions

Arithmetic

  • ADD, SUB
  • ADDI
  • SLT, SLTU
  • SLTI, SLTIU

Logical

  • AND, OR, XOR
  • ANDI, ORI, XORI

Shift

  • SLL, SRL, SRA
  • SLLI, SRLI, SRAI

Memory

  • LW, LH, LB
  • LHU, LBU
  • SW, SH, SB

Branch

  • BEQ, BNE
  • BLT, BGE
  • BLTU, BGEU

Jump

  • JAL
  • JALR

Upper Immediate

  • LUI
  • AUIPC

RV32M Extension

  • MUL
  • MULH
  • MULHU
  • MULHSU
  • DIV
  • DIVU
  • REM
  • REMU

Processor Architecture

The processor consists of the following modules:

  • Program Counter
  • Instruction Memory
  • Register File (32 × 32-bit)
  • ALU (RV32IM supported)
  • ALU Control Unit
  • Main Control Unit
  • Sign Extend Unit
  • Data Memory
  • Branch Logic

All instructions execute in a single clock cycle.


Example Programs Tested

  • Arithmetic test program
  • Sorting algorithm (Bubble Sort)
  • Factorial computation
  • Convolution (DSP workload)
  • Branch stress test
  • Load/store memory test

Repository Structure

├── alu.v ├── aluControl.v ├── controlUnit.v ├── registerFile.v ├── programCounter.v ├── instructionMemory.v ├── dataMemory.v ├── signExtend.v ├── multiplier.v ├── divider.v ├── top.v └── testbench.sv

Future Improvements

  • Pipelined version
  • Hazard detection
  • Forwarding unit
  • RV32C support
  • CSR registers
  • Interrupt support
  • Cache memory

Author

Anish Rooj
Electronics & Telecommunication Engineering
Jadavpur University

LinkedIn:
www.linkedin.com/in/anish-rooj


License

This project is open-source and free to use for educational purposes.

About

Verilog implementation of RISCV 32IM Single Cycle Processor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors