A 32-bit RISC-V CPU rebuilt from single-cycle to a fully pipelined 5-stage datapath in Verilog HDL, with hazard-safe forwarding and stalling.
This project takes a working single-cycle RISC-V processor and re-architects it into a pipelined design capable of executing multiple instructions concurrently. The goal wasn't just 'make it faster' — it was to prove the pipeline is functionally identical to the single-cycle baseline under every hazard condition, verified cycle-by-cycle in simulation.
A modular datapath — ALU, register file, instruction/data memory, shifter, sign extender and control unit — connected through four dedicated pipeline registers (IF/ID, ID/EX, EX/MEM, MEM/WB), with control signals redesigned to propagate correctly across every stage boundary.
Redesigning control-signal timing for a pipeline is easy to get functionally 'close' but subtly wrong — signals can arrive at the correct value but the wrong cycle.
Verified every control signal against cycle-accurate waveforms rather than trusting final register values alone.
Data hazards from back-to-back dependent instructions could silently corrupt results if forwarding paths missed a case.
Built targeted diagnostic assembly programs specifically to trigger every hazard class, not just general-purpose test code.
The pipelined design executes multiple instructions concurrently while remaining functionally identical to the single-cycle baseline across every tested hazard scenario, demonstrating a measurable throughput improvement from instruction-level parallelism.