ECE 3055 Laboratory Assignment 1
Due Date: 10:00 am, Thursday Jan. 27, 2000

(demo to TA in PC Lab, CoC 360)

 

Write a MIPS assembly language program to prompt for input with the string "Input the value of N", input N, compute N! , space down two lines and return, print out "The value of N! is " and then print N! N is a decimal number. You can assume that N is a positive integer such that N! is less than 2^32-1.

Use the SPIM simulator running on the lab PCs or your home PC to implement the program. The program must be demonstrated in the PC lab to one of the 3055 TAs for credit. For students with home PCs, instructions to download SPIM can be found in Patterson and Hennessy on page XVIII (http://www.mpk.com/cod2e.htm).

Appendix A of Patterson and Hennessy contains information on SPIM and SPIM's I/O function calls.  Chapters 3 and 4 contain MIPS assembly language program examples.

Note, if you use SPIM on a home PC some new versions do not support the put and get I/O calls. For these versions you must use operating system calls with li and syscall instructions as described in Appendix A, page A-48.

Hint: Use one of the multiply instructions to help compute N! (See Appendix A, page A-56). Instructions to move data to and from the hi and lo registers may also be useful (see Appendix A, page A-69)