Project Assignment 2
CSC255 - Information Structures & Representations
Due: 5/30/2001
Given the hypothetical machine described in Appendix C of our text, develop the programs described below. The final result should be stored at memory address a4 in all cases.
You should turn in four separate programs, each annotated with descriptive comments on each line of your program as in this supplied sample program. Also, a trace report should be included for each program. See this sample trace for the program above.
Memory address a0: 5610
Memory address a2: 6410
Memory address a0: 5610
Memory address a2: 1610
Note: Remember that you must first convert the value being subtracted to it's two's complement representation as the initial step. Notice that since you can assume that you will always be subtracting a smaller number from a larger number then the result will be positive.
Memory address a0: 1010
Memory address a2: 310
Note: There is no multiply instruction in the instruction set of our CPU and so you must implement multiplication using the technique of repeated addition.
Hint: Your program must repeat an addition. Use the sample program as a basis for your program.
Memory address a0: 1210
Memory address a2: 410
Note: There is no divide instruction in the instruction set of our CPU and so you must implement multiplication using the technique of repeated subtraction.
Hint: Your program must repeat a subtraction. Use the sample program as a basis for your program.
As an extra credit exercise attempt executing programs #3 and #4 above using the PUP simulator. Note that this simulator has a very different instruction set than the hypothetical machine above.