A clean and functional single-cycle RISC-V (RV32I) processor implemented in SystemVerilog, supporting arithmetic, memory, control flow, and CSR-based exception handling.
This project is intended for academic labs, processor design courses, and viva demonstrations.
- RV32I base instruction set
- Single-cycle datapath
- Register file with asynchronous read
- ALU supporting arithmetic, logic, and shift operations
- Load / Store memory support
- Branch and Jump control (BEQ, BNE, JAL, JALR)
- CSR support (mstatus, mie, mtvec, mepc, mcause)
- Exception handling and
mret - Modular and readable SystemVerilog design
- Ready-to-run testbench with waveform generation
controller.sv
csr_register.sv
csr_mem
data_mem.sv
imm_gen.sv
inst_dec.sv
inst_mem.sv
instruction_memory
mux.sv
pc.sv
processor.sv
reg_files.sv
register_file
tb_processor.sv
alu.sv
README.md
git clone https://github.com/Tehseen-Ajmal/RISC-V-SingleCycle.git
cd /RISC-V-SingleCycle
vlog -sv *.sv
vsim -c tb_processor -voptargs=+acc -do "run -all; quit"
gtkwave processor.vcd
processor.vcdis generated automatically by the testbench.
Instructions are loaded using $readmemb.
Each line must contain one 32-bit binary instruction:
00000000010100000000000100010011
00000000101000000000001000010011
Loaded in testbench as:
$readmemb("instruction_memory", dut.imem_inst.mem);
- Generates clock and reset
- Loads instruction memory and register file
- Verifies load/store operations
- Prints PASS / FAIL messages
- Dumps waveform file (
processor.vcd) for debugging
- Single-cycle implementation (no pipelining)
- Word-addressed instruction memory
- Byte-addressed data memory
- Clean PC priority: Exception → Branch/Jump → PC+4
- Designed for clarity and academic evaluation
Tehseen Ajmal
Computer Engineering
RISC-V | Digital Design | SystemVerilog
This project is suitable for:
- Processor design labs
- Academic demonstrations and viva
- Learning RISC-V datapath and control logic
If you find this useful, consider starring the repository ⭐