Winter 2001-2002 CS 232

CS 232 – Computer Architecture I Rose-Hulman Institute of Technology Computer Science and Software Engineering Department

Lab 3 Questions

Answer the following questions as completely as possible and hand in before leaving the lab.

1. Using the procedure handout, how many times is fact called?

2. Using the procedure handout, draw the state of the stack on the attached sheet when the instruction at address 0x0040008C is executed the first time.

3. What would happen if the line at L1 of fact was omitted.

4. main in fib.asm uses $s0 to store n and $t0 to store fib(n). Why was a t register chosen in one case and an s register in the other?

5. fib in fib.asm uses s registers to store both n and fib(n). Could t registers be used? Which would you choose?

6. While calculating fib(5), how many times is fib called?

7. While calculating fib(10), draw the state of the stack on the attached sheet when the instruction move $s1, $v0 is executed for the first time.

8. Remove the line at skip and run the program. What happened?

14 August 2002 Page 1 Winter 2001-2002 CS 232 14 August 2002 Page 2 Winter 2001-2002 CS 232 14 August 2002 Page 3