samedi 30 novembre 2019

MIPS code for while loop and if condition

How would I convert this code into MIPS instructions?

while(i>0){ 
 if(i>2) {
  A[i] = A[i]+B[k]
 }
 else{
  A[i] = A[i]-B[k]
 }
i--;
}

where i,k are stored in $11,$12 registers and the base address of A and B are stored in $15,$16 registers .

Aucun commentaire:

Enregistrer un commentaire