Translate the following C code to MIPS assembly code Assume

Translate the following C code to MIPS assembly code. Assume that the values of a, b and c are in registers $t1, $t2 and $t3, respectively.

if (a==b)

c = 0;

else c = 1;

Solution

if (a==b)

c = 0;

else c = 1;

The above code can be translated to MIPS as follows :

ben $t1,$t2,Else
addi $t3, $0, 0
j EXIT
Else: addi $t3, $0, 1
EXIT:

Translate the following C code to MIPS assembly code. Assume that the values of a, b and c are in registers $t1, $t2 and $t3, respectively. if (a==b) c = 0; els

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site