Develop an assembly language programing using MIPS facility

Develop an assembly language programing using MIPS facility to convert the following C assignment Statement B[4] = X - A[8]; We assume that the value of X is in Register $50 and the base address of A and B are in registers $51 and $52.

Solution

B[4] = X - A[8]

X = $S0

A = $S1

B = $S2

lw $S3, 32($S1)

//Loading the value at A[8] in some register $S3.

//Since each element takes 4 bytes hence offset is 8*4 = 32

sub $S4, $S0, $S3 //doing subtraction and storing the result in $S4

sw $S4, 16($S2)

//Storing the value from subtraction into B[4].

//Since each element is taking 4 bytes hence offset is 4*4 = 16

 Develop an assembly language programing using MIPS facility to convert the following C assignment Statement B[4] = X - A[8]; We assume that the value of X is i

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site