Tuesday, February 16, 2010 at the beginning of class
Instructions:
Show your work to receive full credit.
2.28.4
2.35 - all
2.37 - all [Note: In 2.37.3, disregard the reference to the label MY_FUNCTION. Treat the hexadecimal value in part (b) as a 32 bit constant.]
3.6.1, 3.6.2
3.10.1, 3.10.2, 3.10.3, 3.10.4, 3.10.5
3.13.1 (a), 3.13.2 (a), 3.13.3 (a)
Programming questions:
The following two questions require you to use the XSPIM simulator to write, debug, test and run MIPS assembly programs. Appendix B in the book contains information about XSPIM and you can find more information about XSPIM at here.
1. Write a MIPS assembly program that contains the string "!saxeT oG syas nrohgnol A" in simulated memory, and prints it out to the screen in reverse. You may assume that the previous location in memory (before the start of the string) contains a zero.
Turn in the file moo.asm:
bash$ turnin --submit upendra hw3 moo.asm
Hints:
You will need to use the XSPIM syscall directive to ask the operating system to do the printing. Study the sample program larofn.asm to understand how to display output on the console. Refer to page B-44 of your textbook for available XSPIM system calls.
The la pseudo-instruction may be useful.
The lb instruction may be useful.
2. Write a MIPS assembly program to compute the product of two vectors of 4 integer elements each. The user should enter the vector elements interactively through the XSPIM console. The result of the multiplication should be displayed on the console.
e.g [1 2 3 4] x [5 6 7 8]T = 70
You should display the answer as 70 for the above example.
Turn in the file mult.asm:
bash$ turnin --submit upendra hw3 mult.asm
Hints:
Study the sample program larofn.asm to understand how to perform interactive input and how to display output on the console.
Use the temporary registers ($t0-$t9) to store the vector elements and compute the product. If you plan to use any other registers, follow the callee save register convention.