26.5k views
4 votes
MIPS coding (a) Find at least three different ways to assign 0 to register $t5 in MIPS. (b) Follow the instructions below CONSECUTIVELY, and after each instruction write the value of destination register in decimal into the space provided.

User Aluriak
by
5.6k points

1 Answer

4 votes

Answer:

Follows are the solution to this question:

Step-by-step explanation:

Please find the complete question in the attached file.

In point a:


add \ \$\ t_5, \$zero, \$zero \\\\

Add


addi \ \$ t_5, \$ \ zero, 0 \\\\

(Add immediate value)OR


\$ \ v_1, \$ \ zero, \$ \ zero

(use BITWISE OR)

In point b:


ori\ \$ \ s_0, \$ \ zero, 5 \# \$ \ s_0= 0 | 5

(BITWISE OR immediate)


add \ \$ \ s_1, \$ \ s_0, \$ \ s_0 \# \$ \ s_1 = \$ \ s_0 +\$ \ s_0 ( \ or \ simply \ 2 * \$ \ s_0)

add


sll\ \$ \ s_2, \$ \ s_1, 2 \ \# \ \$ \ s_2= \$ s_1<< 2 (or \ simply \$ \ s_1 * 4)

shift left logically


sub \ \$ \ s_4, \$ \ s_1, \$ \ s_2 \# \$\ s_4= \$ \ s_1- \$ \ s_2

subtract

MIPS coding (a) Find at least three different ways to assign 0 to register $t5 in-example-1
User David Jashi
by
5.4k points