Using the SPIM S20: A MIPS R2000 Simulator ========================================== for the cs470 students 1. What is SPIM ? ----------------- SPIM S20 is a simulator that runs programs for the MIPS R2000/R3000 RISC computers. It was developed by James Larus at the University of Wisconsin-Madison. Currently the simulator runs, at IIT, on charlie, a machine running the UNIX operating system. A PC running version is also available and this document describes how to get it. This document is targeted at those students who have little experience or none with UNIX. Advanced users may skip to section 3.3 which describes how to get started with the simulator. 2. Getting started with UNIX ---------------------------- The first thing you have to do is to get an account on charlie; this is no problem as most students automatically get such an account. Follow the steps 2.1 or 2.2: if it turns out that you don't have an account, then you have to contact ACC (the Academic Computing Center) in room SB-007 (Stuart Building). You may get connected to charlie either from a terminal (in the terminals room, SB-017, or some terminals in the Residence Halls) or from your PC. 2.1 Using a Terminal -------------------- Turn on the terminal; hit the BREAK key and then the semicolon key. If nothing happens repeat the sequence; you should get, eventually, the following on the screen: Which Computer? At this prompt you enter charlie. The computer answers: login: and you have to type your username (usually the first four digits of your last name followed by the first three digits of your first name). After you enter your user-name you will be prompted: password: and you have to enter your password; for the first session your password is ssdddd where dddd are the last four digits of your SSN. If you make a mistake when typing your user-name or password the computer will reject your attempt to log on and you will be prompted again for user-name and password. Eventually you get logged on, there will be some messages displayed and a new prompt: % which is the UNIX prompt for the C-shell (csh, or versions of it like tcsh). Now you can start using the system (go to section 3). 2.2 Using a PC to get connected to charlie ------------------------------------------ Your personal computer is probably provided with some software that can emulate a computer terminal. What you need to know, to properly set your communication parameters, is: * the communication discipline: full-duplex * character size: 8bits * parity: no parity * stop bits: one stop bit phone max speed ========================= (312)567-6478 9600 (312)567-6752 9600 (312)567-5280 19200 (312)567-5272 2400 ========================= After you get the CONNECT message from your modem, hit the semicolon key a few times (this is important, especially if you want to transfer files), and you will get the message: Which Computer: From now on you have to follow the instructions given in paragraph 2.1 3. Using your account --------------------- 3.1 The first step ------------------ The first thing you have to do, when you first use your account, is to change your password: % passwd username where username is your user-name; the system will instruct you next. Make sure you choose a new password that is: * easy to remember; * at least six characters long; * is not a common name (using your name as password is really silly); * contains at least one punctuation sign (.,:;!?) or a special sign (@#$%^&*()-_+={}[]<>), which makes your password more secure; After you have chosen a new password log out: % exit and then log on again, using the new password. Note that you can do this in a single step just by typing login at the % prompt. 3.2 Set the terminal -------------------- To see what charlie knows about your terminal type % echo $term In case the answer is network, you'll have to set the terminal to something different; network is just too general, and charlie won't be able to properly display information. In particular the editor you'll use (pico or vi) won't work with this kind of terminal. To set a different terminal you just do % set term=terminal_name where terminal_name can be vt100 (usually) or some other terminal type; make sure the actual terminal (the one you use to enter your commands) is of the type you to set. 3.3 Useful UNIX commands ------------------------ There are hundreds of commands built in into the system. Keep in mind that you can get information about most commands using the in-line manual. Try this: % man mkdir to get information about how to create a new directory. Here is a list of useful commands you'll use heavily: pwd returns the full name of the directory you are in; mkdir creates a directory with the name name cd [name] change directory to the one called name; the parameter name is optional. cd .. moves you one level up (closer to the root directory) into the directory hierarchy; cd with no argument just moves you into your home directory, the one you enter when you log in. ls lists the files in your directory; ls -l gives you more information about the files. ls -a will show all files in the current directory, including the hidden ones (those whose name starts with a dot). You may combine flags and try ls -al cp creates a new file new and copies into it the content of the file named old mv changes the name of the file from old to new; if new is the name of a directory then move the file old into the new directory rm removes (deletes) the file with the name name rmdir removes the directory name; note that it has to be empty if you want to delete it cat does lot of things. In its simplest form, cat you use it to view the content of the file name more shows the content of the file name, stopping after each screen vi [name] the visual editor beginners hate; this is the basic tool you are using to create and edit your files pico a much friendlier text editor (not available on all UNIX machines) print prints the content of the file name; use the box command to find out where you can find your printout pine a very friendly mail handler 3.4 Getting started with SPIM ----------------------------- 3.4.1 Using the simulator on charlie ------------------------------------ Before being able to use the simulator you have to do the following operations: % mkdir Labs (create the directory where you'll keep the lab stuff) % cd Labs % ln -s ~virgil/cs470/SPIM/bin/spim . (don't forget the dot) % ln -s ~virgil/cs470/SPIM/lib/trap.handler . % ln -s ~virgil/cs470/SPIM/Documentation/spim.ps . % ln -s ~virgil/cs470/SPIM/BLURB . The sequence above creates links to the files in subdirectories of the virgil's home directory. You'll be able to read most of the files but you won't be allowed to change them. If you now type ls at the % prompt you shall find the following files: spim this is the simulator; trap.handler contains the code that handles exceptions; spim.ps the user's manual in PostScript format BLURB a statement from James Larus about the simulator You'll need to print the spim.ps file: % lpr -P laser_ps spim.ps To start the simulator: % spim 3.4.2 Using a text editor ------------------------- Several text editors may be available on UNIX machines; * vi always present, very powerful, quite difficult to master * emacs takes some time to load, much friendlier to use * pico very easy to use for small documents Those of you who want to learn how to use vi may read the file ~virgil/cs470/vi/INDEX.txt which is an index of available vi documentation. If you are in a hurry to learn vi you may just print the file ~virgil/cs470/vi/intro.ps If you are an experimented vi user and want a reference of commands then you can print ~virgil/cs470/vi/reference.txt 3.4.3 Using the simulator on your PC ------------------------------------ You can download through anonymous ftp the necessary files from ftp.cs.wisc.edu:/pub/spim and then follow the instructions to install it on your PC.