Instructions For SPIM Assignment

 

The SPIM assignment is a personal exercise that involves assembler coding, testing the code with simulator and writing the assignment report.

SPIM simulator

The first assignment requires SPIM simulator for PC/Windows environment.

PC-version of SPIM

PC-version of SPIM is not installed on university PCs. You should load PC-SPIM and install it by yourself in a PC-class or home.

Windows version of SPIM (spimwin.exe) is available at

ftp://ftp.cs.wisc.edu/pub/spim


NB! After installing spimwin.exe define options in menu Simulator->Settings. The settings in Figure 1 can be used, but set the traphandler path to the directory where you installed the spimwin.

                        Figure 1: Settings for spimwin.

Assignments

There exist both easy and more demanding assignments. The easy assignments are graded in scale 0 .. 3 and the demanding ones in scale 0 .. 5.

 

You can get the assignment by giving the following commands in Unix workstations (alpha: jewels, sun: Gallic, linux: birds, angels, fruits. See http:/www.hut.fi/atk/luokat for details about the workstations.)

                                                use tark

To get an easy assignment type

                                                tark-start –e

or to get a more demanding type

                                                tark-start –d

Note that '-e' or '-d' is a parameter so it's preceded by a space. You should also notice that text file format is different in UNIX and PC/Windows environments. All text editors in PC do not work well with UNIX text files. You might try different text editors when you move your assignment from UNIX to PC.

 

The command `tark-start' will create a working directory called `tark1' and copy the assignments there as `dn.s' and `en.s'. Select which one you want to take (d=difficult, e=easy). You can write your subprogram at the end of this file. Comment you program well and describe the structure and functionality of your program in a verbatim way.

 

The following issues are considered in grading:

·        working of the program generally

·        working in special or error cases

·        documentation and commenting

·        testing

 

Don't remove your test cases and testing programs from your assignment.

 

Don't delete your working files before your assignment is graded.

 

Use SPIM simulator in testing. Print test cases into file and include them into exercise report. There is a brief description of SPIM in the appendix A of the course book. 

Report

Report can be written in English, Finnish or Swedish. Preferred language is English. An example report can be found in the course web page.

Report should include the following items:

·        cover page including the following information: T-61.123 Computer architecture, number of your assignment (e.g. D5), your name, student number, department and date.

·        original assignment

·        desciption of the function of the subroutine, i.e., what the subroutine does, what is it's output etc.

·        description of the program, i.e., description of the internal structure of the subroutine. This can be done by using higher level programming language, e.g., C-language, by using pseudo-code, or by explaining the structure of the subroutine with a few sentences.

·        description of test cases

·        run-time log file

·        program code (with enough comments)

 

You should consider what kind of an algorithm suits best to the particular problem at hand and the given instruction set of the processor. Justify your choice in the report. Describe other alternatives for an algorithm and possible advantages and disadvantages that relate to using different approach (pros and cons).

 

Construct your report into a Microsoft Word document or Adobe PDF format and return it as an email attachment to tark@hut.fi. Deadline for project return is 12.12. 2005 at 24:00. Don’t be late!

Testing

This is probably the most important section of the project report, because purpose of testing is to ensure the functionality of the subprogram in different cases. Without proper testcases, it’s impossible to be sure the program works.

 

You should design the test cases so that all the branches of the subprogram will be tested. To keep the amount of test cases reasonable think which tests are worth running. E.g. if the input parameter value may vary in the range 1..100, it's reasonable to run the subprogram with extreme values 1 and 100 and possibly using one value in the middle, e.g. 50. In addition it's worth testing that the subprogram behaves correctly also with abnormal parameter values.

 

Code the tests in the main program. Use the syscall instruction to print information about the parameters and test results to the console. You can make a loop in which you can call the subprogram with different parameter values. This way you can collect all the test parameters in a table and run all the test cases with a single run creating a test log of all the tests. Another way is to copy & paste different test cases consecutively in the main program and change the parameter values in different tests.

 

You may change and expand the test routine given in the assignment to suit your testing needs. Leave the test routines used for creating the test log in the main program so that it's easy to see what tests were performed and what is the resulting log-file.

Creating a run-time log file of the test cases

 

The essential part of the log file are the strings that your program should print in different test cases. Take care that the printed test strings are informative and descriptive. They should also give the correct information of the program run: if the test case fails the printed string must also include this information.

 

In PCSpim a log file of the current simulator state can be generated using the ‘File ® Save Log File ….’ menu item. In PCSpim version 1.0 this will dump the contents of the registers, text and data segments, console and messages. The contents of the registers as well as the program and data segments are not important but the strings that your program prints to the console window. You should include only the console window part of the log file in your assignment report. The following console window fragment of the log file shows one of the test runs of the qsort example given in the material.

 

 

String before qsort:

this is a test string for quick sort algorithm

String after qsort:

        aacefgghhiiiiiklmnoooqrrrrsssssttttttu

If you are using windows and the generated test log is short you can simply copy the console window to clipboard by pressing Alt-Print Screen and paste it to the e.g. Word-document.

 

For More Information

If you have any problems you can ask in otax news (opinnot.tik.tark), in exercises or by sending mail to address tark@hut.fi. Newsgroup is intended for free discussion among students and also for distributing the FAQ relating to the assignments. Primary channel to get help from assistant is to come to receptions or exercises. Start your work early enough.