From jmips

This is the list of Frequently Asked Questions (FAQ) for project jMIPS.

  1. What does jMIPS do and what is it intended to do?
  2. What is a MIPS processor?
  3. Why do I get warnings or errors when I unarchive the zip file?
  4. Where is the FAQ?
  5. How do I get started using jMIPS?
  6. Where can I find more MIPS32 files to run on the simulator?
  7. I have a question not answered here. Where do I go next?
  8. Other MIPS emulators are available, why use jMIPS?
  9. Where can I download the latest version of the jMIPS source code?
  10. I'm having problems submitting code via SVN - what should I do?

What does jMIPS do and what is it intended to do?

jMIPS is a program written in Java (hence the 'j') that simulates in software the functions of a MIPS CPU - the processor chip in a MIPS-based computer. "CPU" is an acronym for 'central processing unit', which is the part of a computer which carries out the basic instructions and system operations of a computer program. The current version of jMIPS contains 5 different CPU models of varying complexity, each modeling real advances in computer architecture.

These advances include:

  1. pipelining tasks for efficiency
  2. caching of memory
  3. multi-instruction optimization.

The jMIPS utility itself loads and runs 'mips32' executable files containing machine code programs to be run on a 32-bit MIPS processor. jMIPS is a tool for learning about how processors work and therefore can be run in different modes; either simply returning what the mips32 program would return or a displaying a printout of the machine instructions as the processer works.

For more information, go to the JMIPS website

Return to top of page

What is a MIPS processor?

MIPS should not be confused with the computer jargon for 'Millions of Instructions Per Second'. The latter is used as a unit in measuring computing performance (speed). Or perhaps it should ...

In our context, MIPS might be taken as an acronym for 'Microprocessor without Interlocked Pipeline Stages' [1], but really MIPS as-is is the name and the supposed acronym was invented for the benefit of po-faced people who did not get the joke. Its name is a reference to the unit of speed, and therefore connotes "speed" and nothing more. The MIPS microprocessor was produced by MIPS Computer Systems Inc, or "Speed Computer Systems Inc", on that reading. It's like having a car manufacturer called "MPH" (KPH for users of non-imperial units, or should that be KPS?). Yeah, and "emacs" really does mean "escape meta alt control shift"!

MIPS machines embodied the original Reduced Instruction Set Computer (RISC) microprocessor architecture. The design was developed at Stanford in the 1980s, as a test of the idea that one could design a faster processor by making the design simple so that it could be clocked fast (the alternative is making a complicated design that contains loads of optimizing circuitry that slows it down).

The same kind of idea resurfaced with the Pentium 4, which deliberately threw out much optimization in favour of increasing the clock speed.

RISC designs had great success. The simple and elegant instruction set architecture actually allowed optimizations to be achieved in more generic ways. Super-scalar design (multiple pipelines and more than one instruction per cycle) in particular became possible through RISC. SGI graphics workstations and Sun SPARC machines were all top-of-the class RISC designs in their day. Today most CISC (complex instruction set computers) are actually closer to RISC machines internally, a reconciliation of the opposing design philosophies.

MIPS machines were originally 32-bit microprocessors (at a time when Intel chips were still 8 or 16 bit) but today there are both 32- and 64-bit MIPS chips. The first MIPS was the R2000 (1985);later R3000 (1988), R4000 (1991; 64-bit), etc.

The 3 basic formats 'on the metal' of MIPS 32-bit instructions are:

  1. R-type - register arithmetic operations (6-bit opcode, three 5-bit register indices, 5-bit data, 6-bit function code)
  2. I-type - register immediate arithmetic operations and branches (6-bit opcode, two 5-bit register indices, 16-bit immediate data)
  3. J-type - jump operations (6-bit opcode, 26-bit jump data)

Return to top of page

Why do I get warnings or errors when I unarchive the zip file?

You are on Windows. Or you are running on a Mac and you have yet to set your HFS or HFS+ file system to preserve case (system settings). ...

For Windows users who want to 'import from zip/rar' under Eclipse (it must also be possible in NetBeans), follow these steps:

  1. Right click your package name > Import
  2. Expand the 'General' folder > 'Archive File' and click 'Next'
  3. Browse for the zip file
  4. All the files in that zip file will be displayed on the right box (by default all of them are selected/checked)
  5. Click 'Finish'

The files will be visible in your package.

Return to top of page

Where is the FAQ?

You are looking at it! [2]

How do I get started using jMIPS?

Firstly, download the jMIPS package and then read through the README in the package and maybe the wiki documentation. Everything you need should be on the wiki, and if not you can ask for it!

That already includes information on compiling (if need be) and running. Have fun!

Return to top of page

Where can I find more MIPS32 files to run on the simulator?

You can make your own! The source code for the example hello_mips32 written in C is included in the misc/ folder of the distributed package.

For instructions on how to compile it (and, obviously, other source codes) to MIPS machine code, refer to section 1.4 of the documentation.

That says, essentially, "use a compiler if you are on a MIPS platform, or a cross-compiler if you are not on a MIPS platform". The result from compilation will be an ELF format file.

If you want pre-compiled code, go and look for some software ready-compiled for MIPS. MIPS is one of the architectures supported by the Linux kernel, so one gets all the usual Linux and Unix stuff in distributions available on archives. ELF is the vendor-neutral standard executable format, and the executables will be ELF format files by default.

It's not likely that you'll get something off-the-shelf to run in CPU1, however, unless it's almost as simple as Hello world!

Perhaps it's a good idea to put some more such stuff in misc!

Return to top of page

I have a question which is not answered here. Where could I go next?

If you can't find your answer here please feel free to ask a question in our Help forum.

Return to top of page

Other MIPS emulators are available, why use jMIPS?

  • It's not an emulator, it's a model.
    • Yeah, sure, we know - processors run machine code, successful models are accidentally emulators of processors.
  • The model is a hardware model. It models the hardware, in detail, not the abstract idea.
    • That the result works tells you that the parts of the model work and they are put together correctly - the model models well!
  • Therefore a software student learns about reality and the way that works by studying the software.
    • Really, amazing as it is to the rest of us, computer science majors need software models to help them understand the real world! But eventually they learn.
  • Hey, and it has an active developer community; here to help: [3]!
  • Extensive documentation of the model, which students can work through. The idea is to change the code, thereby changing the model. We'll put up "modelling tasks" as goals for (re)coders soon.

Return to top of page

Where can I download the latest version of the jMIPS source code?

The latest version of the jMIPs code is available here for download

Return to top of page

I'm having problems submitting code via SVN - what should I do?

Check out the forum discussion page - lots of people have posted about specific problems that they're having, and some people have posted replies which explain what they might be doing wrong. If you can't find what you're looking for, create a new post. It's likely that someone else will be having or has had a similar issue, so you might be able to get some support there.

Remember! Nobody is obliged to help you, and posting only "I can't do it" is likely to win you as much sympathy and deference as a yowling nipper would get in an airport queue. Everyone else has their own problems too! If you put effort into your posting, detailing exactly what your environment is, what you are typing, what the results are, etc, then people will see the effort you have made and respond to it in similar measure. Otherwise they'll think to themselves "this guy is trying to get something for nothing". That's cadging off other people's labour and biological societies have grown up to not respond to that kind of thing, and virtual societies are no different in that respect. So it's unlikely that "I can't do it" alone will get you anything useful in response. For one thing, nobody can help you given only that as basis.

Encourage the response you want by helping helpers to help you. Provide copious detail. Show you have a mind that is willing and that you are likely to pay back any effort put in by other people by learning and teaching them something in the near future if they get you over this hump now, and they'll help. That means showing that you are sharp and 'on the ball'. Explain exactly what research you have done, where you have looked, what you have tried, what you have deduced, and generally show that you're doing your part.

Here's my free advice on using subversion:

  1. Getting svn to work through a firewall needs skill .. at typing "how do I get subversion to use a proxy" into google;
  2. at some distant time in the past I typed "svn co https://jmips.svn.sourceforge.net/svnroot/jmips jmips" while standing in a clean fresh directory on my own machine;
  3. now all I do is go to that same directory, type "svn update" ...;
  4. then cruise around for something to edit, and when I find it I do "svn lock FOO";
  5. then I edit away at FOO for a bit;
  6. then I finish by typing "svn commit FOO".

That works fine. If it doesn't, I google the error message that appears, and do whatever seems sensible according to at least 30% of the posts (I would say that sometimes about half the respondents are unaware that they are speaking in public for posterity, and one has to apply one's own intelligence to filter theirs!).

Oh .. and if you edit code, don't dare check in nonworking code! People will shout at you if you do! Always test before commit.

Alternative: You can use the TortoiseSVN GUI to help you navigate through all that. Look at the HOWTO on how to use TortoiseSVN.

Return to top of page