MIPS_PIPELINE_SIMULATOR

It shows how the "MIPS 5-staged pipeline" works.




Contents

Summary

  • This program is made for showing how the "MIPS 5-staged pipeline" works.
  • Your assembly.s code will be converted to assembly.asm code and then executed.
  • You can see the process of execution in the data path of the window.
  • This program supports the following instructions
    • R-type
      • add, sub, and, or, slt
    • I-type
      • lw, sw, beq
    • J-type
      • j


Platform

  • Code Type:  ARM64
  • Platform:   macOS 12.6 (21G115)



Requirement

Raylib

Link to raylib (Github)

  • Checkout following link
  • You can find a few ways to install raylib

OSX

https://github.com/raysan5/raylib/wiki/Working-on-macOS

Linux

https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux


Spim

Link to spim (Sourceforge)

  • You need to install flex and bison before installing spim

OSX

$ brew install flex bison

Linux

$ sudo apt-get -y install flex bison




Install

$ make (all) [SIZE_FACTOR=size_factor]
  • SIZE_FACTOR: size factor of the window (default: 8.0)
    • Only 7, 8, and 9 are supported for  SIZE_FACTOR
    • If you want to resize the simulator, you have to execute
      • $ make re SIZE_FACTOR=other_value



How to run

Default

$ make run [INPUT_FILE="test.s"] [SIZE_FACTOR=size_factor]
  • Default  INPUT_FILE  is "test.s"
  • Rule "run" executes following two commands
    • cd ./libs/assembler/spim; ./spim -file ../../../test.s -dump; cd ../../../;
    • ./mips_pipeline_simulator ./libs/assembler/spim/text.asm ./libs/assembler/spim/data.asm
  • Using in manual is not recommended

For custom File

$ make run [INPUT_FILE="your_assembly_file.s"]
  •  INPUT_FILE  has to be ".s" file

Make support following commands

  • make (all) : compile program
  • make run : run program (includes make all)
  • make clean : remove all object files
  • make fclean : remove all object files and executable file
  • make re : recompile program


Usage

Keyboard Interaction

Key Action
Move camera to left
Move camera to right
Move camera to up
Move camera to down
i/o Zoom in / Zoom out
r Reset camera
d Open/Close User Data Segment Page
[/] (in Data Segment Page) Move to prev/next page
ESC ⎋ Exit program

Mouse Interaction

Mouse Action
Click "next_cycle" button Execute next cycle of pipeline




Result

MIPS-pipeline-simulator.mp4




Description of source code

In Markdown

Link to Youtube


Contact