[SOLVED] CS220-Assignment 9

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

•    All problems must be solved using MIPS assembly language programs. The programs should be tested using SPIM.

•    Please refer to the SPIM commands and introduction to SPIM handouts already posted on course webpage. Additionally, Sections A.9 and A.10 from Appendix A of Patterson and Hennessy have all details regarding SPIM.

•    Use of pseudo-instructions supported by SPIM is allowed.

•    When you enter a value from keyboard, make sure to press “ENTER” after entering the value; otherwise the system call layer will not accept the input. As a result, when entering an array of values, please enter them one per line.

1. Write a recursive function to compute the nth Fibonacci number. Write a main function that accepts an integer n as input (from keyboard) and prints the first n Fibonacci numbers on the display as a comma separated series i.e., 1, 1, 2, 3, 5, 8, 13, 21, … Your program must work correctly for arbitrary values of n. Try your program for n = 10,20,30 and verify the output from internet e.g., from http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fibtable.html.

2. Take an integer n and two single-precision floating-point n-dimensional vectors A = (an−1,an−2,…,a0) and B = (bn−1,bn−2,…,b0) as inputs. Compute using a MIPS assembly language program. The final single-precision floating-point result should be printed on the display. Allocate space for A and B statically and assume that n ≤ 15.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.