|
CS 2731, Spring 2004 |
Recitation 1 must be submitted
following directions at: submissions on or before
|
Outline: Recitation 1 is an introduction to the Linux Laboratory, to the Unix systems, and to the mechanics of assembling programs. The CS Linux Laboratory is located in room 3.01.04 SB. The lab will meet formally in 3.01.04 SB at 2 pm on many Mondays for a 10-minute Recitation Quiz. After the quiz, students can work informally on their recitation assignment and can get help from the recitation instructor.
You can download the MIPS simulator software (which also runs on other Unix flavors such as Mac OS X, as well as (gulp!) Xxxrosoft Zzzindows) and do much of the work at home, if that is more convenient.
If you are a new user, you may want to download a sample C shell initialization file: sample.cshrc, which you could use as your .cshrc (These directions are now a little out of date, since on Linux the default shell is bash.)
pandora% spim -file fact.s
(You should type 4 (carriage return) at the prompt; then the program will calculate and print 4! or 24.)
Next use the xwindows (interactive) version of spim, by typing:
pandora% xspim -file fact.s
When the simulator comes up, you can click on run to execute the entire program. After clicking on ok, you will get the same prompt in a new window as before. After entering 4 followed by Return, the program will respond with 24 just as before. Finally click on quit (twice). It is more interesting and useful to execute one instruction at a time: after invoking xspim, click on step instead of run. In the small prompt window, you should keep clicking on step to execute one MIPS instruction at a time.
After 4 steps, you will next execute the instruction jal 0x0040020 [main], followed by the first actual instruction of the fact.s program: addu $s7, $zero, $ra, which appears as addu $23, $0, $31 in the xspim window.
Continue stepping. When you execute the first syscall MIPS instruction, a window with an Enter n: prompt will appear. After executing the next syscall type 4 and Return as before. Then after over 66 more steps, the program will eventually respond with the value 24 and then a newline. (You must enter the 4 and return immediately after stepping through the second syscall instruction.)
Contents of submission
for Recitation 1: Last Name, First Name; Course Number; Recitation Number.
|