A Verilog-based MIPS CPU implementation developed as a digital system design project.
This repository contains both multi-cycle and pipelined MIPS CPU designs, together with reference models, program memory files, and Vivado project files for simulation and FPGA-oriented development.
This project explores the design and implementation of a simplified MIPS processor using Verilog HDL. The main goal is to understand how a processor executes instructions at the hardware level, including:
- Instruction fetch
- Instruction decode
- Execution
- Memory access
- Write-back
The repository includes:
- Multi-cycle MIPS CPU implementation
- Pipelined MIPS CPU implementation
- Pipeline reference model
- Program memory file for instruction testing
- Vivado project files for simulation, synthesis, and FPGA development workflow
MIPS_CPU/
├── VerilogFiles/
│ ├── Multi_Cycle/ # Multi-cycle MIPS CPU implementation
│ ├── Pipeline/ # Pipelined MIPS CPU implementation
│ ├── PipelineReferenceModel/ # Reference model for pipeline behaviour
│ └── prog.mem # Program memory file for simulation/testing
├── MIPS_CPU.srcs/ # Vivado source files
├── MIPS_CPU.sim/ # Vivado simulation files
├── MIPS_CPU.runs/ # Vivado synthesis/implementation runs
├── MIPS_CPU.hw/ # Hardware-related Vivado files
├── MIPS_CPU.xpr # Vivado project file
└── Draftmisp.drawio # CPU architecture/design diagram
The multi-cycle implementation divides instruction execution into several clock cycles. This design demonstrates how different CPU stages can share hardware resources over time.
Typical stages include:
- Instruction Fetch
- Instruction Decode
- Execute
- Memory Access
- Write Back
This structure is useful for understanding CPU control logic, datapath sequencing, and instruction-level execution.
The pipelined implementation improves instruction throughput by overlapping different stages of multiple instructions. This design demonstrates how modern processors improve performance by processing several instructions at the same time.
Typical pipeline stages include:
- IF — Instruction Fetch
- ID — Instruction Decode
- EX — Execute
- MEM — Memory Access
- WB — Write Back
This part of the project focuses on:
- Pipeline datapath design
- Pipeline stage registers
- Control signal propagation
- Instruction flow through the processor
- Waveform-based debugging and verification
The prog.mem file is used to store test instructions for CPU simulation. It allows the CPU to fetch and execute predefined instructions during behavioural simulation.
- Verilog HDL
- Xilinx Vivado
- XSIM / Vivado Simulator
- FPGA digital design workflow
- Draw.io for architecture diagrams
Through this project, I gained practical experience in:
- Designing CPU datapaths in Verilog
- Implementing instruction fetch, decode, execute, memory, and write-back logic
- Understanding the difference between multi-cycle and pipelined CPU architectures
- Building and simulating processor control logic
- Using Vivado for HDL simulation and hardware project management
- Debugging CPU behaviour through waveform analysis
- Understanding how hardware-level control signals coordinate instruction execution
Clone the repository:
git clone https://github.com/TonnyChenProgramming/MIPS_CPU.gitOpen the Vivado project file:
MIPS_CPU.xpr
Then run behavioural simulation in Vivado to inspect CPU execution and waveform behaviour.
- Open the project in Vivado.
- Check that the Verilog source files are correctly included.
- Load or verify
prog.memfor instruction memory content. - Run behavioural simulation.
- Inspect waveforms for:
- Program counter updates
- Instruction fetch
- Register file read/write operations
- ALU operations
- Memory access
- Write-back behaviour
- Pipeline stage behaviour, if using the pipelined CPU
This project is intended for learning and demonstrating computer architecture concepts through hardware implementation. It focuses on processor datapath design, control logic, simulation, and FPGA-oriented development rather than building a fully commercial MIPS-compatible processor.