References: EE380 Assembly Languages (Chapter 2, 2nd Ed. Chapter 3)
The book overviews things pretty well, but you need some
additional details on the MIPS architecture, and a secondary
reference for the other stuff wouldn't hurt....
-
The "generic" translation of various high-level language
constructs into assmbly language is discussed in detail in the
course notes I wrote years ago for the undergraduate compilers
course at Purdue. The complete notes are available as .ps and .pdf; only
the chapter about "compilation goals" is really relevant.
-
SPIM (the MIPS simulator) is primarily distributed from the University of Wisconsin
SPIM FTP site. However, here we have local copies of what
you will most likely need. Note that we created the PDF files
from the PS files as a convenience to you; they are not at the
SPIM FTP site. There is also a small example
program posted here.
-
Windows version as an .exe
-
Windows documentation as
.pdf and
.ps
also read the unix documentation
above because this windows documentation
does not discuss the MIPS instruction set
-
I've put together mucky (MIPS
uCompiler from KY) (also available as C
source code using the CGIC library for its CGI interface). This compiler will
allow you to see what a very dumb compiler might do with code
written in a simple C subset. The C subset uses ANSI C notation
and is quite small, allowing only char, short, and int variables
and single-dimension arrays of them. The output code should
work directly as input to spim (described above) and includes
C-callable wrappers for print_string(),
print_int(), and exit() OS calls.
Computer Organization and Design.