Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a picture of the question, all the info is here 3. [20 marks] Architecture and Implementation. A data scientist needs a MIPS assembly-language

image text in transcribed

This is a picture of the question, all the info is here

3. [20 marks] Architecture and Implementation. A data scientist needs a MIPS assembly-language program for data analysis. He has three arrays of floating-point numbers. Array 'a' is a source array, and 'b' and 'c' are result arrays. Array'a' contains '2n' floating-point numbers, 'rl' is the address of 'a[O]'. 'r' is the address PAGE MERGEFORMAT 1 of the byte immediately following 'a', i.e., the address of the imaginary element 'a[2n)'. Each of 'b' and 'c' can store 'n' floating-point numbers. 'r2' is the address of 'b[0]'. '3' is the address of 'c[n-1]'. The algorithm is: walk through array 'a' copying even-index elements to 'b' in 'b' order, after multiplying by 'f2', and odd-index elements to 'c' in reverse order (.e., from high 'c' index to low 'c' index), after multiplying by 'fo'. Write the MIPS code. Use only the following instructions. I.d f6,n(r2) // load to 'f6' eight bytes starting at Mem[r2+n] s.d f6,n(r) // store fo's value to memory starting at Mem[r2+n] mul.d f4,fo,f2 // write 'fo*f2' into 'f4' addi ri,r1,n // add integer 'n' to 'ri' subi ri,ri,n // subtract integer 'n' from 'ri' bne r1,r2, loop // if'ri /= r2' then goto 'loop 3. [20 marks] Architecture and Implementation. A data scientist needs a MIPS assembly-language program for data analysis. He has three arrays of floating-point numbers. Array 'a' is a source array, and 'b' and 'c' are result arrays. Array'a' contains '2n' floating-point numbers, 'rl' is the address of 'a[O]'. 'r' is the address PAGE MERGEFORMAT 1 of the byte immediately following 'a', i.e., the address of the imaginary element 'a[2n)'. Each of 'b' and 'c' can store 'n' floating-point numbers. 'r2' is the address of 'b[0]'. '3' is the address of 'c[n-1]'. The algorithm is: walk through array 'a' copying even-index elements to 'b' in 'b' order, after multiplying by 'f2', and odd-index elements to 'c' in reverse order (.e., from high 'c' index to low 'c' index), after multiplying by 'fo'. Write the MIPS code. Use only the following instructions. I.d f6,n(r2) // load to 'f6' eight bytes starting at Mem[r2+n] s.d f6,n(r) // store fo's value to memory starting at Mem[r2+n] mul.d f4,fo,f2 // write 'fo*f2' into 'f4' addi ri,r1,n // add integer 'n' to 'ri' subi ri,ri,n // subtract integer 'n' from 'ri' bne r1,r2, loop // if'ri /= r2' then goto 'loop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions