Question: Use MIPS assembly code to perform: 1) Sum all even numbers. 2) Sum all odd numbers. Hint: To decide if a number is even or

Use MIPS assembly code to perform:

1) Sum all even numbers.

2) Sum all odd numbers.

Hint:

To decide if a number is even or odd, you may want to use "srl" and then "sll" the previous result. Then, compare the result to its original value. If they are equal, it is even; otherwise it is odd.

e.g.

Suppose t = 5

Right shift t by 1 bit is 2.

Left shift 2 by 1 bit is 4.

Then, t is an odd number.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!