Skip to content

CPU Simulator written in C++ designed to read and execute binaries compiled for the MIPS ISA

Notifications You must be signed in to change notification settings

adidesh20/MIPS-CPU-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIPS CPU Simulator

This CPU Simulator was created from scratch for the coursework section of the second year module Computer Architecture, which is a part of Electronic and Information Engineering at Imperial College London. The original specification for the project can be found here.

Overview

This C++ program takes as input binaries compliant with the MIPS ISA and runs them as if they were running on a MIPS CPU. This program could potentially allow a developer without access to a MIPS CPU to test if their compiled code would run on one.

This program simulates the 5 Stage MIPS execution cycle. After using the fstream library to read the binary and store the instructions in virtualised instruction memory, instructions are fetched from this memory with via accessing STL Vector elements and decoded using shifts. The instruction is then executed by the program. Data memory is virtualised using an STL Vector, as are CPU Registers. This allows for memory access and register write back. The size and location of memory is defined by the memory map specified in original-spec.md.

A testbench written in Bash Script is also included with example binaries.

How to run the program

Prequisites

  • Make
  • GCC/G++

Install

Clone the repository by either downloading the zip file using the Git GUI or using the command line:

git clone https://github.com/adidesh20/MIPS-CPU-Simulator.git

Then, from the top of the directory tree, run:

make simulator

Running a Binary

Assuming the presence of MIPS Binary filename.bin, from the top of the directory tree run:

bin/mips_simulator filename.bin

About

CPU Simulator written in C++ designed to read and execute binaries compiled for the MIPS ISA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published