Skip to content

Qasim2S/MIPS-CPU

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MIPS CPU

Overview

This project implements a simplified MIPS-style CPU core integrating the program counter, ALU, and register file in Verilog

Features

Program Counter

The program counter (PC) increments after each instruction, allowing the CPU to fetch the next instruction from memory.

Instruction types

The CPU supports two instruction formats:

R-Type

[31:26] opcode | [25:21] $s2 | [20:16] $s3 | [15:11] $s1 | [10:0] unused

I-Type

[31:26] opcode | [25:21] $s2 | [20:16] $s1 | [15:0] immediate

Register File

The CPU contains a 32-bit register file used to store and retrieve data during instruction execution.

Instruction set

Supported instructions include:

  • Addition, subtraction, and ADDI
  • Load and store
  • AND, OR, and NOR
  • BEQ and BNE (branch if equal and branch if not equal)
  • SLT ($s1 = ($s2 < $s3) ? 1 : 0)
  • EOF (program termination)

FSM

The CPU operates using a finite state machine (FSM) consisting of the following states:

  1. Fetch
  2. Decode
  3. Execute
  4. Memory Access
  5. Writeback

The FSM continuously cycles through these states until the termination instruction is encountered. When the termination bit is asserted, the next state is forced to the termination state.

Only load and store instructions require the Memory Access stage. All other instructions transition directly from Execute to Writeback.

The ALU is enabled during the Execute stage to perform arithmetic and logical operations. During the Memory Access stage, memory write operations are enabled for store instructions.

During the Writeback stage, the result of the operation is written to the register file, and the program counter is updated.

Status Output

There is a 2 bit output status which will return:

  • 0 for a successful R type instruction
  • 1 for a successful I type instruction
  • 2 for an overflow detection
  • 3 for program termination

A 2-bit status output indicates the result of instruction execution:

  • 0 – Successful R-type instruction
  • 1 – Successful I-type instruction
  • 2 – Overflow detected
  • 3 – Program termination

Block Diagram

Block Diagram of the MIPS CPU

Timing Results

The final design meets timing requirements:

Metric Value
Required Time 733.85 ps
Arrival Time 733.33 ps
Slack 0.52 ps

Timing Status: MET

Power Results

Metric Value
Total Power 2.18 mW

Area Results

The final physical implementation consists of approximately 5,934 standard-cell instances with a total synthesized area of 813.097 μm².

Metric Value
Number of Ports 847
Number of Nets 6,592
Number of Cells 5,934
Number of Combinational Cells 4,752
Number of Sequential Cells 1,175
Number of Macros / Black Boxes 0
Number of Buffers/Inverters 896
Number of References 45
Area Metric Value (μm²)
Combinational Area 367.678
Buffer/Invoker Area 39.468
Sequential Area 445.419
Macro/Black Box Area 0.000
Total Cell Area 813.097

Tools Used

  • Verilog HDL
  • Synopsys Verdi
  • Cadence Innovus

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors