(Solved) : 3 20 Marks Architecture Implementation Data Scientist Needs Mips Assembly Language Program Q44051068 . . .
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[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[O]’. ‘r3’ 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 (i.e., from high ‘C’ index to low ‘C’ index), after multiplying by ‘fo’. Write the MIPS code. Use only the following instructions. – 4 1.d f6, n (r2) s.d f6, n (r2) mul.d f4,f0, f2 addi ri, r1, n subi rl, rl,n bne r1,r2, loop // load to ‘f6’ eight bytes starting at Mem [r2+n] // store f6’s value to memory starting at Mem[r2+n] // write ‘f0*f2’ into ‘f4’ // add integer ‘n’ to ‘rl’ // subtract integer ‘n’ from ‘rl’ // if ‘ri /= r2’ then goto ‘loop’ 4 Show transcribed image text 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[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[O]’. ‘r3’ 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 (i.e., from high ‘C’ index to low ‘C’ index), after multiplying by ‘fo’. Write the MIPS code. Use only the following instructions. – 4 1.d f6, n (r2) s.d f6, n (r2) mul.d f4,f0, f2 addi ri, r1, n subi rl, rl,n bne r1,r2, loop // load to ‘f6’ eight bytes starting at Mem [r2+n] // store f6’s value to memory starting at Mem[r2+n] // write ‘f0*f2’ into ‘f4’ // add integer ‘n’ to ‘rl’ // subtract integer ‘n’ from ‘rl’ // if ‘ri /= r2’ then goto ‘loop’ 4
Expert Answer
Answer to 3. [20 marks] Architecture and Implementation. A data scientist needs a MIPS assembly-language program for data analysis…
OR