All Projects → yxwangcs → MIPS-CPU

yxwangcs / MIPS-CPU

Licence: MIT License
A Simulative MIPS CPU running on Logisim.

Programming Languages

assembly
5116 projects

Projects that are alternatives of or similar to MIPS-CPU

logisim-7-segment-display-driver
➿ TTL-7447-like implementation for logisim
Stars: ✭ 28 (-48.15%)
Mutual labels:  circuit, logisim
antares
Digital circuit learning platform
Stars: ✭ 15 (-72.22%)
Mutual labels:  circuit
PIM NDP papers
No description or website provided.
Stars: ✭ 33 (-38.89%)
Mutual labels:  circuit
OpenCircuits
A free, open source, online digital circuit/logic designer.
Stars: ✭ 140 (+159.26%)
Mutual labels:  circuit
maxwell
Maxwell Circuit Simulator
Stars: ✭ 27 (-50%)
Mutual labels:  circuit
open-electronics
📚 💻 Great Resources for Electronics Enthusiasts
Stars: ✭ 347 (+542.59%)
Mutual labels:  circuit
Game-Boy-Color-USB-C-charging-kit
This project contains the files for making an electronic board that allows to charge a Nintendo Game Boy Color by USB-C.
Stars: ✭ 31 (-42.59%)
Mutual labels:  circuit
SpiceSharp
Spice# is a cross-platform electronic circuit simulator based on Berkeley Spice - the mother of commercial industry-standard circuit simulators.
Stars: ✭ 146 (+170.37%)
Mutual labels:  circuit
spydrnet
A flexible framework for analyzing and transforming FPGA netlists. Official repository.
Stars: ✭ 49 (-9.26%)
Mutual labels:  circuit
AAG-Visualizer
🌆 🏙 🌃 Viz.js Graphviz - An Elegant Visualizer for And-Inverter Graph
Stars: ✭ 95 (+75.93%)
Mutual labels:  circuit
computer-organization-lab
中山大学计算机组成原理实验 (2018 秋):用 Verilog 设计并实现的简易单周期和多周期 CPU
Stars: ✭ 45 (-16.67%)
Mutual labels:  mips-cpu
diy-BMS-with-Arduino-Nano
If you have a private powerwall of 18650 cells, this is the battery management system you need. The small PCB is equipped with the cheap Arduino Nano.
Stars: ✭ 33 (-38.89%)
Mutual labels:  circuit
MNA-MAT
An easy-to-use MATLAB tool for SPICE netlist simulation
Stars: ✭ 46 (-14.81%)
Mutual labels:  circuit
HAGIWOs Module
eurorack modular synthesizers projects using Arduino.
Stars: ✭ 76 (+40.74%)
Mutual labels:  circuit
RISC-V-Single-Cycle-CPU
A RISC-V 32bit single-cycle CPU written in Logisim
Stars: ✭ 281 (+420.37%)
Mutual labels:  logisim

MIPS-CPU

A Simulative CPU Running on MIPS Instruction System Based on Logisim (Newer version Logisim Evolution is not supported).

MIPS-CPU-GIF

Two categories of CPU are implemented in this repository for learning purposes:

Supported Instructions

Only a subet of the MIPS instruction set is supported:

Instruction Format Instruction Format
Add add $rd, $rs, $rt Store Word sw $rt, offset($rs)
Add Immediate addi $rt, $rs, immediate Branch on Equal beq $rs, $rt, label
Add Immediate Unsigned addiu $rt, $rs, immediate Branch on Not Equal bne $rs, $rt, label
Add Unsigned addu $rd, $rs, $rt Set Less Than slt $rd, $rs, $rt
And and $rd, $rs, $rt Set Less Than Immediate slti $rt, $rs, immediate
And Immediate andi $rt, $rs, immediate Set Less Than Unsigned sltu $rd, $rs, $rt
Shift Left Logical sll $rd, $rt, shamt Jump j label
Shift Right Arithmetic sra $rd, $rt, shamt Jump and Link jal label
Shift Right Logical srl $rd, $rt, shamt Jump Register jr $rs
Sub sub $rd, $rs, $rt Syscall(Display or Exit) syscall
Or or $rd, $rs, $rt Move From Co-processor 0 mfc0 $t0,$12
Or Immediate ori $rt, $rs, immediate Move To Co-processor 0 mtc0 $t0,$12
Nor nor $rd, $rs, $rt Exception Return eret
Load Word lw $rt, offset($rs)

Refer to Quick Reference and Complete Instruction Manual for complete specifications.

Single Cycle CPU

Organized according to the circuit given by MIPS X-Ray of Mars for better understanding.

Overview

singlecyclecpu

Pipeline CPU (Pipeline Bubbling)

Used Pipeline Bubbling to prevent data and control hazard.

Overview

pipeline_bubble

Pipeline CPU (Bubbling + Operand Forwarding)

Operand Forwarding is used instead of Bubbling to prevent data hazard, which runs less cycles when data hazards occur.

Moreover, this version of pipeline CPU is equipped with a CP0 which handles exception (interruption), with 3 intteruption source buttons named ExpSrc0 ExpSrc1 ExpSrc2

The CPU runs into exception mode on clicking one of the buttons, running an exception service program which displays 2 or 4 or 8 determined by the source number of the clicked button.

The exception service program handles saving environments (including saving PC value to EPC), and supports multi-level interruption by saving everything to a stack in RAM for each level of interruption. This program has to be loaded into the second ROM (with start address 0x00000800) in the CPU, which is the special address reserved for the service program. Upon exception, PC will be set to 0x00000800 to run the service program.

Overview

pipeline

Benchmarks

There are various programs for testing the CPU in the Benchmarks folder, with a combined final benchmark named Benchmark.hex.

All the benchmarks are assembled by Mars, a powerful MIPS assembling and debugging tool.

General Components

ALU Circuit

This ALU is implememted to do 13 operations determined by operator S, with two input X/Y, it can produce result according to the operator S and emit signed and unsigned overflow/Equal signals. The detailed circuit diagram is as below:

Overview

alu_1

Adder Circuit with Overflow Detection

alu_2

Register File

This regfile is implemented to simulate the 32 registers running in the MIPS CPU, with the signals passed to it, it can store data into register according to the given register number, and it can directly load up to two register's data to the port.

Overview

regfile

References

[1] Harris, David, and Sarah Harris. Digital design and computer architecture. Morgan Kaufmann, 2010.

[2] MIPS Quick Reference

[3] MIPS® Architecture for Programmers Volume II-A: The MIPS32® Instruction Set Manual

License

MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].