→ suhorng: 請增加文章內容 (違反板規二) 04/27 16:41
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 101.14.180.100
※ 文章網址: https://www.ptt.cc/bbs/PLT/M.1461731899.A.340.html
Convert the following C code into the MIPS assembly code which can be tested b
y using SPIM.
void main(void)
{
int x1, x2, x3, x4, x5, x6, y ;
int add1 ( );
scanf (“%d”, &x1);
scanf (“%d”, &x2);
scanf (“%d”, &x3);
scanf (“%d”, &x4);
scanf (“%d”, &x5);
scanf (“%d”, &x6);
y = add1(x1,x2, x3) + add1 (x4, x5, x6)
printf (“%d\n”, y);
}
int add1(int a, int b, int c)
{
int d;
d = a + b + c;
return d;
}
--