Hennessy-Patterson

CS 2734 Computer Organization II -- Spring 2002
Laboratory 1 [Jan 14, 16]: Introduction to the Sun Laboratory

Laboratory 1 is an introduction to the Sun laboratory, to the Sun unix system, and to the mechanics of assembling programs. The Sun laboratory is located in room 3.02.04 SB. The first laboratory will meet in the official classroom (HSS 3.02.24) for administrative purposes, but otherwise the lab will meet in 3.02.04 SB except for weekly quizzes (most Mondays at 12:40 pm in HSS 3.02.24).

Because this class is so large, there is not room in the lab for everyone at once. For this reason, you are not required to be in the lab at the official lab times. You can also download the MIPS simulator software (which also runs on Xxxrosoft Zzzindows) and do much of the work at home, if that is more convenient.

  1. CS Sun accounts are now supposed to be assigned automatically at the beginning of the semester. If you are new, an account should be created for you. If you end up with no account on the CS Sun network, get an account form just inside the lab door, fill it out, sign it, and leave it in the CS Department Office.

  2. You will be getting familiar with the Unix environment during this course. This first lab starts this process. You could use some Unix reference book, such as the old CS 1713 text: UNIX SYSTEM V A Practical Guide, by M. Sobell.

  3. You should become familiar with the following UNIX features:

    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

  4. If you do not already have a personal homepage, you should set one up by following these directions. You should create a homepage at UTSA as described above, but this page can just have a link to your "real" homepage. You may use UTSA as the main location for your email. Even if you do your email at a separate location, you should also set up things at UTSA so that mail to your UTSA email account is forwarded to your "real" email address.

  5. Once you have set up a homepage and email address, you should access the item called "Students in the Course: Student Webpages and Email Addresses" and enter this information. (This list is not really protected from student vandalism, and I ask that you not mess up the list maintained for the course.)

  6. We will be using the MIPS simulator xspim to run our MIPS assembly language. Documentation for this simulator can be found in your textbook and online in Postscript or PDF.

  7. Create a directory cs2734 in your home directory, with a subdirectory lab1 (or use other names if you wish).

  8. Download the MIPS assembly language test program fact.s into your ~/cs2734/lab1 directory. (You can just select the contents of this web page and copy it into your own file named fact.s.) This is a sophisticated MIPS program which you are not expected to understand at this point.

  9. Run the simulator on fact2.s by typing:
        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, the program will respond with 24 just as before. Finally click on quit. 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 6 steps, you will 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 50 more steps, the program will eventually respond with the value 24. (You must enter the 4 and return immediately after stepping through the second syscall instruction.)


To get checked off in this laboratory:


Revision date: 2002-01-08. (Please use ISO 8601, the International Standard.)