Convert the following C program to MIPS assembly code e a3

Convert the following C program to MIPS assembly code

e = a[3 ] *b/c + d

where a is a single-precision floating-point array with starting address stored in registers $s0 and b, c, d and e are single-precision floating -point numbers stored in registers $f1, $f2, $f3 and $f4 , respectively.

Solution

div.s $f5, $f1, $f2 ; $f5 = b / c

l.s $f6, 12($s0) ; $f6 = a[3]

mul.s $f4, $f5, $f6 ; e = A[3] * b / c

add.s $f4, $f4, $f3 ; e = A[3] * b / c + d


Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site