infobank

@altafkhan.com

  >  >  >  articles on technology and business  >  >  >

Web This Site
home  | 

A Configurable MIPS Simulator

Muhammad Jahangir Ikram

© Muhammad Jahangir Ikram 2006
 
Summary

A simple and easy to use configurable simulator for studying the basic features of the MIPS processor. With a simple click one can bring stall detection hardware in the circuit, forwarding hardware, different branch policies including Always Flush, Delayed Branching, and Cancelled Branching with branch decision in different stages of the pipeline. The simulator has been used by university students in laboratory assignments. A library of simple programs and example experiments is also available. Extremely useful to go through some of the end problems in CA:AQA and COD:H/SI.
   
 

Getting Started

  • The basic requirement for this simulator to run is that you must have Visual BASIC 6.0 installed on your computer.
  • This software requires minimum 1024x768 screen resolution.
  • Download the Configurable MIPS Simulator package
  • Unzip the package in a folder and click on Visual MIPS <date and version>.exe.
  • In the Architecture Menu select MIPS 5-Stage Integer Pipeline. Currently this the only MIPS architecture that this simulator supports. More are currently under development.

How to Write a program?

You can either write a program or you can Load an already written program.

To write a program go to File menu and press write program. The simulator will ask you to enter a starting address of the program in the code memory. You can enter a number in the 32-bit range. I, for example, entered 2000. The program is initialized with 25 NOP operations. You can click on the NOP and a drop-down menu appears. Here you can scroll to select instruction from the MIPS instruction set. Branch instructions have limitation that you can only branch within the program.

Once you have written your program, click assemble and program will be imported in the simulator. While in simulator, remember to save your program using Save Program Option in File Menu. The program will be given a .INT extention.

Running the Simulator and Getting Help

Once you assemble your program you can run it using Clock It button. You will see the first instruction entering in the IF stage. 

By clicking on some of the values or signals you can see a more informational Help Bar appearing at the bottom of the simulator. For example when you click on the PC value, the Help Bar print PC value in decimal, hex and 32-bit binary. Similarly when you click on the instruction, you will Help Bar explaining the instruction. 

Click again and you will see first instruction going in the ID stage and second instruction entering in the IF stage. At this point the simulator will ask the values of registers you need to read from the register file. If you like, you can go to Registers Menu and press Initialize to all registers will some values. This will save you from entering registers all the time. All used registers and their values appear at the top of the MIPS simulator screen.

At present I will stop here to further explain the simulator. Please load the examples below to do some experiments.

Sample Programs

Important Note:  Each time you load a new program, remember to refresh it in the program write and press Reset Button to reset the MIPS simulator.

Sample Program 1: Forwarding download

Load this program in the simulator. Then do the following:
  1. First Run this program without any Forwarding or Stall Detection. You can see Data Hazards and program does NOT run properly.
  2.  Now run this program with Stall Detection On and see how this program runs. If you are a teacher you can ask your students to draw a pipeline diagram. What they see is that there will be many ID stage stalls. Ask students to notice what happens to the stalled instruction.
  3. Now you can turn on the Forwarding Option and I would recommend to ask them to turn OFF the Stall Detection option. This time they notice that the program is working fine. You can write many sample programs to see data taking different forwarding path options.

Simple Program 2: Load Use Delay. download

Load this program which has one Load Word Instruction followed by an instruction that uses loaded data.
  1. Run the program with only Forwarding ON. Does this program run correctly? Try explaining that using a pipeline diagram.
  2. Again bring in the Stall Detection hardware and draw the pipeline diagram. Where is the stall now?

Simple Program 3: Branch Hazards download

Load this program to study a simple loop instruction. Here you can learn a lot of things:
  1. First run this program with Aggressive Branching OFF.
  2. Then turn ON the aggressive branching option and see the branch decision hardware moving in the ID stage, and saving two clock cycles.

Simple Program 4: Bubble Sort download

Load this program to study Bubble Sort.

Questions, Comments, and Bugs

Please give your feedback and report all the bugs (with the program and CC #) to Muhammad Jahangir Ikram
 
    
Alphabetical Index

AI technique selection

Books I like

BPO articles and presentations

BPO service providers in Pakistan

BPO service ideas

BPO startup, Finding customers for a

Biz plan: IP infrastructure services co.

Business plan: Software quality assurance co.

Call centers in Pakistan

Call centers, Managing staff turnover in

Cell phones: Basic features

Computing, Intro to

Configurable MIPS Simulator

Enabling the IT Boom

Exporting non-IT services over the Internet

Finding customers for a BPO startup

IP infrastructure services: Biz plan

Intro to computing

Intro to neural nets

Investing in Pakistan's IT Businesses

LCD monitors

Managing staff turnover in offshore call centers

MIPS Simulator, Configurable

Neural nets glossary

Neural nets, Intro to

Outsourcing to Pakistan

Raising venture capital for IT products

Right-sizing the software process

Sudoku: Rules and strategies

Software process, Right-sizing the

Software quality assurance: Biz plan

Teaching, Improve your

Venture capital for IT products, Raising

Why outsource to Pakistan?

We Love Feedback

Do you have comments? Suggestions?
Please