CS220 Assignment #9 Solved

35.00 $

Category: Tags: ,

Description

Rate this product
  • 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. [60 marks] 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. [40 marks] 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 􏰃n−1 aibi using a MIPS assembly language program. The final

i=0
single-precision floating-point result should be printed on the display. Allocate space for A and B statically and

assume that n ≤ 15.

Submission: Please name the file for Q1 as A9Q1.s and that for Q2 as A9Q2.s. Email the files as attachment to [email protected]. The subject line of the email MUST be the following (replace N by your group number): Assignment#9 submission for Group#N

1

  • Assignment-9-Group-75-wqt6aj.zip