CS611
Programming Assignment 3
Fall 2000


Write a C function, called simulate, that simulates the execution of Alpha machine language.

The function should be capable of simulating any of the instructions listed in the distributed document alpha.ops.

The simulate function takes two parameters:

  1. The address in memory where the simulation should first fetch an instruction to execute.
  2. An array of long ints that must be used as the Alpha register "scratchpad" by the simulator. Index i in this array corresponds to Alpha register i.
The simulate function should continue to simulate execution until the PC is set to zero. At this point the simulate function should return to its caller. (The simulate function should also return if it encounters an instruction that it does not know how to simulate.)

The directory ~cs611/public/prog3 contains a stub for the simulate function (in simulate.c), as well as a Makefile and a main routine. This main routine performs a series of tests of the simulate function. The directory also contains a file called hack.s that allows the tests to be directly executed by the Alpha hardware. This allows you to easily see what the correct answers are in advance. To build this version of the program, type "make hack" and then type "hack" to execute it. To build the normal version of the program, type "make" and then type "simulate" to execute it.

You should study the hack.s file and determine how it works. I will ask you about it at the programming portfolio review!

All your code should be placed in the file simulate.c.

Your program will be graded primarily by testing it for correct functionality:

You must approach this assignment in the order of the percentages given above. First you must get the 70% level working, then you can add support for stq, ldq and lda, and finally you can do the remaining instructions.

Remember, you may lose points if your program is not properly structured or adequately documented.

Only the distributed test cases will be used for grading this assignment.

Your programs will be graded using an Alpha machine so be sure to test in that environment. (Actually this program will only work on an Alpha!)

Your programs should be submitted for grading from a UNH CIS Alpha machine (e.g. alberti.unh.edu). Submit just the single file, simulate.c. To turn in this assignment, type:
~cs611/bin/submit prog3 simulate.c

Submissions can be checked by typing:
~cs611/bin/scheck prog3

To receive full credit for the assignment, you must turn in your files prior to 8am on Monday October 23. Late submissions will be accepted at the penalty of 5% per day up to one week late.

Remember: as always you are expected to do your own work on this assignment.


Last modified on October 5, 2000.

Comments and questions should be directed to pjh@cs.unh.edu