![]()
SPIM Part 1
CptS 260 - Intro to Computer Architecture Washington State University |
|
MIPS and SPIMPlease use the links on the course resources page to obtain SPIM.\parTypos to correct in the Britton book: on page 13 line 7 change the word "except" to the word "expect". In the gray box at the bottom of page 18 note that the separators on the second line are commas, not periods. On page 131 in the second case for the load immediate instruction should refer to Rd instead of Rt. What is SPIM? SPIM is an assembler and simulator for the MIPS architecture. An assembler translates programs written instruction by instruction to machine code (ones and zeros). A simulator executes programs written for one machine on potentially a different machine. Why is writing for an assembler better than writing machine code? (Even though the instructions are often in a one to one correspondence)
When writing in assembly language it is wise to first code your programs in pseudocode--a high-level representation of the steps that the program should take. In pseudocode you can use if-then-elses and while loops but in assembler you have to code all the jumps explicitly. This can result in a big mess if you are not careful, and the way to be careful is to write pseudocode first. Refer to the Britton book, pages 14-16 for examples. One important thing to know about both the if-then-else translation and the while loop translation is that you use the negation of the test in both cases when you are coding the jump at the beginning of the translation. Why? |
|