This project implements a simplified 32-bit single-cycle MIPS processor using Verilog HDL. The design demonstrates core concepts of computer organization and architecture, including instruction fetch, decode, execute, and write-back within a single clock cycle. The processor is intentionally simplified to focus on datapath design, control logic, and RTL-level understanding of CPU operation.
The objectives of this project are:
- Design a functional single-cycle MIPS processor using Verilog HDL
- Implement the complete instruction execution cycle
- Perform arithmetic and logical operations using a modular ALU
- Understand interaction between control unit, register file, and datapath
- Verify processor functionality through simulation and testbench
The processor supports the following MIPS-style operations:
- ADD: Adds the contents of registers R0 and R1
- SUB: Subtracts R1 from R0
- AND: Performs bitwise AND between R0 and R1
All results are written back to the ACC (Accumulator) register.
The processor follows a single-cycle architecture, meaning each instruction is completed in one clock cycle. The datapath includes instruction fetch, decode, execution, and write-back.
-
Program Counter (PC) Maintains the address of the current instruction and increments to fetch the next instruction.
-
Instruction Memory Stores up to 256 instructions and outputs the instruction based on the program counter.
-
Instruction Decoder Extracts opcode and operand fields from the fetched instruction.
-
Control Unit Decodes the opcode and generates control signals such as ALU operation select and register write enable.
-
Register File Contains three 32-bit registers:
- R0 and R1: General-purpose registers
- ACC: Accumulator register used for write-back
-
Arithmetic Logic Unit (ALU) Executes ADD, SUB, and AND operations based on a 3-bit control signal.
-
Data Memory Stores data and computation results with word-aligned addressing.
-
Testbench Simulates processor execution, initializes registers, controls the program counter, and verifies correct behavior using waveform analysis.
- Instruction is fetched from instruction memory using the program counter
- Opcode is decoded by the control unit
- Operands are read from R0 and R1 in the register file
- ALU performs the selected operation
- Result is written back to the ACC register
- Verilog HDL
- ModelSim / Icarus Verilog
- MARS MIPS Simulator (for instruction reference)
- GTKWave (for waveform analysis)
The processor is verified using a dedicated testbench that:
- Initializes register values
- Forces program counter values for instruction testing
- Executes ADD, SUB, and AND instructions
- Observes outputs using waveform dumps
Waveform analysis confirms correct instruction execution and data flow.
This implementation is a simplified educational model and does not include:
- Branch or jump instructions
- Immediate operands
- Pipeline stages
- Hazard detection or forwarding
Possible future improvements include:
- Adding more MIPS instructions
- Supporting branching and memory operations
- Implementing pipelining
- Expanding the register file
- Improving instruction decoding logic
Muzamil Rehman
Computer Organization and Assembly Language (COAL)
