Giter Site home page Giter Site logo

ml-simulation-learning's Introduction

Original Version by daniel4lee

https://github.com/daniel4lee/MIPS-Pipeline-Simulator

MIPS-Pipeline-Simulator

This program implement the simple MIPS pipeline, including the following instructions "lw", "sw", "add", "addi", "sub", "and", "andi", "or", "slt", "bne". In addition to the instructions, it also support detecting and dealing with "data hazard", "hazard with load", and "branch hazard". Data forwarding has been removed in this version to intentionally cause data hazards which cause delays. The point of this code is to research and experiment with the causes of delays, so hazards are actually desired and important.

Note that in this version, there are some niche issues involving "bne" and tracking the cycles that instructions get written back on. Programs using "bne" will not always be simulated perfectly. However, these issues appear to be confined to instances of "bne" being used in very strange ways and normal programming should not be affected much, if at all. Also note that "sub" has been coded to take 3 cycles in the execute stage of the pipeline, as an example of coding an instruction to take more than 1 cycle to execute.

Initialize

There are ten registers, and their initial values are as below: list_register

The memory initial value is as below:
list_memory

Instruction memory starts from 0.

Input

The program will read the the input.txt file from the same root, the content of the file being the 32 bit machine codes. The format should look like below.

10001101000000010000000000000011  
00000000000000100001100000100000  
00010000000000100000000000000110

The corresponding MIPS instructions is:

lw $1, 0x03($8)  
add $3, $0, $2  
beq $0, $2, 0x06 #(branch PC+4+4ร—6)   

Output

Originally, after executing the program, it would simulate every pipeline register's value on each clock cycle and save the record as a .txt file named Result. This output has been replaced (the code is simply commented out should a user want it for debugging or other purposes; the register values are still simulated). Now it outputs the following data for each instruction: Cycle Fetched,Cycle Written Back,OP Code,Destination Register,Source Register1,Source Register2,isStore,isLoad,isBranch,Total Execution Time (Cycle Written Back - Cycle Fetched + 1) in that format, with -1s denoting a value is not applicable for the instruction (0 is false, 1 is true). An example is included in Result.txt on this page.

The content description (old version):

format

ml-simulation-learning's People

Contributors

christianoconnell 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.