Computer Science and Engineering Department Computer Architecture II (ACOE301) Laboratory Exercise #5 Loops Student’s Name: Semester: Date: Assessment: Assessment Point Weight Methodology Presentation and discussion of results Participation Assessment Points’ Grade Comments: Grade Computer Architecture II Lab5- ACOE301 Exercise #5: Loops Hint: You can use the lecture notes found in http://staff.fit.ac.cy/com.tk/ACOE301/Lecture1.ppt Objectives: The objectives of this experiment is to show students the use of loops in MIPS assembly. a) Open notepad and enter the following code: .data n: .word 10 Fn: .word ? .text main: #enter your code here addi $v0, $0, 10 #exit program syscall b) In the .text segment write code that calculates the nth number in the Fibonacci sequence where (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...). n should be read from memory location n, and the resulting number should be stored to memory location Fn. c) Save the file as "lab5.s" or "lab5.asm" including the quotes. Make sure the file is saved as "all files". d) Run SPIM. e) From the SPIM menu select "File => Load File". Select the file you created. f) Run the program and verify its operation. If necessary, single step through the program or use breakpoints to debug it. Questions 1. How many instructions did your program contain? 1 Computer Architecture II Lab5- ACOE301 2. How many registers did your program require? 3. Which is the Fibonacci number F20? 2