CS 2734 Computer Organization II -- Fall 2001
Laboratory 1 [Aug 27, 29]: 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.18) for administrative purposes, but otherwise the lab will meet in 3.02.04 SB except for weekly quizzes.
  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 gaining familiarity with the Unix environment during this course. This first lab is a start toward getting familiar with Unix. 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 be familiar with the following UNIX features:

    If you are a new user, you may want to download this sample .cshrc as your .cshrc

  4. If you do not already have a personal homepage, you should set one up by following these directions.

  5. Send an email to your instructor (wagner@cs.utsa.edu) giving your web page URL and your preferred email address.

  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.

  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: 2001-08-15. (Please use ISO 8601, the International Standard.)