GithubHelp home page GithubHelp logo

dariiik / mips-simulator Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 580 KB

A simple MIPS Simulator that can simulate execution in MIPS for a small subset of instructions.

Python 95.48% Assembly 3.29% Shell 1.23%

mips-simulator's Introduction

CSE261 Project 1: MIPS Simulator

More details are in handout

Instructions

There are three functions you need to implement, located in the following two files: parse.py, run.py

1. parse.py

Implement the following parsing functions.

def parse_instr(buffer, index)
def parse_data(buffer, index)

The parse_instr() function is called for every instruction in the input file, and converts them into the instruction type. The instruction type is defined in util.py

The parse_data() function is called for every data field in the input file, and you need to fill the data into the simulated memory. Use the mem_read and mem_write as mentioned in the Hints section below.

There is a helper function you can use to convert binary strings to int variables:

def fromBinary(bits)

2. run.py

Implement the following function:

def process_instruction()

The process_instruction() function is used by the cycle() instruction to execute the instruction at the current PC. Your internal register/memory state should be changed according to the instruction that is pointed to by the current PC.

Hints

  • Always use the mem_read(), mem_write() functions when trying to read or write from the simulated memory. This includes your implementation of the load/store functions, but also when you are loading data region to the simulated memory.
  • You may generate input files of very simple instructions to check the functionality of your simulator. For example, add $1, $1, 5. Then you can check if the R1 of your simulator has been incremented by 5, etc..

mips-simulator's People

Contributors

dariiik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.