Question: 3. [2 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
![3. [2 marks] Architecture and Implementation. A data scientist needs a](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66e06f5ab2292_60266e06f5a546d4.jpg)
3. [2 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. 'ri' is the address of 'a[O]'. '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[@]'. 'r' 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. 1.d f6,n(r2) s. d f6,n(r2) mul.d f4, fo,f2 addi ri,ri,n subi r1,r1,n bne ri,r2, loop // load to 'fo' eight bytes starting at Mem(r2+n] // store fo's value to memory starting at Mem[r2+n] // write 'fo*f2' into 'f4' // add integer 'n' to 'ri' 11 subtract integer 'n' from 'ri' // if 'ri /= r2' then goto 'loop' 3. [2 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. 'ri' is the address of 'a[O]'. '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[@]'. 'r' 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. 1.d f6,n(r2) s. d f6,n(r2) mul.d f4, fo,f2 addi ri,ri,n subi r1,r1,n bne ri,r2, loop // load to 'fo' eight bytes starting at Mem(r2+n] // store fo's value to memory starting at Mem[r2+n] // write 'fo*f2' into 'f4' // add integer 'n' to 'ri' 11 subtract integer 'n' from 'ri' // if 'ri /= r2' then goto 'loop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
