Menu

(Solved) : 3 20 Marks Architecture Implementation Data Scientist Needs Mips Assembly Language Program Q44095499 . . .

3. [20 marks] Architecture andImplementation.

A data scientist needs a MIPS assembly-language program for dataanalysis. 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. ‘r1′ is the address of’a[0]’. ‘r4’ is the address 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]’. ‘r3’ is the address of ‘c[n-1]’. The algorithm is: walkthrough array ‘a’ copying even-index elements to ‘b’ in ‘b’ order,after multiplying by ‘f2’, and odd-index elements to ‘c’ in reverseorder (i.e., from high ‘c’ index to low ‘c’ index), aftermultiplying by ‘f0’. Write the MIPS code. Use only the followinginstructions.

l.d f6,n(r2) // load to ‘f6’ eight bytes starting atMem[r2+n]

s.d f6,n(r2) // store f6’s value to memory starting atMem[r2+n]

mul.d f4,f0,f2 // write ‘f0*f2’ into ‘f4’

addi r1,r1,n // add integer ‘n’ to ‘r1’

subi r1,r1,n // subtract integer ‘n’ from ‘r1’

bne r1,r2,loop // if ‘r1 /= r2’ then goto ‘loop’

Expert Answer


Answer to 3. [20 marks] Architecture and Implementation. A data scientist needs a MIPS assembly-language program for data analysis…

OR