码迷,mamicode.com
首页 > 其他好文 > 详细

MIPS program a block of C

时间:2019-02-03 19:52:42      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:--   resources   please   follow   from   OWIN   HERE   while   under   


Homework3
1. Usually, there are many ways to translate a block of C code into assembly.
It is always a good idea that you stick with your own way. Please translate
the following code blocks into MIPS, where our convention is as follows: $S0
stores integer x; $S1 stores integer y.
(1).
if (x>y+5) then x=x+y else y=x-y;
(2).
while (x>y+5) {x--; x--; y++}
(3).
for (x=1; x<y; x++) {x=x+5; y++}
2. Let arrA be an array of 6 integers. Write a MIPS program that
a. read from keyboard the content of the array: 2, -10, 3, -9, -7, 23.
b. find the second largest number in the array.
c. print the number out.
Please run your program on the si,ulator and make sure it indeed works.
3. You may use either textbook or internet resources to answer the following
question. Consider the instruction addi $S0, $S1, 18. Of course, I can use
other constants in place of the 18. What is the minimal number I can use to
replace the 18?

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:99515681@qq.com 

微信:codinghelp

MIPS program a block of C

标签:--   resources   please   follow   from   OWIN   HERE   while   under   

原文地址:https://www.cnblogs.com/phphelper/p/10350834.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!