32-bit single-cycle RISC-V processor implementation in Verilog with RV32I instruction support and FPGA validation.
Implementation of a 32-bit single-cycle RISC-V processor using Verilog HDL and simulated in Vivado.
This project implements a subset of the RV32I RISC-V instruction set architecture using a single-cycle datapath design.
The processor supports:
- Arithmetic operations
- Logical operations
- Memory access instructions
- Branch instructions
- Jump instructions
- Stack operations
- Function calls and returns
Each instruction completes in a single clock cycle.
The processor follows a single-cycle datapath architecture where instruction fetch, decode, execute, memory access, and write-back occur within one clock cycle.
- Program Counter (PC)
- Instruction Memory
- Control Unit
- Register File
- Immediate Generator
- ALU
- ALU Control
- Data Memory
- Branch Logic
- Write-back Multiplexer
- ADD
- SUB
- ADDI
- AND
- OR
- XOR
- SLT
- SLL
- SRL
- LW
- SW
- BEQ
- JAL
- JALR
- Program Counter fetches instruction address
- Instruction Memory provides instruction
- Instruction Decoder extracts opcode and fields
- Control Unit generates control signals
- Register File reads operands
- ALU performs arithmetic or logical operation
- Data Memory handles load/store instructions
- Write-back logic updates registers
- PC logic determines next instruction flow
The processor was validated using multiple levels of testing.
Tested:
- ADDI
- ADD
- LW
- SW
Verified:
- Register updates
- ALU output
- Memory read/write operations
Tested:
- Multiple ALU operations
- Branch instructions
- Comparison logic
Verified:
- Branch handling
- ALU control logic
- Instruction execution flow
Tested:
- JAL
- JALR
- Stack push/pop
- Nested loops
- Function calls
Verified:
- PC redirection
- Stack operations
- Function return logic
Waveform simulations were analyzed in Vivado to verify:
- Program Counter updates
- Instruction execution
- ALU results
- Branch behavior
- Write-back operations
- Memory access signals
Important signals monitored include:
pcinstructionalu_resultbranch_takenwrite_back_datamem_read_data
Every instruction completes in one clock cycle, simplifying datapath and control logic design.
- Control Unit performs opcode decoding
- ALU Control determines exact ALU operation using
funct3andfunct7
Instruction memory is indexed using:
mem[addr[31:2]]since RISC-V instructions are 32-bit aligned.
- Verilog HDL
- Vivado
- Spartan-7 FPGA
This project was developed through self-learning, FPGA experimentation, waveform debugging, technical documentation, and AI-assisted development workflows.
Helpful references used during development include:
-
RealDigital FPGA Documentation
https://www.realdigital.org/doc/02013cd17602c8af749f00561f88ae21 -
Digilent FPGA Tutorials
https://digilent.com/reference/learn/programmable-logic/start
Additional support tools:
- ChatGPT
- GitHub Copilot
- Vivado Simulation & Waveform Analysis
- Register
x0is hardwired to zero as defined in the RISC-V ISA. - The processor uses a single-cycle datapath architecture.
- Stack operations use register
x2as the stack pointer.
- Pipelined architecture
- Hazard detection
- Data forwarding
- Cache memory
- UART debugging
- FPGA hardware deployment
Gilbert Franco C
Jefin Jaison
Jefin jans
George Sleeba
ECE Student | FPGA & Embedded Systems Enthusiast