Computer
Organization and Design
(Textbook. Click for information.)
 CS 2733/2731
 Computer Organization II
 Fall 2004

 Recitation 1
 Intro to the Linux Lab and to MIPS
    Week 1: Aug 25-27
 Due (on time): 2004-09-01  23:59:59
 Due (late):        2004-09-05  23:59:59

Recitation 1 must be submitted following directions at: submissions on or before
  • 2004-09-01  23:59:59 (that's Wednesday, 1 September 2004, 11:59:59 pm) for full credit.
  • 2004-09-05  23:59:59 (that's Sunday, 5 September 2004, 11:59:59 pm) for 75% credit.

Outline: Recitation 1 is an introduction to the Linux Laboratory, to the Unix systems, and to the mechanics of running an assembly language program. The CS Linux Laboratory is located in room 3.01.04 SB. The lab will meet formally in 3.01.04 SB at the beginning most weeks 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.

The CD includes MIPS simulator software which you can download onto Unix flavors such as Mac OS X, as well as (gulp!) Xxxrosoft Zzzindows. With the simulator you can do much of the course work at home, if that is more convenient. The simulator is already installed on the Linux machines, as will be described below.


Detailed Recitation Requirements:
  1. CS network 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 network, get an account form just inside the lab door, fill it out, sign it, and leave it in the CS Department Office. You must have a CS account.

  2. You must become familiar with the Unix environment during this course, if you don't already know it. The first recitation starts this process. At school you should mainly work with Linux, but you can also work on one of the Sun machines -- they are similar.You could use some Unix reference book, such as the old CS 1713 text: UNIX SYSTEM V A Practical Guide, by M. Sobell.

    Common to any Unix are a number of basic commands, entered in a terminal window, including:

    You should also become familiar with the following UNIX features:

  3. If you do not already have a personal homepage on the web, you must set one up by following these directions. Even if you have your own personal homepage, you must create a homepage at UTSA as described above, and 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 must also set up things at UTSA so that mail to your UTSA email account is forwarded to your "real" email address, or else just read and use the UTSA email along with others. The main communication with you will be through the UTSA email, so it is essential that you read and use your UTSA mail.

Note: We will be using the MIPS simulator spim (called xspim in its X-windows version) to run our MIPS assembly language. Documentation for this simulator can be found on the CD along with your textbook and online in Postscript or PDF. This simulator runs directly on the Linux machines. On the Sun machines, you must create a secure shell from a terminal to get a connection to the Linux machines, as is described in the page on submitting recitations. Then you can use spim and xspim.

Note: Appendix A of your text (on the CD that comes with the text) gives very good documentation for the MIPS assembly language (although maybe more detail than you want).

  1. Download the MIPS assembly language test program fact.s into a convenient 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.

  2. Run the simulator with input fact.s in the Linux machines by typing (here % is the Linux prompt):

        % spim -file fact.s
    

    (You should type 4 (followed by return) at the prompt; then the program will calculate and print 4! or 24.)

Note: As mentioned elsewhere, you could also work on one of the Sun machines, first connecting to one of the Linux machines using a secure shell, say with the command:

    % ssh username@gateway10.cs.utsa.edu

  1. Next use the xwindows (interactive) version of spim, by typing the following. (This xwindows program will also work from a Sun machine over the network because the secure shell sets up an xwindows connection.)

        % 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.)

Note: Older versions of spim and xspim are still on the Sun machines (left for compatibility). Most of the programs for this semester will also work in the older versions. The new version of spim on the Linux machines (and on the CD) are not supposed to require the -file option, but xspim seems to screw up without this present, so you need to use it for now.


What you should submit: Refer to the submissions directions and to deadlines at the top of this page. The text file that you submit should first have Your Name, the Course Number, and the Recitation Number. The rest of the file should have the following in it, in the order below, and clearly labeled, including at the beginning the appropriate number 1-4.

  Contents of submission for Recitation 1:

Last Name, First Name; Course Number; Recitation Number.

  1. Your preferred email address.

  2. A statement that you have email working at UTSA, using the email address acctname@cs.utsa.edu, where acctname is the name of your account on the CS network. Possibly this email is simply forwarded to another email address.

  3. A statement that you have a working UTSA webpage, using the URL http://www.cs.utsa.edu/~acctname/index.html, where acctname is the name of your account on the CS network. Possibly this webpage just has a link to another webpage.

  4. A log showing a run of fact.s using spim with input value 4, and showing the resulting output. (You do not need to prove that you ran the xspim program.)


Revision date: 2004-06-20. (Please use ISO 8601, the International Standard.)