MIPS代写

Homework 3
(40 points, 10 points each)

Problem 1

Write assembly language code for printing the larger of two numbers specified by the user.

Problem 2 Translate the below code for counting the 1 bits in r0 into assembly code. r3 = 1;
r1 = 0;
while (r3 != 0) { if ((r0 & r3) != 0) { r1 = r1 + 1; } r3 = r3 + r3; } Problem 3 Suppose t0 contains an integer value a, and t1 contains an integer value b that is more than 0. Write an assembly language fragment that leaves in t2 the value of ab — that is, t0 raised to the positive power found in t1. You may change the values in t0 and t1, but the value for t2 should be computed reflecting the initial t0 and t1 values.

Problem 4

Write assembly language program to detect if a phrase or characters entered by the user is a palindrome.