MIPSim 2 API is a very small and simple yet powerful API. It consists of a set of useful functions which you can use to read from and write to the registers and memory of the computer simulated by MIPSim. This allows programmers to write programs that can control MIPSim to some extent and provides great flexibility.

All programs are written to manipulate data. This data is sometimes as simple as a single integer parameter, but usually it is some kind of complex data structure residing in memory. Unfortunately MIPSim currently (as of version 2) does not support assembler directives. So there is no easy way to construct data structures on which your program will work. This is where MIPSim 2 API comes into play. Individual programmers can write various utilities for MIPSim to create testing environments for their MIPS programs.

To uderstand the benefits more clearly, consider this example: You write a MIPS program which works on (i.e. manipulates) linked lists. In order to test your program there must be a linked list in the memory. One option is to write quite a few data transfer (store) statements in MIPS to construct the linked list in the memory. This method works, but it is too difficult to construct a complex linked list such that you can test many possible scenarios. Another flaw is that, even if you write the code to construct the linked list, you will have to use the same linked list for each test which easily decreases the effectiveness of your tests. The other option would be writing code to create many different linked lists so that you could test your code with different linked lists which is even more difficult and time consuming.

What does MIPSim 2 API provide us? By using the MIPSim 2 API you can create your own utility programs in programming languages that the API supports. And then you can use these utilities to create testing environments for your MIPS code. I indeed implemented a simple linked list utility as an example which is a partial solution to the problem I described above. You can use it to create a linked list or print the values of nodes of an existing linked lists. It can detect whether the linked list is broken or not while printing it. You can download the MIPSim 2 API and the linked list utility from the downloads section. It is a good example to help you understand how you can use the API.