I don\'t understand loops in MIPS yet... $a0 is an integer argument while $a1 is
ID: 3528762 • Letter: I
Question
I don't understand loops in MIPS yet...
Explanation / Answer
func()
{
t1 = 31; // initializing t1 to 31
t0 = 31; // initializing t0 to 31
while(1){
t3=a0 >> t1; // right shifting a0 by t1 and storing in t3
t3 =t3 & 1; // restoring LSB of t3
t3 = t3 + 48; // adding 48 to t3
t4 = t0 - t1;
t2 = a1 + t4 ;
*t2 = t3; // storing t3 to address of (t2+0)
if(t1==0) break;
t1=t1-1;
}
*(t2+1)=0; // storing 0 at t2[1]
return ;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.